diff --git a/config/chromium.conf b/config/chromium.conf index 3b0a49947..4c472be35 100644 --- a/config/chromium.conf +++ b/config/chromium.conf @@ -6,7 +6,7 @@ CHROMIUM_FLAGS="\ --disable-smooth-scrolling \ --disable-low-res-tiling \ --enable-low-end-device-mode \ ---num-raster-threads=2 \ +--num-raster-threads=4 \ --profiler-timing=0 \ --disable-composited-antialiasing \ ---disk-cache-size=100000000" +--disk-cache-size=300000000 \ No newline at end of file diff --git a/desktop.sh b/desktop.sh index a4cbab616..3af19cdbe 100644 --- a/desktop.sh +++ b/desktop.sh @@ -25,7 +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/xdgcache\"" > $CACHEDIR/$SDCARD/etc/chromium-browser/customizations/10-cachedir + 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 diff --git a/distributions.sh b/distributions.sh index 6d4648177..790ab5188 100644 --- a/distributions.sh +++ b/distributions.sh @@ -138,7 +138,7 @@ install_common() install -m 644 $SRC/lib/scripts/firstrun.service $CACHEDIR/$SDCARD/etc/systemd/system/ # enable additional services - chroot $CACHEDIR/$SDCARD /bin/bash -c "systemctl --no-reload enable firstrun.service resize2fs.service armhwinfo.service log2ram.service xdgcache2ram.service >/dev/null 2>&1" + chroot $CACHEDIR/$SDCARD /bin/bash -c "systemctl --no-reload enable firstrun.service resize2fs.service armhwinfo.service log2ram.service >/dev/null 2>&1" # copy "first run automated config, optional user configured" cp $SRC/lib/config/armbian_first_run.txt $CACHEDIR/$SDCARD/boot/armbian_first_run.txt diff --git a/makeboarddeb.sh b/makeboarddeb.sh index d6efbe920..9a5e99b98 100644 --- a/makeboarddeb.sh +++ b/makeboarddeb.sh @@ -67,7 +67,7 @@ create_board_package() #!/bin/sh [ remove = "\$1" ] || [ abort-install = "\$1" ] && dpkg-divert --package linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} --remove --rename \ --divert /etc/mpv/mpv-dist.conf /etc/mpv/mpv.conf - systemctl disable log2ram.service xdgcache2ram.service armhwinfo.service >/dev/null 2>&1 + systemctl disable log2ram.service armhwinfo.service >/dev/null 2>&1 exit 0 EOF @@ -88,12 +88,6 @@ create_board_package() if [ -f "/etc/systemd/system/log2ram.service" ]; then mv /etc/systemd/system/log2ram.service /etc/systemd/system/log2ram-service.dpkg-old fi - if [ ! -f "/etc/default/xdgcache2ram" ]; then - cp /etc/default/xdgcache2ram.dpkg-dist /etc/default/xdgcache2ram - fi - if [ -f "/etc/systemd/system/xdgcache2ram.service" ]; then - mv /etc/systemd/system/xdgcache2ram.service /etc/systemd/system/xdgcache2ram-service.dpkg-old - fi exit 0 EOF @@ -292,11 +286,6 @@ create_board_package() install -m 755 $SRC/lib/scripts/log2ram/log2ram.hourly $destination/etc/cron.daily/log2ram cp $SRC/lib/scripts/log2ram/log2ram.default $destination/etc/default/log2ram.dpkg-dist - # xdgcache2ram - persistent xdgcache based on log2ram - cp $SRC/lib/scripts/log2ram/xdgcache2ram.service $destination/lib/systemd/system/xdgcache2ram.service - ln -s /usr/sbin/log2ram $destination/usr/sbin/xdgcache2ram - cp $SRC/lib/scripts/log2ram/xdgcache2ram.default $destination/etc/default/xdgcache2ram.dpkg-dist - if [[ $LINUXFAMILY == sun*i ]]; then install -m 755 $SRC/lib/scripts/armbian-add-overlay $destination/usr/sbin if [[ $BRANCH == default ]]; then diff --git a/scripts/armhwinfo b/scripts/armhwinfo index ed76ba1ad..ee41af039 100644 --- a/scripts/armhwinfo +++ b/scripts/armhwinfo @@ -316,7 +316,7 @@ adjust_chromium_settings() { if [ -f /etc/chromium-browser/default ]; then # create chromium cache directory - [[ ! -d /var/xdgcache ]] && mkdir -m775 /var/xdgcache && chgrp netdev /var/xdgcache && chmod g+w /var/xdgcache + [[ ! -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 @@ -324,13 +324,13 @@ adjust_chromium_settings() { memory_total=$(awk '{printf("%d",$2/1024)}' <<<${mem_info}) cpu_cores=$(grep -c processor /proc/cpuinfo) chromium_disk_cache=$(( ${memory_total} * 158000 )) - xdgcache_size=$(( ${memory_total} / 1000 * 150 )) + log2ram_size=$(( 50 + $(( ${memory_total} / 1000 * 150 )) )) - # adjust xdgcache 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=${xdgcache_size}M" /etc/default/log2ram || \ - sed -i -e "s/^SIZE=.*/SIZE=${xdgcache_size}M/" -e "s/^ENABLED=.*/ENABLED=true/" \ - /etc/default/xdgcache2ram && systemctl restart xdgcache2ram + 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}/" \ diff --git a/scripts/log2ram/log2ram b/scripts/log2ram/log2ram index db3f536cd..2f41a8fd3 100644 --- a/scripts/log2ram/log2ram +++ b/scripts/log2ram/log2ram @@ -1,24 +1,22 @@ #!/bin/sh -# Source based on: https://github.com/azlux/log2ram +# Source: https://github.com/azlux/log2ram # License: MIT # License file: /usr/share/log2ram/LICENSE SIZE=40M USE_RSYNC=false ENABLED=false -ME="${0##*/}" -DIRNAME="$(sed 's/2ram$//' <<<"${ME}")" -[ -f /etc/default/${ME} ] && . /etc/default/${ME} +[ -f /etc/default/log2ram ] && . /etc/default/log2ram [ "$ENABLED" != true ] && exit 0 # don't touch anything below here. -HDD_LOG=/var/${DIRNAME}.hdd/ -RAM_LOG=/var/${DIRNAME}/ -LOG2RAM_LOG="${HDD_LOG}${ME}.log" +HDD_LOG=/var/log.hdd/ +RAM_LOG=/var/log/ +LOG2RAM_LOG="${HDD_LOG}log2ram.log" LOG_OUTPUT="tee -a $LOG2RAM_LOG" isSafe () { @@ -30,7 +28,7 @@ syncToDisk () { isSafe if [ "$USE_RSYNC" = true ]; then - rsync -aXWv --delete --exclude ${ME}.log --links $RAM_LOG $HDD_LOG 2>&1 | $LOG_OUTPUT + rsync -aXWv --delete --exclude log2ram.log --links $RAM_LOG $HDD_LOG 2>&1 | $LOG_OUTPUT else cp -rfup $RAM_LOG -T $HDD_LOG 2>&1 | $LOG_OUTPUT fi @@ -40,7 +38,7 @@ syncFromDisk () { isSafe if [ "$USE_RSYNC" = true ]; then - rsync -aXWv --delete --exclude ${ME}.log --links $HDD_LOG $RAM_LOG 2>&1 | $LOG_OUTPUT + rsync -aXWv --delete --exclude log2ram.log --links $HDD_LOG $RAM_LOG 2>&1 | $LOG_OUTPUT else cp -rfup $HDD_LOG -T $RAM_LOG 2>&1 | $LOG_OUTPUT fi @@ -53,7 +51,7 @@ case "$1" in rm -f $LOG2RAM_LOG mount --bind $RAM_LOG $HDD_LOG mount --make-private $HDD_LOG - mount -t tmpfs -o nosuid,noexec,nodev,mode=0755,size=$SIZE ${ME} $RAM_LOG + mount -t tmpfs -o nosuid,noexec,nodev,mode=0755,size=$SIZE log2ram $RAM_LOG syncFromDisk ;; @@ -67,7 +65,7 @@ case "$1" in syncToDisk ;; *) - echo "Usage: ${ME} {start|stop|write}" >&2 + echo "Usage: log2ram {start|stop|write}" >&2 exit 1 ;; esac diff --git a/scripts/log2ram/xdgcache2ram.default b/scripts/log2ram/xdgcache2ram.default deleted file mode 100644 index 0a385f4a8..000000000 --- a/scripts/log2ram/xdgcache2ram.default +++ /dev/null @@ -1,13 +0,0 @@ -# configuration values for the log2ram service -# -# enable the log2ram service? -ENABLED=false -# -# size of the tmpfs mount -SIZE=1M -# -# use rsync instead of cp -r -# requires rsync installed, may provide better performance -# due to copying only new and changed files -USE_RSYNC=true -# diff --git a/scripts/log2ram/xdgcache2ram.service b/scripts/log2ram/xdgcache2ram.service deleted file mode 100644 index cb0ba3543..000000000 --- a/scripts/log2ram/xdgcache2ram.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=Armbian enhanced xdgcache based on Log2Ram -DefaultDependencies=no -Before=rsyslog.service syslog.target systemd-journald.service sysinit.target shutdown.target -After=local-fs.target -Conflicts=shutdown.target -RequiresMountsFor=/var/xdgcache /var/xdgcache.hdd -IgnoreOnIsolate=yes - -[Service] -Type=oneshot -ExecStart=/usr/sbin/xdgcache2ram start -ExecStop=/usr/sbin/xdgcache2ram stop -ExecReload=/usr/sbin/xdgcache2ram write -RemainAfterExit=yes - -[Install] -WantedBy=sysinit.target