From 618f507a0a3d19968385d643531ebc128a1fae26 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Sat, 5 May 2018 02:33:06 +0300 Subject: [PATCH] Handle relative paths before running pkexec Fixes #1 --- windows2usb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/windows2usb b/windows2usb index ab058b1..dd6b20d 100755 --- a/windows2usb +++ b/windows2usb @@ -226,12 +226,16 @@ else if [[ "$APPIMAGE" ]]; then scriptpath="$APPIMAGE" - fi; + fi + + [ -f "$1" ] && PARAM1="$(readlink -f -- "$1")" || PARAM1="$1" + [ -f "$2" ] && PARAM2="$(readlink -f -- "$2")" || PARAM2="$2" + shift; shift; privescs=(pkexec sudo) for privesc in ${privescs[*]}; do if command -v "$privesc" > /dev/null; then - "$privesc" "$scriptpath" "$@" + "$privesc" "$scriptpath" "$PARAM1" "$PARAM2" "$@" exit fi done