Update to use Go based UI

This commit is contained in:
KemoNine 2020-08-28 18:46:13 -04:00
parent 926435f924
commit d260b81ed4
3 changed files with 67 additions and 162 deletions

View File

@ -20,10 +20,10 @@ cat > /etc/monit/conf.d/tankfs <<EOF
check filesystem tankfs with path /tank
if space usage > 80% then alert
EOF
cat > /etc/monit/conf.d/fim <<EOF
check process fim matching /usr/bin/fim
start program = "/usr/bin/systemctl start fim"
stop program = "/usr/bin/systemctl stop fim"
cat > /etc/monit/conf.d/pf-ui <<EOF
check process pf-ui matching /usr/local/bin/pf-ui
start program = "/usr/bin/systemctl start pf-ui"
stop program = "/usr/bin/systemctl stop pf-ui"
if does not exist then alert
if does not exist for 2 cycles then restart
EOF

View File

@ -12,174 +12,52 @@ The below commands will setup ```fim``` as a slideshow on your display.
``` sh
# Setup UI binary
DL_URL=$(curl https://git.kemonine.info/api/v1/repos/PiFrame/piframe-go/releases | jq -r '.[0].assets[] | select(.name == "ui") | .browser_download_url')
wget $DL_URL -O /usr/local/bin/pf-ui
chmod a+x /usr/local/bin/pf-ui
# Setup systemd service for UI
mkdir /etc/systemd/system/getty@tty1.service.d/
cat > /etc/systemd/system/getty@tty1.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=-/usr/local/bin/pf-ui
StandardInput=tty
StandardOutput=tty
EOF
# Add fim user and setup fim
useradd -m -G video -s /usr/sbin/nologin fim
apt install acl
setfacl -m "u:fim:rwX" /tank/pictures
setfacl -dm "u:fim:rwX" /tank/pictures
apt install fim imagemagick ttf-dejavu
cat > /home/fim/.fimrc <<EOF
cat > /usr/local/etc/fimrc <<EOF
# Ensure simages are auto-centered on the screen
_want_autocenter=1;
# Reduce the amount of ram used by dialing back the image cache
_max_cached_images=1;
# Rotate screen if the display used (CONFU 5.5 in particular) isn't rotated proper
#_orientation=1;
#_orientation=2;
# Turn on/off status bar and similar
_display_busy=0;
_display_console=0;
_display_status=0;
_display_status_bar=0;
_display_status_fmt=0;
unbind " ";
unbind "!";
unbind """;
unbind "#";
unbind "$";
unbind "%";
unbind "&";
unbind "";
unbind "(";
unbind ")";
unbind "*";
unbind "+";
unbind ",";
unbind "-";
unbind ".";
unbind "/";
unbind "0";
unbind "1";
unbind "2";
unbind "3";
unbind "4";
unbind "5";
unbind "6";
unbind "7";
unbind "8";
unbind "9";
unbind ":";
unbind ";";
unbind "<";
unbind "=";
unbind ">";
unbind "?";
unbind "@";
unbind "A";
unbind "Any";
unbind "B";
unbind "BackSpace";
unbind "Backspace";
unbind "C";
unbind "C-a";
unbind "C-b";
unbind "C-c";
unbind "C-d";
unbind "C-e";
unbind "C-f";
unbind "C-g";
unbind "C-h";
unbind "C-i";
unbind "C-j";
unbind "C-k";
unbind "C-l";
unbind "C-m";
unbind "C-n";
unbind "C-o";
unbind "C-p";
unbind "C-q";
unbind "C-r";
unbind "C-s";
unbind "C-t";
unbind "C-u";
unbind "C-v";
unbind "C-w";
unbind "C-x";
unbind "C-y";
unbind "C-z";
unbind "D";
unbind "Del";
unbind "Down";
unbind "E";
unbind "End";
unbind "Enter";
unbind "Esc";
unbind "F";
unbind "G";
unbind "H";
unbind "Home";
unbind "I";
unbind "Ins";
unbind "J";
unbind "K";
unbind "L";
unbind "Left";
unbind "M";
unbind "N";
unbind "O";
unbind "P";
unbind "PageDown";
unbind "PageUp";
unbind "Q";
unbind "R";
unbind "Right";
unbind "S";
unbind "T";
unbind "Tab";
unbind "U";
unbind "Up";
unbind "V";
unbind "W";
unbind "X";
unbind "Y";
unbind "Z";
unbind "[";
unbind "\";
unbind "]";
unbind "^";
unbind "_";
unbind "";
unbind "a";
unbind "b";
unbind "c";
unbind "d";
unbind "e";
unbind "f";
unbind "g";
unbind "h";
unbind "i";
unbind "j";
unbind "k";
unbind "l";
unbind "m";
unbind "n";
unbind "o";
unbind "p";
unbind "q";
unbind "r";
unbind "s";
unbind "t";
unbind "u";
unbind "v";
unbind "w";
unbind "x";
unbind "y";
unbind "z";
unbind "{";
unbind "|";
unbind "}";
unbind "~";
EOF
cat > /etc/default/fim_album <<EOF
cat > /etc/default/fim_albums <<EOF
/tank/pictures
EOF
cat > /etc/default/fim_album_index <<EOF
0
EOF
cat > /usr/local/bin/fim-slideshow.sh <<EOF
cat > /usr/local/bin/pf-fim.sh <<EOF
#!/bin/bash
ALBUM_PATH=\`cat /etc/default/fim_album\`
# options inspiration: https://www.raspberrypi.org/forums/viewtopic.php?t=196043
chvt 1
tput civis
/usr/bin/fim --verbose --no-commandline --no-history \
exec </dev/tty1 >/dev/tty1 2>/dev/tty1
#echo 2 > /sys/class/graphics/fbcon/rotate_all
ALBUM_PATH=\`cat /etc/default/fim_albums\`
/usr/bin/fim --verbose --no-commandline --no-history --etc-fimrc /usr/local/etc/fimrc \
--device /dev/fb0 --vt 1 \
--execute-commands-early "clear" --final-commands "clear" \
--execute-commands 'while(1){display;sleep "300";next;}' \
@ -187,24 +65,20 @@ tput civis
--cd-and-readdir --recursive \
"\$ALBUM_PATH"
EOF
chmod a+x /usr/local/bin/fim-slideshow.sh
cat > /etc/systemd/system/fim.service <<EOF
chmod a+x /usr/local/bin/pf-fim.sh
cat > /etc/systemd/system/pf-ui.service <<EOF
[Unit]
Description=fim slideshow
Description=PiFrame UI
After=getty.target
[Service]
User=fim
ExecStart=/usr/local/bin/fim-slideshow.sh
ExecStart=/usr/local/bin/pf-ui
Restart=always
RuntimeMaxSec=604800
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl stop getty@tty1
systemctl disable getty@tty1
cat > /usr/local/bin/no-cursor-tty1.sh <<EOF
#!/bin/bash
/usr/bin/tput -T screen civis > /dev/tty1
@ -222,9 +96,6 @@ ExecStart=/usr/local/bin/no-cursor-tty1.sh
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now no-cursor-tty1
systemctl enable --now fim
DL_URL=$(curl https://git.kemonine.info/api/v1/repos/PiFrame/piframe-go/releases | jq -r '.[0].assets[] | select(.name == "inotify") | .browser_download_url')
wget $DL_URL -O /usr/local/bin/pf-inotify
@ -244,7 +115,11 @@ Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now no-cursor-tty1
systemctl enable getty@tty1.service
systemctl restart getty@tty1.service
systemctl enable --now inotify-pictures
```

View File

@ -18,4 +18,34 @@ mount /tank
btrfs subvolume create /tank/pictures
# load pictures via rclone/syncthing/scp/etc (semi-optional)
# Various tty tweaks
cat > /etc/default/console-setup <<EOF
# CONFIGURATION FILE FOR SETUPCON
# Consult the console-setup(5) manual page.
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="Uni2"
FONTFACE="Terminus"
FONTSIZE="32x16"
VIDEOMODE=
VIDEOMODE=
# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'
EOF
update-initramfs -u
# IF you need rotation
#/boot/firmware/cmdline.txt
#fbcon=rotate:2
systemctl reboot
```