use realpath with dirname to get the scriptdir

This commit is contained in:
HikariKnight 2022-03-12 15:28:44 +01:00
parent cd7b7a989a
commit 4fc07b97f2
No known key found for this signature in database
GPG key ID: E8B239063B022F5A
11 changed files with 12 additions and 11 deletions

View file

@ -74,7 +74,7 @@ to build your new initrd image (all of this will require sudo permissions!)"
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
apply_CHANGES apply_CHANGES
} }

View file

@ -33,7 +33,7 @@ DO NOT use any of the files from $SCRIPTDIR/config !
} }
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
get_GPU get_GPU
} }

View file

@ -58,7 +58,7 @@ USB_CTL_ID=()
} }
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
get_GROUP "$1" get_GROUP "$1"
} }

View file

@ -61,7 +61,7 @@ echo 0 | sudo tee $VBIOS_PATH
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
get_GPU_ROM "$1" get_GPU_ROM "$1"
} }

View file

@ -31,7 +31,7 @@ Press q to quit
} }
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
get_USB_CTL get_USB_CTL
} }

View file

@ -39,7 +39,7 @@ To return to the previous page just press ENTER.
} }
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
get_USB_CTL_GROUP $1 get_USB_CTL_GROUP $1
} }

View file

@ -170,7 +170,8 @@ function set_CMDLINE () {
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
set_CMDLINE set_CMDLINE
} }

View file

@ -59,7 +59,7 @@ function set_INITRAMFSTOOLS () {
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
set_INITRAMFSTOOLS "$1" set_INITRAMFSTOOLS "$1"
} }

View file

@ -29,7 +29,7 @@ softdep radeon pre: vfio vfio_pci
} }
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
set_MODPROBE "$1" set_MODPROBE "$1"
} }

View file

@ -37,7 +37,7 @@ will make it easier to successfully do the passthrough without issues."
} }
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(realpath $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
set_VFIO "$1" set_VFIO "$1"
} }

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Get the scripts directory # Get the scripts directory
SCRIPTDIR=$(dirname "$(which $0)") SCRIPTDIR=$(dirname "$(realpath "$0")")
cd "$SCRIPTDIR" cd "$SCRIPTDIR"
# Get the config paths # Get the config paths