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 () {
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
}

View file

@ -33,7 +33,7 @@ DO NOT use any of the files from $SCRIPTDIR/config !
}
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
}

View file

@ -58,7 +58,7 @@ USB_CTL_ID=()
}
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"
}

View file

@ -61,7 +61,7 @@ echo 0 | sudo tee $VBIOS_PATH
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"
}

View file

@ -31,7 +31,7 @@ Press q to quit
}
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
}

View file

@ -39,7 +39,7 @@ To return to the previous page just press ENTER.
}
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
}

View file

@ -170,7 +170,8 @@ function set_CMDLINE () {
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
}

View file

@ -59,7 +59,7 @@ function set_INITRAMFSTOOLS () {
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"
}

View file

@ -29,7 +29,7 @@ softdep radeon pre: vfio vfio_pci
}
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"
}

View file

@ -37,7 +37,7 @@ will make it easier to successfully do the passthrough without issues."
}
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"
}

View file

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