diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2022-08-14 23:40:19 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2022-08-17 06:37:00 -0400 |
commit | a1fb7a16bcf0e6003aae7684cda4556ae45f829f (patch) | |
tree | 1486f90792063987dcefbf7f09fd99f42c7f7c4e | |
parent | 89bca32eedc989e09d3ff9754ae3dc856f6476c9 (diff) |
consolidate umount calls
-rwxr-xr-x | install.sh | 30 | ||||
-rw-r--r-- | session-common.sh.inc | 9 |
2 files changed, 15 insertions, 24 deletions
@@ -390,13 +390,6 @@ NoticePartition() WizardDlg "${TR[dlg_partition-${Lang}]}" --msgbox "${TR[notice_partition-${Lang}]}" 0 0 } -_UmountAll() -{ - umount /mnt/boot &> /dev/null || true - umount /mnt/home &> /dev/null || true - umount /mnt &> /dev/null || true -} - SelectPartition() { # checks to skip this stage per preset config @@ -410,8 +403,6 @@ SelectPartition() else return 0 fi - _UmountAll - # query disk device information PopulateDisksOptions # populates $DlgParams (( ${#DlgParams[@]} )) || ExitFail "${TR[device_none-${Lang}]}" @@ -470,8 +461,6 @@ _PartitionAuto() local swap_type_n=82 SetStateVar 'ROOT_PART' ${device}${root_part_n} - _UmountAll - # create partition table parted -s ${device} -- mklabel msdos @@ -496,8 +485,6 @@ _PartitionManual() # sanity checks AreConfiguredStateVars 'DEVICE' 'DEVICE_N' - _UmountAll - # manual partitioning local device=$(GetStateVar 'DEVICE') if [[ -n "${DISPLAY}" ]] && which gparted &> /dev/null ; then gparted ${device} ; @@ -560,9 +547,6 @@ Partition() local dlg_msg # format un-formatted partitions - umount /mnt/boot &> /dev/null || true - umount /mnt/home &> /dev/null || true - umount /mnt &> /dev/null || true for partition_role in ${!partitions[@]} do partition=${partitions[${partition_role}]} dlg_msg="${partition_role} partiion: ${partition} ${TR[format-${Lang}]}" @@ -641,14 +625,12 @@ NoticeDone() { WizardDlg "" --msgbox "${TR[notice_done-${Lang}]}" 0 0 ; } Cleanup() { # clean-up in-chroot config scripts and unmount partitions - rm /mnt/root/chroot-environment.sh &> /dev/null || true - rm /mnt/root/chroot-login.sh &> /dev/null || true - rm /mnt/root/chroot-services.sh &> /dev/null || true - rm /mnt/root/.session_state &> /dev/null || true - rm /mnt/root/session-common.sh.inc &> /dev/null || true - umount /mnt/boot &> /dev/null || true - umount /mnt/home &> /dev/null || true - umount /mnt &> /dev/null || true + rm /mnt/root/chroot-environment.sh &> /dev/null || true + rm /mnt/root/chroot-login.sh &> /dev/null || true + rm /mnt/root/chroot-services.sh &> /dev/null || true + rm /mnt/root/.session_state &> /dev/null || true + rm /mnt/root/session-common.sh.inc &> /dev/null || true + UnmountAll } diff --git a/session-common.sh.inc b/session-common.sh.inc index ab0420a..ae75bf8 100644 --- a/session-common.sh.inc +++ b/session-common.sh.inc @@ -230,6 +230,13 @@ readonly DISK_FIELD_SEP=':' declare -A PartsData # raw data declare -a DlgParams # dialog options +UnmountAll() +{ + umount /mnt/boot &> /dev/null || true + umount /mnt/home &> /dev/null || true + umount /mnt &> /dev/null || true +} + GetDisksPartsData() { local line @@ -285,6 +292,8 @@ GetDisksPartsData() # # TODO: filter out mounted filesystems + UnmountAll + parted --list --machine 2> /dev/null | tr -d '\r' | \ while read line do if [[ "$line" =~ ^BYT\;\ *$ ]] # device delimiter |