Browse Source

fix after boot setup script

#146
rootzoll 6 years ago
parent
commit
c1dcbe6e4a
  1. 6
      build.sdcard/raspbianStretchDesktop.sh
  2. 36
      home.admin/_bootstrap.sh

6
build.sdcard/raspbianStretchDesktop.sh

@ -372,14 +372,14 @@ sudo bash -c 'echo "SCRIPT=/home/admin/00infoLCD.sh" >> /home/pi/.bashrc'
sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/pi/.bashrc'
sudo bash -c 'echo "exec \$SCRIPT" >> /home/pi/.bashrc'
# create /home/pi/setup.sh - which will get executed after reboot by autologin pi user
cat > /home/pi/setup.sh <<EOF
# create /home/admin/setup.sh - which will get executed after reboot by autologin pi user
cat > /home/admin/setup.sh <<EOF
# make LCD screen rotation correct
sudo sed --in-place -i "57s/.*/dtoverlay=tft35a:rotate=270/" /boot/config.txt
EOF
sudo chmod +x /home/pi/setup.sh
sudo chmod +x /home/admin/setup.sh
echo ""
echo "*** HARDENING ***"

36
home.admin/_bootstrap.sh

@ -17,42 +17,42 @@ date >> $logfile
echo "***********************************************" >> $logfile
################################
# HDD CHECK / INIT
# for the very first setup
################################
# check if the HDD is mounted
hddAvailable=$(ls -la /mnt/hdd 2>/dev/null)
if [ ${#hddAvailable} -eq 0 ]; then
echo "HDD is NOT available" >> $logfile
echo "TODO: Try to mount."
exit 1
fi
################################
# AFTER BOOT SCRIPT
# when a process needs to
# execute stuff after a reboot
# /home/admin/setup.sh
################################
# check for after boot script
afterSetupScriptExists=$(ls /home/pi/setup.sh 2>/dev/null | grep -c setup.sh)
afterSetupScriptExists=$(ls /home/admin/setup.sh 2>/dev/null | grep -c setup.sh)
if [ ${afterSetupScriptExists} -eq 1 ]; then
echo "*** SETUP SCRIPT DETECTED ***"
# echo out script to journal logs
sudo cat /home/pi/setup.sh
sudo cat /home/admin/setup.sh
# execute the after boot script
sudo /home/pi/setup.sh
sudo /home/admin/setup.sh
# delete the after boot script
sudo rm /home/pi/setup.sh
sudo rm /home/admin/setup.sh
# reboot again
echo "DONE wait 6 secs ... one more reboot needed ... "
sudo shutdown -r now
sleep 100
fi
################################
# HDD CHECK / INIT
# for the very first setup
################################
# check if the HDD is mounted
hddAvailable=$(ls -la /mnt/hdd 2>/dev/null)
if [ ${#hddAvailable} -eq 0 ]; then
echo "HDD is NOT available" >> $logfile
echo "TODO: Try to mount."
exit 1
fi
################################
# CONFIGFILE BASICS
################################

Loading…
Cancel
Save