#!/bin/sh -e
# The hostname and hostid of the last system to access a ZFS pool are stored in
-# the ZFS pool itself. A pool is foreign if, during `zfs import`, the current
-# hostname and hostid are different than the stored values thereof.
+# the ZFS pool itself. A pool is foreign if, during `zpool import`, the
+# current hostname and hostid are different than the stored values thereof.
#
# The hostname and hostid on Solaris are intrinsic, but they are not on Linux,
# so the spl kernel module invokes /bin/hostname and /usr/bin/hostid from the
HOSTID=$(hostid)
# @TODO: Check whether this method is appropriate for gethostid(2) on big
-# endian systems. The /etc/hostname file on i386 and amd64 systems must be
-# a little endian integer of exacly four bytes. Regardless, a consistent
-# hostid is more important than a correct byte order here.
+# endian systems. (Update: It isn't.)
+#
+# The /etc/hostname file on i386 and amd64 systems must be a little endian
+# integer of exacly four bytes. Regardless, a consistent hostid is more
+# important than a correct byte order here.
# Conveniences like a ${HOSTID:$ii:2} substring range or a `sed` one-liner
# are prohibited here because this file must be dash-compatible by policy.
"$(which printf)" "\x$DD\x$CC\x$BB\x$AA" >"/etc/hostid"
# @ASSERT: [ "$HOSTID" = "$(hostid)" ]
+
#DEBHELPER#