убран флаг -p

This commit is contained in:
Alexander Zhirov 2024-10-14 18:38:48 +03:00
parent 1e715b654c
commit bce4edd4f7
1 changed files with 3 additions and 18 deletions

View File

@ -35,10 +35,6 @@ main () {
-e|--efi) -e|--efi)
GFU_EFI_MODE=true GFU_EFI_MODE=true
;; ;;
-p|--path)
GFU_MOUNT_PATH="${2}"
shift
;;
*) *)
break break
;; ;;
@ -50,6 +46,7 @@ main () {
local GFU_GRUB_EFI_X32="i386-efi" local GFU_GRUB_EFI_X32="i386-efi"
local GFU_GRUB_EFI_X64="x86_64-efi" local GFU_GRUB_EFI_X64="x86_64-efi"
local GFU_GRUB_LEGACY="i386-pc" local GFU_GRUB_LEGACY="i386-pc"
local GFU_MOUNT_PATH=`$(mktemp -d)`
GFU_DEVICE=${GFU_DEVICE:-$ENV_GFU_DEVICE} GFU_DEVICE=${GFU_DEVICE:-$ENV_GFU_DEVICE}
[ -z "${GFU_DEVICE}" ] && echo "ENV_GFU_DEVICE: The device was not set" && exit 1 [ -z "${GFU_DEVICE}" ] && echo "ENV_GFU_DEVICE: The device was not set" && exit 1
@ -58,10 +55,6 @@ main () {
${GFU_LEGACY_MODE} && ${GFU_EFI_MODE} && echo "You only need to set one mode: legacy or efi" && exit 1 ${GFU_LEGACY_MODE} && ${GFU_EFI_MODE} && echo "You only need to set one mode: legacy or efi" && exit 1
! ${GFU_LEGACY_MODE} && ! ${GFU_EFI_MODE} && echo "None of the modes are set: legacy or efi" && exit 1 ! ${GFU_LEGACY_MODE} && ! ${GFU_EFI_MODE} && echo "None of the modes are set: legacy or efi" && exit 1
GFU_MOUNT_PATH=${GFU_MOUNT_PATH:-$ENV_GFU_MOUNT_PATH}
[ -z "${GFU_MOUNT_PATH}" ] && echo "ENV_GFU_MOUNT_PATH: The path to the mount directory was not set" && exit 1
GFU_MOUNT_PATH=$(realpath ${GFU_MOUNT_PATH} 2>/dev/null)
if ${GFU_LEGACY_MODE} ; then if ${GFU_LEGACY_MODE} ; then
local GFU_GRUB_LEGACY_MODE_PATH="${GFU_GRUB_PATH}/${GFU_GRUB_LEGACY}" local GFU_GRUB_LEGACY_MODE_PATH="${GFU_GRUB_PATH}/${GFU_GRUB_LEGACY}"
local GFU_GRUB_LEGACY_MODE=false local GFU_GRUB_LEGACY_MODE=false
@ -83,16 +76,6 @@ main () {
! ${GFU_GRUB_EFI_MODE_X32} && ! ${GFU_GRUB_EFI_MODE_X64} && echo "No EFI bootloader was found for installation: ${GFU_GRUB_EFI_X32} or ${GFU_GRUB_EFI_X64}" && exit 1 ! ${GFU_GRUB_EFI_MODE_X32} && ! ${GFU_GRUB_EFI_MODE_X64} && echo "No EFI bootloader was found for installation: ${GFU_GRUB_EFI_X32} or ${GFU_GRUB_EFI_X64}" && exit 1
fi fi
if [ ! -d ${GFU_MOUNT_PATH} ] ; then
echo "Path is not a directory: ${GFU_MOUNT_PATH}"
exit 1
fi
if [ ! -z "$(ls -A ${GFU_MOUNT_PATH})" ]; then
echo "Path is not empty: ${GFU_MOUNT_PATH}"
exit 1
fi
while true; do while true; do
read -p "All data will be deleted from your device ${GFU_DEVICE}. Are you ready to continue? [Y/N]: " answer read -p "All data will be deleted from your device ${GFU_DEVICE}. Are you ready to continue? [Y/N]: " answer
case "$answer" in case "$answer" in
@ -143,6 +126,8 @@ main () {
fi fi
umount -v ${GFU_DEVICE}1 umount -v ${GFU_DEVICE}1
rm -rf ${GFU_MOUNT_PATH}
} }
main "${@}" main "${@}"