fix errors

This commit is contained in:
Alexander Zhirov 2024-10-14 15:23:10 +03:00
parent e4fe19450b
commit f9e5de3364
1 changed files with 16 additions and 1 deletions

View File

@ -2,10 +2,18 @@
[ ${GFU_DEBUG} ] && set -x [ ${GFU_DEBUG} ] && set -x
# set -x
SCRIPT_NAME="${0}" SCRIPT_NAME="${0}"
SCRIPT_PATH=$(realpath ${SCRIPT_NAME}) SCRIPT_PATH=$(realpath ${SCRIPT_NAME})
# [ ! "$(id -u)" == 0 ] && echo "Need to run as superuser" && exit 1 GFU_PARTED=$(which parted 2>/dev/null)
GFU_GRUB=$(which grub-install 2>/dev/null)
[ -z "${GFU_PARTED}" ] && echo "The parted utility is not installed" && exit 1
[ -z "${GFU_GRUB}" ] && echo "The grub-install utility is not installed" && exit 1
[ ! "$(id -u)" == 0 ] && echo "Need to run as superuser" && exit 1
main () { main () {
local GFU_KEY="" local GFU_KEY=""
@ -96,6 +104,13 @@ main () {
esac esac
done done
for partition in $(mount | grep "${GFU_DEVICE}[0-9]" | awk '{print $1}') ; do
if ! umount -f ${partition} ; then
echo "Failed to unmount ${partition}"
exit 1
fi
done
if ${GFU_LEGACY_MODE} ; then if ${GFU_LEGACY_MODE} ; then
parted ${GFU_DEVICE} -s mklabel msdos parted ${GFU_DEVICE} -s mklabel msdos
else else