diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-26 02:03:44 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2019-11-26 02:03:44 +0100 |
commit | c4b12967a298137b2559de238fd067ff163bb473 (patch) | |
tree | 992242fa1ae9c9d7f084d5b4c52432b3d8f6de39 /joes-arch-install-UEFI.sh | |
parent | Starting new bios partitioning (diff) | |
download | arch-installer-c4b12967a298137b2559de238fd067ff163bb473.tar.gz arch-installer-c4b12967a298137b2559de238fd067ff163bb473.tar.bz2 arch-installer-c4b12967a298137b2559de238fd067ff163bb473.tar.xz arch-installer-c4b12967a298137b2559de238fd067ff163bb473.tar.zst arch-installer-c4b12967a298137b2559de238fd067ff163bb473.zip |
Secured numeric inputs
Diffstat (limited to 'joes-arch-install-UEFI.sh')
-rwxr-xr-x | joes-arch-install-UEFI.sh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/joes-arch-install-UEFI.sh b/joes-arch-install-UEFI.sh index ead5df4..9f23b75 100755 --- a/joes-arch-install-UEFI.sh +++ b/joes-arch-install-UEFI.sh @@ -17,6 +17,7 @@ somemore=false intelamdcpu="none" intelamdgpu="none" ltskern=true +numregex='^[0-9]+$' if [ ! -r /sys/firmware/efi/efivars ]; then efimode=false else @@ -130,19 +131,16 @@ while [[ $answr != y && $answr != Y && $answr != yes && $answr != Yes && $answr done echo -n -e "${BYELLOW}> " read -r drvnm - if [[ $drvnm == "" ]]; then + if [ "$drvnm" = "" ]; then echo && echo echo -e "${BRED}Can't be empty, retrying...${END}" - fi - if [[ $drvnm -gt $(lsblk | grep -c disk) ]]; then + elif ! [[ $drvnm =~ $numregex ]]; then echo && echo echo -e "${BRED}Illegal value, please choose something reasonable. Retrying...${END}" - fi - if [[ $drvnm -lt 0 ]]; then + elif [ "$drvnm" -gt $(lsblk | grep -c disk) ]; then echo && echo echo -e "${BRED}Illegal value, please choose something reasonable. Retrying...${END}" - fi - if [[ $drvnm == 0 ]]; then + elif [ "$drvnm" -le 0 ]; then echo && echo echo -e "${BRED}Illegal value, please choose something reasonable. Retrying...${END}" fi @@ -167,6 +165,9 @@ __G" if [[ $swps == "" ]]; then echo && echo echo -e "${BRED}Can't be empty, retrying...${END}" + elif ! [[ $swps =~ $numregex ]]; then + echo && echo + echo -e "${BRED}Illegal value, please choose something reasonable. Retrying...${END}" fi done clear @@ -188,6 +189,9 @@ __G" if [[ $rts == "" ]]; then echo && echo echo -e "${BRED}Can't be empty, retrying...${END}" + elif ! [[ $swps =~ $numregex ]]; then + echo && echo + echo -e "${BRED}Illegal value, please choose something reasonable. Retrying...${END}" fi done btsze="128M" @@ -434,6 +438,8 @@ w FDISK_EFI_INPUT else fdisk "$drv" << FDISK_BIOS_INPUT +o +n FDISK_BIOS_INPUT fi |