feat: specify swap

master
phga 3 years ago
parent de785c5d5f
commit 9985ff9c15
Signed by: phga
GPG Key ID: 5249548AA705F019

@ -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

Loading…
Cancel
Save