diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2022-01-31 12:42:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-01 10:20:54 +0100 |
commit | daec52101064a41edf5191e6b97c933e26c3cc02 (patch) | |
tree | 0bbf5fe80020d5094e9498f2c2a26383395c3a48 /Meta/build-image-qemu.sh | |
parent | 13f92627b27a231bae1ce3fef3a7beb64eb33eca (diff) | |
download | serenity-daec52101064a41edf5191e6b97c933e26c3cc02.zip |
Build: Remove hardcoded executable path
Let which find the fuse2fs executable path for us, as it is not in
`/usr/sbin` in every distro.
Diffstat (limited to 'Meta/build-image-qemu.sh')
-rwxr-xr-x | Meta/build-image-qemu.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Meta/build-image-qemu.sh b/Meta/build-image-qemu.sh index a4e369cf97..bbbb65093c 100755 --- a/Meta/build-image-qemu.sh +++ b/Meta/build-image-qemu.sh @@ -1,5 +1,12 @@ #!/bin/sh +# Note: This is done before `set -e` to let `command` fail if needed +FUSE2FS_PATH=$(command -v fuse2fs) + +if [ -z "$FUSE2FS_PATH" ]; then + FUSE2FS_PATH=/usr/sbin/fuse2fs +fi + set -e die() { @@ -10,7 +17,7 @@ die() { USE_FUSE2FS=0 if [ "$(id -u)" != 0 ]; then - if [ -x /usr/sbin/fuse2fs ] && /usr/sbin/fuse2fs --help 2>&1 |grep fakeroot > /dev/null; then + if [ -x "$FUSE2FS_PATH" ] && $FUSE2FS_PATH --help 2>&1 |grep fakeroot > /dev/null; then USE_FUSE2FS=1 else sudo -E -- "$0" "$@" || die "this script needs to run as root" @@ -123,7 +130,7 @@ printf "mounting filesystem... " mkdir -p mnt use_genext2fs=0 if [ $USE_FUSE2FS -eq 1 ]; then - mount_cmd="/usr/sbin/fuse2fs _disk_image mnt/ -o fakeroot,rw" + mount_cmd="$FUSE2FS_PATH _disk_image mnt/ -o fakeroot,rw" elif [ "$(uname -s)" = "Darwin" ]; then mount_cmd="fuse-ext2 _disk_image mnt -o rw+,allow_other,uid=501,gid=20" elif [ "$(uname -s)" = "OpenBSD" ]; then |