diff --git a/bootstrap.sh b/bootstrap.sh index 8e0f795..72c2cae 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,11 +6,17 @@ do case $opt in n) NAME=${OPTARG} ;; d) DEV=${OPTARG} ;; e) ENC=${OPTARG} ;; + s) SWAP_SIZE=${OPTARG} ;; \?) echo "-$OPTARG is not valid" >&2 && exit ;; esac done init() { + echo "" + echo "+---------------------------+" + echo "| Just Some Short Questions |" + echo "+---------------------------+" + echo "" [ -z "$NAME" ] && read -p "Hostname: " NAME while [ -z "$PASSWD" ] || [ ! "$PASSWD" = "$CHECK" ]; do read -sp "Root password: " PASSWD @@ -21,6 +27,7 @@ init() { [ -z "$DEV" ] && lsblk -nrpo "name,size,model" && read -p "Provide installation medium (e.g. sda, nvme0n1): " DEV [[ "$DEV" =~ sd[a-z] ]] && SUF="1-3" && MODE="SATA" [[ "$DEV" =~ nvme[0-9]n[0-9] ]] && SUF="p1-3" && MODE="NVME" + [ -z "$SWAP_SIZE" ] && read -p "Specify the size for the SWAP partition (16G, 1M, ...): " SWAP_SIZE [ -z "$ENC" ] && read -p "Do you want the root partition to be encrypted (y/n)? " ENC [ "$ENC" == "y" ] && ENC=true || ENC=false @@ -30,6 +37,7 @@ init() { echo "HOSTNAME = $NAME" echo "ROOTPASSWD = ${PASSWD:0:1}***${PASSWD: -1}" echo "DEVICEPARTS = $DEV$SUF" + echo "SWAP_SIZE = $SWAP_SIZE" echo "ENCRYPTION = $ENC" read -p "Do you want to continue with these values (y/n)? " cont [ ! "$cont" = "y" ] && unset NAME PASSWD DEV ENC && init @@ -70,7 +78,7 @@ ef00 n -+16G ++${SWAP_SIZE} 8200 n