1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 01:50:46 +00:00

Meta: Remove hardcoded resize2fs executable path

Let which find the resize2fs executable path for us, and use `/usr/sbin`
as a default.
This commit is contained in:
Lucas CHOLLET 2022-04-24 21:41:14 +02:00 committed by Linus Groh
parent 21671d9b91
commit c2d999eb52

View File

@ -2,11 +2,16 @@
# Note: This is done before `set -e` to let `command` fail if needed
FUSE2FS_PATH=$(command -v fuse2fs)
RESIZE2FS_PATH=$(command -v resize2fs)
if [ -z "$FUSE2FS_PATH" ]; then
FUSE2FS_PATH=/usr/sbin/fuse2fs
fi
if [ -z "$RESIZE2FS_PATH" ]; then
RESIZE2FS_PATH=/usr/sbin/resize2fs
fi
set -e
die() {
@ -113,7 +118,7 @@ if [ $USE_EXISTING -eq 1 ]; then
if [ "$DISK_SIZE_BYTES" -gt "$OLD_DISK_SIZE_BYTES" ]; then
echo "resizing disk image..."
qemu-img resize -f raw _disk_image "$DISK_SIZE_BYTES" || die "could not resize disk image"
if ! resize2fs _disk_image; then
if ! "$RESIZE2FS_PATH" _disk_image; then
rm -f _disk_image
USE_EXISTING=0
echo "failed, not using existing image"