@@ -237,16 +237,7 @@ install() {
237237 rm $INSTALL_MOUNT /etc/fstab
238238 echo " ${ROOT_PARTITION} / ext4 defaults,noatime 0 1" > $INSTALL_MOUNT /etc/fstab
239239
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
250241
251242 # final setup:
252243 dmesg -D
@@ -267,15 +258,7 @@ install() {
267258 cryptsetup luksClose luksroot
268259 fi
269260 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
279262}
280263
281264# Setup partition map on internal emmc
@@ -360,22 +343,14 @@ expand() {
360343 # Force the filesystem to fill the new partition
361344 resize2fs -f ${BOOT_DEVICE} 2
362345 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
373346
347+ install_packages
374348 dmesg -D
375349 welcome
376350 setup_users
377351 setup_hostname
378352 dmesg -E
353+ reboot_prompt
379354}
380355
381356# helper for install_packages()/setup_users()
@@ -400,9 +375,33 @@ chroot_wrapper() {
400375
401376install_packages () {
402377 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
406405}
407406
408407setup_hostname () {
@@ -470,6 +469,17 @@ setup_users() {
470469 fi
471470}
472471
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+ }
473483
474484welcome () {
475485 echo " "
0 commit comments