aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Cordero <[email protected]>2018-12-13 23:48:46 +0000
committerBrian Behlendorf <[email protected]>2018-12-13 15:48:46 -0800
commiteff7d78f8a1e2c8c8a151b99ee7e66ad619b201c (patch)
tree1c69bfde2a66e41e4605d3ec4dc14a7411b07a7c
parent5aa95ba0d3502779695341b5f55fa5ba1d3330ff (diff)
Add `cut` binary to the initramfs
Since the `cut -b` command is used by `parse-zfs.sh`, ensure that it is copied to the initramfs. Fix spl_hostid when set by cmdline. This follows a similar logic from the `zgenhostid` script, using `echo` instead of `printf`. Reviewed-by: Olaf Faaland <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ben Cordero <[email protected]> Closes #8197
-rwxr-xr-xcontrib/dracut/90zfs/module-setup.sh.in3
-rwxr-xr-xcontrib/dracut/90zfs/parse-zfs.sh.in2
2 files changed, 3 insertions, 2 deletions
diff --git a/contrib/dracut/90zfs/module-setup.sh.in b/contrib/dracut/90zfs/module-setup.sh.in
index 38dd84d5a..f595a369c 100755
--- a/contrib/dracut/90zfs/module-setup.sh.in
+++ b/contrib/dracut/90zfs/module-setup.sh.in
@@ -59,6 +59,7 @@ install() {
dracut_install @udevdir@/vdev_id
dracut_install awk
dracut_install basename
+ dracut_install cut
dracut_install head
dracut_install @udevdir@/zvol_id
inst_hook cmdline 95 "${moddir}/parse-zfs.sh"
@@ -86,7 +87,7 @@ install() {
BB=`hostid | cut -b 3,4`
CC=`hostid | cut -b 5,6`
DD=`hostid | cut -b 7,8`
- printf "\x${DD}\x${CC}\x${BB}\x${AA}" > "${initdir}/etc/hostid"
+ echo -ne "\\x${DD}\\x${CC}\\x${BB}\\x${AA}" > "${initdir}/etc/hostid"
if dracut_module_included "systemd"; then
mkdir -p "${initdir}/$systemdsystemunitdir/zfs-import.target.wants"
diff --git a/contrib/dracut/90zfs/parse-zfs.sh.in b/contrib/dracut/90zfs/parse-zfs.sh.in
index 2a532c75b..eccfdc6bc 100755
--- a/contrib/dracut/90zfs/parse-zfs.sh.in
+++ b/contrib/dracut/90zfs/parse-zfs.sh.in
@@ -10,7 +10,7 @@ if [ -n "${spl_hostid}" ] ; then
BB=$(echo "${spl_hostid}" | cut -b 3,4)
CC=$(echo "${spl_hostid}" | cut -b 5,6)
DD=$(echo "${spl_hostid}" | cut -b 7,8)
- printf "\\x%s\\x%s\\x%s\\x%s" "${DD}" "${CC}" "${BB}" "${AA}" >/etc/hostid
+ echo -ne "\\x${DD}\\x${CC}\\x${BB}\\x${AA}" >/etc/hostid
elif [ -f "/etc/hostid" ] ; then
info "ZFS: Using hostid from /etc/hostid: $(hostid)"
else