From bce4edd4f7bdad759fae70f3c49eb41ce7ab6494 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Mon, 14 Oct 2024 18:38:48 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BD=20=D1=84=D0=BB?= =?UTF-8?q?=D0=B0=D0=B3=20-p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/install.sh b/install.sh index 4062d60..43df972 100755 --- a/install.sh +++ b/install.sh @@ -35,10 +35,6 @@ main () { -e|--efi) GFU_EFI_MODE=true ;; - -p|--path) - GFU_MOUNT_PATH="${2}" - shift - ;; *) break ;; @@ -50,6 +46,7 @@ main () { local GFU_GRUB_EFI_X32="i386-efi" local GFU_GRUB_EFI_X64="x86_64-efi" local GFU_GRUB_LEGACY="i386-pc" + local GFU_MOUNT_PATH=`$(mktemp -d)` GFU_DEVICE=${GFU_DEVICE:-$ENV_GFU_DEVICE} [ -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 "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 local GFU_GRUB_LEGACY_MODE_PATH="${GFU_GRUB_PATH}/${GFU_GRUB_LEGACY}" 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 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 read -p "All data will be deleted from your device ${GFU_DEVICE}. Are you ready to continue? [Y/N]: " answer case "$answer" in @@ -143,6 +126,8 @@ main () { fi umount -v ${GFU_DEVICE}1 + + rm -rf ${GFU_MOUNT_PATH} } main "${@}"