Last active 1747056653

# RUN chromium in full screen with minimal SD-Card writes, runs OK on a Raspberry 3 with a webpage playing video

start_chromium.sh Raw
1#!/bin/sh
2
3# RUN chromium in full screen with minimal SD-Card writes, runs OK on a Raspberry 3 with a webpage playing video
4
5# ADD a ram disk in fstab with this line
6# tmpfs /tmpcache tmpfs nodiratime,noatime,nosuid,nodev,size=256M 0 0
7
8# and that this script is called on startup for a minimalistic (no desktop setup)
9# /etc/xdg/openbox/autostart
10
11# or (if you want to keep your desktop with other stuff)
12# Insiide /home/pi/.config/lxsession/LXDE-pi
13# @lxpanel --profile LXDE-pi
14# @pcmanfm --desktop --profile LXDE-pi
15# @xscreensaver -no-splash
16# /home/pi/start_chromium_stats.sh > /var/log/auto_start_output_stats_browser.log 2>&1 &
17
18export DISPLAY=:0
19# Disable any form of screen saver / screen blanking / power management
20xset s off
21xset s noblank
22xset -dpms
23
24unclutter -idle 0.01 &
25
26# Allow quitting the X server with CTRL-ATL-Backspace
27setxkbmap -option terminate:ctrl_alt_bksp
28
29# Chromium keeps writing shit continuously in ~/.config/chromium
30# BUT WE cannot kill it completely because Home Assistant requires a login to save
31#mkdir /tmpcache/chromium_config_tmp
32#rm -rf ~/.config/chromium/
33#ln -s /tmpcache/chromium_config_tmp ~/.config/chromium
34
35# Create links to RamDisk for most active files by chromium as observed using iotop / lsof
36
37rm -rf /home/pi/.config/chromium/Default/IndexedDB
38mkdir /tmpcache/IndexedDB
39ln -s /tmpcache/IndexedDB /home/pi/.config/chromium/Default/IndexedDB
40
41rm -rf /home/pi/.config/chromium/Default/GPUCache
42mkdir /tmpcache/GPUCache
43ln -s /tmpcache/GPUCache /home/pi/.config/chromium/Default/GPUCache
44
45rm -rf "/home/pi/.config/chromium/Default/Local Extension Settings"
46mkdir /tmpcache/ChromeLocalExtensionSetttings
47ln -s /tmpcache/ChromeLocalExtensionSetttings "/home/pi/.config/chromium/Default/Local Extension Settings"
48
49rm -rf "/home/pi/.config/chromium/Default/QuotaManager-journal"
50mkdir /tmpcache/ChromeQuotaManager-journal
51ln -s /tmpcache/ChromeQuotaManager-journal "/home/pi/.config/chromium/Default/QuotaManager-journal"
52
53rm -rf "/home/pi/.config/chromium/Default/QuotaManager"
54mkdir /tmpcache/ChromeQuotaManager
55ln -s /tmpcache/ChromeQuotaManager "/home/pi/.config/chromium/Default/QuotaManager"
56
57sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
58sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
59nice -n 5 chromium-browser --disk-cache-dir=/tmpcache --force-device-scale-factor=0.68 --disable-infobars --enable-features=OverlayScrollbar,OverlayScrollbarFlashAfterAnyScrollUpdate,OverlayScrollbarFlashWhenMouseEnter --kiosk 'http://192.168.0.182:8123/lovelace-telacheia/0'
60
61