From f79f40ab4cfe420e07029c4e58d048862af9a48b Mon Sep 17 00:00:00 2001 From: rootzoll Date: Mon, 6 Aug 2018 21:20:47 +0200 Subject: [PATCH] after setup process --- build.sdcard/raspbianStretchDesktop.sh | 18 ++++++++++++------ home.admin/00infoLCD.sh | 11 ++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/build.sdcard/raspbianStretchDesktop.sh b/build.sdcard/raspbianStretchDesktop.sh index 6c5684223..c4eb9899e 100644 --- a/build.sdcard/raspbianStretchDesktop.sh +++ b/build.sdcard/raspbianStretchDesktop.sh @@ -24,7 +24,7 @@ echo "pi:raspiblitz" | sudo chpasswd # set Raspi to boot up automatically with user pi (for the LCD) # https://www.raspberrypi.org/forums/viewtopic.php?t=21632 -# sudo raspi-config nonint do_boot_behaviour B2 +sudo raspi-config nonint do_boot_behaviour B2 sudo bash -c "echo '[Service]' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf" sudo bash -c "echo 'ExecStart=' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf" sudo bash -c "echo 'ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux' >> /etc/systemd/system/getty@tty1.service.d/autologin.conf" @@ -309,9 +309,16 @@ sudo bash -c "echo './00mainMenu.sh' >> /home/admin/.bashrc" sudo bash -c "echo '# automatic start the LCD info loop' >> /home/pi/.bashrc" sudo bash -c "echo '/home/admin/00infoLCD.sh' >> /home/pi/.bashrc" -# on root login - make some finale setup configs -sudo bash -c "echo '# make LCD screen rotation correct" -sudo bash -c 'echo "sudo sed --in-place -i \"57s/.*/dtoverlay=tft35a:rotate=270/\" /boot/config.txt" >> /home/admin/.bashrc' +# create /home/pi/setup.sh - which will get executed after reboot by autologin pi user +afterSetupScript='' read -r -d '' String <<"EOF" + +# make LCD screen rotation correct +sudo sed --in-place -i "57s/.*/dtoverlay=tft35a:rotate=270/" /boot/config.txt + +EOF +echo '${afterSetupScript}' > /home/pi/setup.sh +sudo shmod +x /home/pi/setup.sh + # *** RASPIBLITZ IMAGE READY *** echo "" @@ -324,8 +331,7 @@ echo "Last step is to install LCD drivers. This will reboot your Pi when done." echo "" echo "Maybe take the chance and look thru the output above if you can spot any errror." echo "" -echo "After reboot - please LOGIN ONCE as ROOT:" -echo "ssh root@[IP-OF-PI] --> with password 'raspiblitz'" +echo "After final reboot - your SD Card Image is ready." echo "Press ENTER to install LCD and reboot ..." read key diff --git a/home.admin/00infoLCD.sh b/home.admin/00infoLCD.sh index b5daa34f2..fa365fdc6 100755 --- a/home.admin/00infoLCD.sh +++ b/home.admin/00infoLCD.sh @@ -1,6 +1,15 @@ #!/bin/sh if [ "$USER" = "pi" ]; then + # check for after setup script + afterSetupScriptExists=$(ls /home/pi/setup.sh 2>/dev/null | grep -c setup.sh) + if [ ${afterSetupScriptExists} -eq 1 ]; then + sudo /home/pi/setup.sh + sudo rm /home/pi/setup.sh + dialog --pause " ... one more reboot needed ... " 8 58 6 + sudo shutdown -r now + fi + # load network network=`sudo cat /home/admin/.network` @@ -22,7 +31,7 @@ if [ "$USER" = "pi" ]; then network=`sudo cat /home/admin/.network` # get the setup state - setupStepExists=$(sudo -u admin ls -la /home/admin/.setup | grep -c .setup) + setupStepExists=$(sudo -u admin ls -la /home/admin/.setup 2>/dev/null | grep -c .setup) if [ ${setupStepExists} -eq 1 ]; then setupStep=$(sudo -u admin cat /home/admin/.setup) else