change -eq 1 to -ne 0

To accept non-zero value
This commit is contained in:
Suikan 2021-07-03 08:19:00 +09:00
parent dc1e8ff720
commit b7738a9fd8
4 changed files with 10 additions and 10 deletions

View file

@ -44,7 +44,7 @@ export ISEFI=0 # No, BIOS
fi # is EFI firmaare? fi # is EFI firmaare?
# Set partition number based on the firmware type # Set partition number based on the firmware type
if [ ${ISEFI} -eq 1 ] ; then if [ ${ISEFI} -ne 0 ] ; then
# EFI firmware # EFI firmware
export EFIPARTITION=1 export EFIPARTITION=1
export CRYPTPARTITION=2 export CRYPTPARTITION=2

View file

@ -6,7 +6,7 @@
function confirmation_common(){ function confirmation_common(){
# Consistency check for the OVERWRITEINSTALL and ERASEALL # Consistency check for the OVERWRITEINSTALL and ERASEALL
if [ "${ERASEALL}" -eq 1 ] && [ "${OVERWRITEINSTALL}" -eq 1 ] ; then if [ "${ERASEALL}" -ne 0 ] && [ "${OVERWRITEINSTALL}" -ne 0 ] ; then
cat <<- HEREDOC cat <<- HEREDOC
***** ERROR : Confliction between ERASEALL and OVERWRITEINSTALL ***** ***** ERROR : Confliction between ERASEALL and OVERWRITEINSTALL *****
...ERASEALL = ${ERASEALL} ...ERASEALL = ${ERASEALL}
@ -71,7 +71,7 @@ function confirmation_common(){
fi # if YES fi # if YES
# For sure ask to be sure to erase. # For sure ask to be sure to erase.
if [ "${ERASEALL}" -eq 1 ] ; then if [ "${ERASEALL}" -ne 0 ] ; then
echo "Are you sure you want to erase entire ${DEV}? [Y/N]" echo "Are you sure you want to erase entire ${DEV}? [Y/N]"
read -r YESNO read -r YESNO
if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then if [ "${YESNO}" != "Y" ] && [ "${YESNO}" != "y" ] ; then

View file

@ -14,7 +14,7 @@ function para_install_msg_common() {
HEREDOC HEREDOC
# In the EFI system, add this mapping # In the EFI system, add this mapping
if [ "${ISEFI}" -eq 1 ] ; then if [ "${ISEFI}" -ne 0 ] ; then
echo "/boot/efi : ${DEV}${EFIPARTITION}" echo "/boot/efi : ${DEV}${EFIPARTITION}"
fi fi
@ -22,7 +22,7 @@ function para_install_msg_common() {
echo "/ : /dev/mapper/${VGNAME}-${LVROOTNAME}" echo "/ : /dev/mapper/${VGNAME}-${LVROOTNAME}"
# In case of erased storage, add this mapping # In case of erased storage, add this mapping
if [ "${ERASEALL}" -eq 1 ] ; then if [ "${ERASEALL}" -ne 0 ] ; then
echo "swap : /dev/mapper/${VGNAME}-${LVSWAPNAME}" echo "swap : /dev/mapper/${VGNAME}-${LVSWAPNAME}"
fi fi

View file

@ -7,10 +7,10 @@ function pre_install_common() {
# ----- Erase entire disk, create partitions, format them and encrypt the LUKS partition ----- # ----- Erase entire disk, create partitions, format them and encrypt the LUKS partition -----
if [ "${ERASEALL}" -eq 1 ] ; then if [ "${ERASEALL}" -ne 0 ] ; then
# Assign specified space and rest of disk to the EFI and LUKS partition, respectively. # Assign specified space and rest of disk to the EFI and LUKS partition, respectively.
if [ "${ISEFI}" -eq 1 ] ; then if [ "${ISEFI}" -ne 0 ] ; then # EFI
# Zap existing partition table and create new GPT # Zap existing partition table and create new GPT
echo "...Initializing \"${DEV}\" with GPT." echo "...Initializing \"${DEV}\" with GPT."
sgdisk --zap-all "${DEV}" sgdisk --zap-all "${DEV}"
@ -24,7 +24,7 @@ function pre_install_common() {
sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}" sgdisk --new="${CRYPTPARTITION}":0:0 --change-name="${CRYPTPARTITION}":"Linux LUKS" --typecode="${CRYPTPARTITION}":8309 "${DEV}"
# Then print them # Then print them
sgdisk --print "${DEV}" sgdisk --print "${DEV}"
else else # BIOS
# Zap existing partition table # Zap existing partition table
echo "...Erasing partition table of \"${DEV}\"." echo "...Erasing partition table of \"${DEV}\"."
dd if=/dev/zero of="${DEV}" bs=512 count=1 dd if=/dev/zero of="${DEV}" bs=512 count=1
@ -80,7 +80,7 @@ function pre_install_common() {
# Create a ROOT Logical Volume on VG. # Create a ROOT Logical Volume on VG.
if [ -e /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" ] ; then # exist if [ -e /dev/mapper/"${VGNAME}"-"${LVROOTNAME}" ] ; then # exist
if [ "${OVERWRITEINSTALL}" -eq 1 ] ; then # exist and overwrite install if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then # exist and overwrite install
echo "...Logical volume \"${VGNAME}-${LVROOTNAME}\" already exists. OK." echo "...Logical volume \"${VGNAME}-${LVROOTNAME}\" already exists. OK."
else # exist and not overwriteinstall else # exist and not overwriteinstall
cat <<- HEREDOC cat <<- HEREDOC
@ -98,7 +98,7 @@ function pre_install_common() {
return 1 # with error status return 1 # with error status
fi fi
else # not exsit else # not exsit
if [ "${OVERWRITEINSTALL}" -eq 1 ] ; then if [ "${OVERWRITEINSTALL}" -ne 0 ] ; then
cat <<- HEREDOC cat <<- HEREDOC
***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" doesn't exist while overwrite install. ***** ***** ERROR : Logical volume "${VGNAME}-${LVROOTNAME}" doesn't exist while overwrite install. *****
...Check consistency of your config.txt. ...Check consistency of your config.txt.