@@ -237,16 +237,7 @@ install() {
237
237
rm $INSTALL_MOUNT /etc/fstab
238
238
echo " ${ROOT_PARTITION} / ext4 defaults,noatime 0 1" > $INSTALL_MOUNT /etc/fstab
239
239
240
- while true ; do
241
- dmesg -D
242
- read -r -p " Install a desktop environment and the supporting packages? [Y/n]" ins
243
- dmesg -E
244
- case $ins in
245
- [Yy]* ) install_packages $INSTALL_MOUNT ; break ;;
246
- [Nn]* ) break ;;
247
- * ) echo " Please answer y or n" ;;
248
- esac
249
- done
240
+ install_packages $INSTALL_MOUNT
250
241
251
242
# final setup:
252
243
dmesg -D
@@ -267,15 +258,7 @@ install() {
267
258
cryptsetup luksClose luksroot
268
259
fi
269
260
echo " Please remove the booted device after power off is complete"
270
- while true ; do
271
- read -r -p " Reboot? [y/N]" re
272
- case $re in
273
- [Yy]* ) reboot;;
274
- [Nn]* ) exit ;;
275
- * ) echo " Please answer y or n" ;;
276
- esac
277
- done
278
-
261
+ reboot_prompt
279
262
}
280
263
281
264
# Setup partition map on internal emmc
@@ -360,22 +343,14 @@ expand() {
360
343
# Force the filesystem to fill the new partition
361
344
resize2fs -f ${BOOT_DEVICE} 2
362
345
echo " /dev/${BOOT_DEVICE} 2 / ext4 defaults,noatime 0 1" > /etc/fstab
363
- while true ; do
364
- dmesg -D
365
- read -r -p " Install a desktop environment and the supporting packages? [Y/n]" ins
366
- dmesg -E
367
- case $ins in
368
- [Yy]* ) $SCRIPTS /InstallPackages.sh; break ;;
369
- [Nn]* ) break ;;
370
- * ) echo " Please answer y or n" ;;
371
- esac
372
- done
373
346
347
+ install_packages
374
348
dmesg -D
375
349
welcome
376
350
setup_users
377
351
setup_hostname
378
352
dmesg -E
353
+ reboot_prompt
379
354
}
380
355
381
356
# helper for install_packages()/setup_users()
@@ -400,9 +375,33 @@ chroot_wrapper() {
400
375
401
376
install_packages () {
402
377
TARGET_MOUNT=$1
403
- echo " Installing Packages"
404
- chroot_wrapper " $TARGET_MOUNT " .$SCRIPTS /InstallPackages.sh
405
- desktop=true
378
+
379
+ # handle when we use this for expansion
380
+ if [ -z " $TARGET_MOUNT " ]
381
+ then
382
+ CHROOT_PREFIX=" "
383
+
384
+ else
385
+ CHROOT_PREFIX=" chroot_wrapper ${TARGET_MOUNT} "
386
+ fi
387
+
388
+ while true ; do
389
+ dmesg -D
390
+ read -r -p " Install a desktop environment and the supporting packages? [Y/n]" ins
391
+ dmesg -E
392
+ case $ins in
393
+ [Yy]* )
394
+ echo " Installing Packages"
395
+ $CHROOT_PREFIX .$SCRIPTS /InstallPackages.sh
396
+ desktop=true
397
+ break
398
+ ;;
399
+ [Nn]* )
400
+ break
401
+ ;;
402
+ * ) echo " Please answer y or n" ;;
403
+ esac
404
+ done
406
405
}
407
406
408
407
setup_hostname () {
@@ -470,6 +469,17 @@ setup_users() {
470
469
fi
471
470
}
472
471
472
+ reboot_prompt () {
473
+ while true ; do
474
+ read -r -p " Reboot? [y/N]" re
475
+ case $re in
476
+ [Yy]* ) reboot;;
477
+ [Nn]* ) exit ;;
478
+ * ) echo " Please answer y or n" ;;
479
+ esac
480
+ done
481
+
482
+ }
473
483
474
484
welcome () {
475
485
echo " "
0 commit comments