From 2fb0ed4bd94b05d53df46aaf2c71d9bde03634c5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 24 Nov 2015 15:47:24 +0000 Subject: [PATCH] Check if installation was started before deleting initial files --- src/freedombone-image-customise | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 24f41a5a..3c011d6b 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -226,27 +226,26 @@ EOF echo ' else' >> $rootdir/root/.bashrc echo ' ENTROPY=$(cat /proc/sys/kernel/random/entropy_avail)' >> $rootdir/root/.bashrc echo ' if [ $ENTROPY -lt 500 ]; then' >> $rootdir/root/.bashrc - echo ' echo "WARNING: The entropy available on this system is too low to generate a password"' >> $rootdir/root/.bashrc - echo ' exit 5763' >> $rootdir/root/.bashrc + echo ' dialog --backtitle "Freedombone initial setup process" --title "Password Generation" --msgbox "WARNING: The entropy available on this system is too low to generate a password.\n\nThe installation process cannot continue." 8 50' >> $rootdir/root/.bashrc + echo ' exit' >> $rootdir/root/.bashrc echo ' fi' >> $rootdir/root/.bashrc echo ' NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc echo ' fi' >> $rootdir/root/.bashrc echo ' echo "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc echo ' dialog --backtitle "Freedombone initial setup process" --title "New Password" --msgbox "This is your new password. Use it whenever you wish to ssh into this system.\n\n $NEW_USER_PASSWORD\n\nPlease take a moment to copy the above password into a password manager or write it down somewhere." 12 50' >> $rootdir/root/.bashrc - - cat >> $rootdir/root/.bashrc <> $rootdir/root/.bashrc # change the password for the admin user - echo -n " echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc + echo -n " echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc echo '$(printf `cat ~/login.txt`)"|chpasswd' >> $rootdir/root/.bashrc + echo ' freedombone menuconfig' >> $rootdir/root/.bashrc + echo ' if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc + echo ' if [ -f ~/freedombone-completed.txt ]; then' >> $rootdir/root/.bashrc # Remove the initial setup files - echo " rm /root/.initial_setup" >> $rootdir/root/.bashrc - echo " rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc - echo " shred -zu ~/login.txt" >> $rootdir/root/.bashrc + echo " rm /root/.initial_setup" >> $rootdir/root/.bashrc + echo " rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc + echo " shred -zu ~/login.txt" >> $rootdir/root/.bashrc cat >> $rootdir/root/.bashrc <