2015-11-06 17:40:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-12 21:42:41 +01:00
|
|
|
# set -e (exit when a line returns non-0 status) and -x (xtrace) flags
|
2015-11-06 17:40:33 +01:00
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2017-01-13 23:05:37 +01:00
|
|
|
# Import constants from config file
|
2017-01-12 21:42:41 +01:00
|
|
|
source ./config.sh
|
2015-11-06 17:40:33 +01:00
|
|
|
|
|
|
|
if [ ${ID} -ne 0 ]; then
|
2017-01-11 04:03:33 +01:00
|
|
|
echo "GROOMER: This script has to be run as root."
|
2015-11-06 17:40:33 +01:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
clean(){
|
2017-01-31 21:44:13 +01:00
|
|
|
if [ ${DEBUG} = true ]; then
|
|
|
|
sleep 20
|
|
|
|
fi
|
2017-01-11 04:03:33 +01:00
|
|
|
echo "GROOMER: cleaning up after init.sh."
|
2015-11-06 17:40:33 +01:00
|
|
|
${SYNC}
|
2017-01-13 23:56:16 +01:00
|
|
|
# Stop the music from playing
|
|
|
|
kill -9 $(cat /tmp/music.pid)
|
|
|
|
rm -f /tmp/music.pid
|
2015-11-06 17:40:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
trap clean EXIT TERM INT
|
|
|
|
|
2017-01-25 07:59:35 +01:00
|
|
|
# Stop hdmi display from sleeping after a period of time
|
|
|
|
setterm -powersave off -blank 0
|
|
|
|
|
2017-01-13 23:56:16 +01:00
|
|
|
# Start music
|
|
|
|
./music.sh &
|
|
|
|
echo $! > /tmp/music.pid
|
|
|
|
|
2017-01-17 16:15:36 +01:00
|
|
|
# List block storage devices for debugging
|
2017-01-31 21:44:13 +01:00
|
|
|
if [ ${DEBUG} = true ]; then
|
|
|
|
lsblk |& tee -a ${DEBUG_LOG}
|
|
|
|
fi
|
2017-01-12 20:00:51 +01:00
|
|
|
|
2017-01-31 21:44:13 +01:00
|
|
|
su ${USERNAME} -c ./mount_dest.sh |& tee -a ${DEBUG_LOG}
|