From 8a5143b79d8499e64813de45de5e4f3363b3cd25 Mon Sep 17 00:00:00 2001 From: Phillip Date: Sat, 7 Sep 2024 22:26:37 +0100 Subject: [PATCH] Improved handling --- scripts/0-install.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/0-install.sh b/scripts/0-install.sh index 6c68e32..9ad7daf 100644 --- a/scripts/0-install.sh +++ b/scripts/0-install.sh @@ -24,22 +24,25 @@ esac read -p "Do you wish to set a home partition? " yesno case $yesno in [yesYesYy]* ) - read -p 'Please enter the drive value for the home partition, this partition will be wiped: ' homepar - read -p 'Do you wish to wipe the home partition? ' wipeyesno - case $wipeyesno in - [yesYesYy]* ) - mkfs.ext4 /dev/$homepar - ;; - [noNoNn]* ) - echo "The home partition will not be wiped" - ;; - * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; - esac + read -p 'Please enter the drive value for the home partition: ' homepar [noNoNn]* ) echo "A home partition will not be used in this installation" ;; * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; esac +# Ask if a home partition should be wiped +if test -z "$homepar"; then +read -p 'Do you wish to wipe the home partition? ' wipeyesno +case $wipeyesno in + [yesYesYy]* ) + mkfs.ext4 /dev/$homepar + ;; + [noNoNn]* ) + echo "The home partition will not be wiped" + ;; + * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; +esac +fi # Get user credentials read -p "Please enter a username " username read -rsp "Please enter a password " password