mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
clean up and hide messages (#891)
This commit is contained in:
parent
d1197ba428
commit
2f50afb82e
1 changed files with 39 additions and 27 deletions
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
# much thx to frennkie working the prototype on this
|
||||
# based on https://gist.github.com/frennkie/4d99cb35a3c62033a535564220c11150
|
||||
# see issue: https://github.com/rootzoll/raspiblitz/issues/646
|
||||
# and issue: https://github.com/rootzoll/raspiblitz/issues/809
|
||||
# to work it needs to be based on Raspbian Desktop base image
|
||||
|
||||
source /home/admin/raspiblitz.info
|
||||
|
@ -10,7 +9,7 @@ source /mnt/hdd/raspiblitz.conf
|
|||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "STILL EXPERIMENTAL - NOT FINISHED"
|
||||
echo "the touch screen feature"
|
||||
echo "the Blitz-Touch-User-Interface (BlitzTUI) feature"
|
||||
echo "blitz.touchscreen.sh [on|off]"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -25,16 +24,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
echo "Turn ON: Touchscreen"
|
||||
|
||||
# update install sources
|
||||
echo "make sure dependencies are installed ..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y unclutter xterm
|
||||
# TODO(frennkie) should this be removed when running "off"?
|
||||
sudo apt-get install -y python3-pyqt5
|
||||
echo ""
|
||||
echo "making sure system dependencies are installed"
|
||||
sudo apt-get update >/dev/null
|
||||
sudo apt-get install -y unclutter xterm python3-pyqt5 >/dev/null
|
||||
|
||||
echo "installing BlitzTUI (including dependencies)"
|
||||
/home/admin/python3-env-lnd/bin/pip install BlitzTUI
|
||||
echo ""
|
||||
# check if python3 env exists - if not install it
|
||||
if [ ! -d /home/admin/python3-env-lnd ]; then
|
||||
echo "installing Python3 virtual env"
|
||||
python3 -m venv --system-site-packages /home/admin/python3-env-lnd
|
||||
/home/admin/python3-env-lnd/bin/python3 -m pip install grpcio grpcio-tools googleapis-common-protos pathlib2
|
||||
fi
|
||||
|
||||
echo "installing BlitzTUI (including python dependencies)"
|
||||
/home/admin/python3-env-lnd/bin/pip install BlitzTUI >/dev/null
|
||||
|
||||
# make sure lndlibs are patched for compatibility for both Python2 and Python3
|
||||
if ! grep -Fxq "from __future__ import absolute_import" /home/admin/config.scripts/lndlibs/rpc_pb2_grpc.py; then
|
||||
|
@ -46,7 +48,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
fi
|
||||
|
||||
# switch to desktop login
|
||||
sudo raspi-config nonint do_boot_behaviour B4
|
||||
sudo raspi-config nonint do_boot_behaviour B4 >/dev/null 2>&1
|
||||
|
||||
# set user pi user for autostart
|
||||
sudo sed -i 's/^autologin-user=.*/autologin-user=pi/g' /etc/lightdm/lightdm.conf
|
||||
|
@ -56,8 +58,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||
# remove welcome wizard
|
||||
sudo rm -rf /etc/xdg/autostart/piwiz.desktop
|
||||
|
||||
if [ -f /etc/xdg/lxsession/LXDE-pi/autostart ]; then
|
||||
sudo mv /etc/xdg/lxsession/LXDE-pi/autostart /etc/xdg/lxsession/LXDE-pi/autostart.bak
|
||||
fi
|
||||
# write new LXDE autostart config
|
||||
sudo mv /etc/xdg/lxsession/LXDE-pi/autostart /etc/xdg/lxsession/LXDE-pi/autostart.bak
|
||||
cat << EOF | sudo tee /etc/xdg/lxsession/LXDE-pi/autostart >/dev/null
|
||||
@unclutter -idle 0
|
||||
@xset s noblank
|
||||
|
@ -77,7 +81,7 @@ EOF
|
|||
sudo chown pi:pi /home/pi/autostart.sh
|
||||
|
||||
# Remove 00infoLCD.sh from .bashrc of pi user
|
||||
sudo sed -i s'/exec $SCRIPT/#exec $SCRIPT/' /home/pi/.bashrc
|
||||
sudo sed -i 's/^exec $SCRIPT/#exec $SCRIPT/' /home/pi/.bashrc
|
||||
|
||||
# adapt design by changing openbox settings
|
||||
sudo sed -i -E 's/<weight>Normal</<weight>Bold</g' /etc/xdg/openbox/lxde-pi-rc.xml
|
||||
|
@ -91,10 +95,11 @@ EOF
|
|||
# Copy over the macaroons
|
||||
sudo mkdir -p /home/pi/.lnd/data/chain/bitcoin/mainnet/
|
||||
sudo chmod 700 /home/pi/.lnd/
|
||||
sudo ln -s /home/admin/.lnd/tls.cert /home/pi/.lnd/
|
||||
sudo ln -nsf /home/admin/.lnd/tls.cert /home/pi/.lnd/
|
||||
sudo cp /home/admin/.lnd/data/chain/bitcoin/mainnet/readonly.macaroon /home/pi/.lnd/data/chain/bitcoin/mainnet/
|
||||
sudo cp /home/admin/.lnd/data/chain/bitcoin/mainnet/invoice.macaroon /home/pi/.lnd/data/chain/bitcoin/mainnet/
|
||||
sudo chmod 600 /home/pi/.lnd/data/chain/bitcoin/mainnet/*.macaroon
|
||||
sudo chmod 600 /home/pi/.lnd/data/chain/bitcoin/mainnet/readonly.macaroon
|
||||
sudo chmod 600 /home/pi/.lnd/data/chain/bitcoin/mainnet/invoice.macaroon
|
||||
sudo chown -R pi:pi /home/pi/.lnd/
|
||||
|
||||
# rotate touchscreen based on if LCD is rotated
|
||||
|
@ -117,7 +122,7 @@ EOF
|
|||
if [ ${#touchscreen} -eq 0 ]; then
|
||||
echo "touchscreen=0" >> /mnt/hdd/raspiblitz.conf
|
||||
fi
|
||||
sudo sed -i "s/^touchscreen=.*/touchscreen=1/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i 's/^touchscreen=.*/touchscreen=1/g' /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "OK - a restart is needed: sudo shutdown -r now"
|
||||
|
||||
|
@ -132,27 +137,34 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||
echo "Turn OFF: Touchscreen"
|
||||
|
||||
# switch back to console login
|
||||
sudo raspi-config nonint do_boot_behaviour B2
|
||||
echo "switching back to console mode on boot"
|
||||
sudo raspi-config nonint do_boot_behaviour B2 >/dev/null 2>&1
|
||||
|
||||
# set user pi user for autostart
|
||||
sudo sed -i s'/--autologin root/--autologin pi/' /etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
sudo sed -i s'/--autologin admin/--autologin pi/' /etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
# TODO(frennkie/rootzoll) what should happen here? This does the same as "on".
|
||||
sudo sed -i 's/--autologin root/--autologin pi/' /etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
sudo sed -i 's/--autologin admin/--autologin pi/' /etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
|
||||
# move back old LXDE autostart config
|
||||
sudo rm /etc/xdg/lxsession/LXDE-pi/autostart
|
||||
sudo mv /etc/xdg/lxsession/LXDE-pi/autostart.bak /etc/xdg/lxsession/LXDE-pi/autostart
|
||||
sudo rm -f /etc/xdg/lxsession/LXDE-pi/autostart
|
||||
if [ -f /etc/xdg/lxsession/LXDE-pi/autostart.bak ]; then
|
||||
sudo mv -f /etc/xdg/lxsession/LXDE-pi/autostart.bak /etc/xdg/lxsession/LXDE-pi/autostart
|
||||
fi
|
||||
|
||||
# add again 00infoLCD.sh to .bashrc of pi user
|
||||
sudo sed -i s'/#exec $SCRIPT/exec $SCRIPT/' /home/pi/.bashrc
|
||||
sudo sed -i s'/^#exec $SCRIPT/exec $SCRIPT/' /home/pi/.bashrc
|
||||
|
||||
# remove copy of macaroons
|
||||
sudo rm -rf /home/pi/.lnd/
|
||||
|
||||
# remove old pi autostart
|
||||
sudo rm /home/pi/autostart.sh
|
||||
sudo rm -f /home/pi/autostart.sh
|
||||
|
||||
# delete possible touchscreen rotate
|
||||
sudo rm /etc/X11/xorg.conf.d/40-libinput.conf >/dev/null
|
||||
sudo rm -f /etc/X11/xorg.conf.d/40-libinput.conf >/dev/null
|
||||
|
||||
# mark touchscreen as switched OFF in config
|
||||
sudo sed -i "s/^touchscreen=.*/touchscreen=0/g" /mnt/hdd/raspiblitz.conf
|
||||
sudo sed -i 's/^touchscreen=.*/touchscreen=0/g' /mnt/hdd/raspiblitz.conf
|
||||
|
||||
echo "OK - a restart is needed: sudo shutdown -r now"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue