More changes for Chromium caching
This commit is contained in:
parent
6285d91a49
commit
b56fce2c95
@ -25,6 +25,7 @@ install_desktop ()
|
||||
|
||||
# install optimized chromium configuration
|
||||
cp $SRC/lib/config/chromium.conf $CACHEDIR/$SDCARD/etc/chromium-browser/default
|
||||
echo "export XDG_CACHE_HOME=\"/var/log/.cache\"" > $CACHEDIR/$SDCARD/etc/chromium-browser/customizations/10-cachedir
|
||||
fi
|
||||
# install dedicated startup icons
|
||||
cp $SRC/lib/bin/icons/${RELEASE}.png $CACHEDIR/$SDCARD/usr/share/pixmaps
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: armhwinfo
|
||||
# Required-Start:
|
||||
# Required-Start:
|
||||
# Required-Stop: glibc
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
@ -258,7 +258,7 @@ log_hardware_info() {
|
||||
echo -e "\n### cpuinfo:\n" >>${Log}
|
||||
cat /proc/cpuinfo >>${Log}
|
||||
echo -e "\n### meminfo:\n" >>${Log}
|
||||
cat /proc/meminfo >>${Log}
|
||||
cat /proc/meminfo >>${Log}
|
||||
echo -e "\n### ifconfig:\n" >>${Log}
|
||||
ifconfig >>${Log}
|
||||
echo -e "### partitions:\n" >>${Log}
|
||||
@ -314,6 +314,10 @@ check_sd_card_speed() {
|
||||
|
||||
adjust_chromium_settings() {
|
||||
if [ -f /etc/chromium-browser/default ]; then
|
||||
|
||||
# create chromium cache directory
|
||||
[[ ! -d /var/log/.cache ]] && mkdir /var/log/.cache && chgrp netdev /var/log/.cache && chmod g+w /var/log/.cache
|
||||
|
||||
# Desktop image. Let's adjust chromium cache size depending on available DRAM (15%)
|
||||
# and count of render threads based on number of CPU cores
|
||||
mem_info=$(LANG=en_US.UTF-8 free -w 2>/dev/null | grep "^Mem" || LANG=en_US.UTF-8 free | grep "^Mem")
|
||||
@ -321,13 +325,13 @@ adjust_chromium_settings() {
|
||||
cpu_cores=$(grep -c processor /proc/cpuinfo)
|
||||
chromium_disk_cache=$(( ${memory_total} * 158000 ))
|
||||
log2ram_size=$(( 50 + $(( ${memory_total} / 1000 * 150 )) ))
|
||||
|
||||
# adjust log2ram config if necessary (switching between devices with different amount
|
||||
|
||||
# adjust log2ram config if necessary (switching between devices with different amount
|
||||
# of DRAM but same OS image)
|
||||
grep -q "^SIZE=${log2ram_size}M" /etc/default/log2ram || \
|
||||
sed -i "s/^SIZE=.*/SIZE=${log2ram_size}M/" /etc/default/log2ram && \
|
||||
systemctl restart log2ram
|
||||
|
||||
|
||||
# adjust chromium settings
|
||||
sed -i -e "s/disk-cache-size=.*/disk-cache-size=${chromium_disk_cache}/" \
|
||||
-e "s/num-raster-threads=.*/num-raster-threads=${cpu_cores}/" \
|
||||
@ -339,20 +343,20 @@ case $1 in
|
||||
*start*)
|
||||
# set optimal disk scheduler settings
|
||||
set_io_scheduler &
|
||||
|
||||
|
||||
# check/set chromium optimizations
|
||||
adjust_chromium_settings &
|
||||
|
||||
|
||||
# check sd card speed once on 3rd boot too warn for too slow media
|
||||
check_sd_card_speed &
|
||||
|
||||
# get hardware information and rely on contents of /etc/armbian-release
|
||||
collect_information
|
||||
|
||||
|
||||
# hardware preparation
|
||||
prepare_board &
|
||||
prepare_temp_monitoring &
|
||||
|
||||
|
||||
# display message, log hardware id to file, write log
|
||||
echo -e "[\e[0;32m ok \x1B[0m] Starting ARM hardware info: $ID (${VERSION})"
|
||||
echo $BOARD_NAME >/var/run/machine.id # we should leave this, maybe users depend on it
|
||||
|
||||
Loading…
Reference in New Issue
Block a user