From 99677b28101421f5e47eef9a2364b1f27401d359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20V=C3=A4th?= Date: Wed, 10 Mar 2021 19:15:17 +0100 Subject: [PATCH] Make options -M and -2 work --- AUTHORS | 1 + ChangeLog | 9 +++++++++ sbin/zram-init.in | 12 ++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/AUTHORS b/AUTHORS index bc5acfa..522ab86 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ Pablo Cholaky Guillaume Delvit (https://github.com/guiguid) (Arch documentation) Sven Eden Florian Gamböck : +GimmeHardware (https://github.com/GimmeHardware) Karol Herbst ko-zu Thomas Kear diff --git a/ChangeLog b/ChangeLog index e3e2571..59922f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ # ChangeLog for zram-init: +*zram-init-10.12: + Martin Väth : + - Make the options -M and -2 work. Thanks to GimmeHardware for the + report. See https://github.com/vaeth/zram-init/issues/34 + +*zram-init-10.11: + Kriss: + - Fix typo introduced in 10.10 + *zram-init-10.10: Martin Väth : - Let mlim (-S) actually be in megabytes as documented (not in bytes). diff --git a/sbin/zram-init.in b/sbin/zram-init.in index e5de94c..890d768 100755 --- a/sbin/zram-init.in +++ b/sbin/zram-init.in @@ -412,11 +412,11 @@ ext2) || xFatal 'mkfs.ext2 ${devnode} failed' eval "set -- a $tune2fs_opt" shift - tune2fs -c0 -i0 -m0 -- "$devnode" >/dev/null + tune2fs -c0 -i0 -m0 ${1+"$@"} -- "$devnode" >/dev/null $mount || exit 0 eval "set -- a $mount_opt" shift - mount -t ext2 ${opts:+-o "$opts"} -- "$devnode" "$dir" \ + mount -t ext2 ${opts:+-o "$opts"} ${1+"$@"} -- "$devnode" "$dir" \ || xFatal 'mount ${devnode} failed';; ext4) fsopts=$fsopts',extent,^uninit_bg,dir_nlink,extra_isize,^has_journal' @@ -427,12 +427,12 @@ ext4) || xFatal 'mkfs.ext4 ${devnode} failed' eval "set -- a $tune2fs_opt" shift - tune2fs -c0 -i0 -m0 -- "$devnode" >/dev/null + tune2fs -c0 -i0 -m0 ${1+"$@"} -- "$devnode" >/dev/null $mount || exit 0 ! $discard || opts=$opts${opts:+,}'discard' eval "set -- a $mount_opt" shift - mount -t ext4 ${opts:+-o "$opts"} -- "$devnode" "$dir" \ + mount -t ext4 ${opts:+-o "$opts"} ${1+"$@"} -- "$devnode" "$dir" \ || xFatal 'mount ${devnode} failed';; btrfs) mkfs.btrfs -d single -m single \ @@ -442,7 +442,7 @@ btrfs) $mount || exit 0 eval "set -- a $mount_opt" shift - mount -t btrfs ${opts:+-o "$opts"} -- "$devnode" "$dir" \ + mount -t btrfs ${opts:+-o "$opts"} ${1+"$@"} -- "$devnode" "$dir" \ || xFatal 'mount ${devnode} failed';; xfs) mkfs.xfs ${label:+-L "$label"} ${uuid:+-m uuid="$uuid"} \ @@ -451,7 +451,7 @@ xfs) $mount || exit 0 eval "set -- a $mount_opt" shift - mount -t xfs ${opts:+-o "$opts"} -- "$devnode" "$dir" \ + mount -t xfs ${opts:+-o "$opts"} ${1+"$@"} -- "$devnode" "$dir" \ || xFatal 'mount ${devnode} failed';; *) xFatal 'unsupported filesystem ${fstype}';;