瀏覽代碼

Check if installation was started before deleting initial files

Bob Mottram 9 年之前
父節點
當前提交
2fb0ed4bd9
共有 1 個文件被更改,包括 10 次插入11 次删除
  1. 10
    11
      src/freedombone-image-customise

+ 10
- 11
src/freedombone-image-customise 查看文件

@@ -226,27 +226,26 @@ EOF
226 226
     echo '    else' >> $rootdir/root/.bashrc
227 227
     echo '        ENTROPY=$(cat /proc/sys/kernel/random/entropy_avail)' >> $rootdir/root/.bashrc
228 228
     echo '        if [ $ENTROPY -lt 500 ]; then' >> $rootdir/root/.bashrc
229
-    echo '            echo "WARNING: The entropy available on this system is too low to generate a password"' >> $rootdir/root/.bashrc
230
-    echo '            exit 5763' >> $rootdir/root/.bashrc
229
+    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
230
+    echo '            exit' >> $rootdir/root/.bashrc
231 231
     echo '        fi' >> $rootdir/root/.bashrc
232 232
     echo '        NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"' >> $rootdir/root/.bashrc
233 233
     echo '    fi' >> $rootdir/root/.bashrc
234 234
     echo '    echo "${NEW_USER_PASSWORD}" > ~/login.txt' >> $rootdir/root/.bashrc
235 235
     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
236
-	
237
-    cat >> $rootdir/root/.bashrc <<EOF
238
-    freedombone menuconfig
239
-EOF
240
-    echo '    if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
241 236
     # change the password for the admin user
242
-    echo -n "        echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc
237
+    echo -n "    echo \"${MY_USERNAME}:" >> $rootdir/root/.bashrc
243 238
     echo '$(printf `cat ~/login.txt`)"|chpasswd' >> $rootdir/root/.bashrc
244 239
 
240
+    echo '    freedombone menuconfig' >> $rootdir/root/.bashrc  
241
+    echo '    if [ "$?" = "0" ]; then' >> $rootdir/root/.bashrc
242
+    echo '        if [ -f ~/freedombone-completed.txt ]; then' >> $rootdir/root/.bashrc
245 243
     # Remove the initial setup files
246
-    echo "        rm /root/.initial_setup" >> $rootdir/root/.bashrc
247
-    echo "        rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc
248
-    echo "        shred -zu ~/login.txt" >> $rootdir/root/.bashrc
244
+    echo "            rm /root/.initial_setup" >> $rootdir/root/.bashrc
245
+    echo "            rm /home/${MY_USERNAME}/.initial_setup" >> $rootdir/root/.bashrc
246
+    echo "            shred -zu ~/login.txt" >> $rootdir/root/.bashrc
249 247
     cat >> $rootdir/root/.bashrc <<EOF
248
+        fi
250 249
     fi
251 250
     exit
252 251
 fi