mirror_zfs/contrib/debian/openzfs-zfsutils.postinst
Umer Saleem 4d631a509d
Add native Debian Packaging for Linux
Currently, the Debian packages are generated from ALIEN that converts
RPMs to Debian packages. This commit adds native Debian packaging for
Debian based systems.

This packaging is a fork of Debian zfs-linux 2.1.6-2 release.
(source: https://salsa.debian.org/zfsonlinux-team/zfs)

Some updates have been made to keep the footprint minimal that
include removing the tests, translation files, patches directory etc.
All credits go to Debian ZFS on Linux Packaging Team.

For copyright information, please refer to contrib/debian/copyright.

scripts/debian-packaging.sh can be used to invoke the build.

Reviewed-by: Mo Zhou <cdluminate@gmail.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #13451
2022-10-27 15:38:45 -07:00

29 lines
1.1 KiB
Bash

#!/bin/sh
set -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 `zpool import`, the
# current hostname and hostid are different than the stored values thereof.
#
# The only way of having a stable hostid is to define it in /etc/hostid.
# This postinst helper will check if we already have the hostid stabilized by
# checking the existence of the file /etc/hostid to be 4 bytes at least.
# If this file don't already exists on our system or has less than 4 bytes, then
# a new (random) value is generated with zgenhostid (8) and stored in
# /etc/hostid
if [ ! -f /etc/hostid ] || [ "$(stat -c %s /etc/hostid)" -lt 4 ] ; then
zgenhostid
fi
# When processed to here but zfs kernel module is not loaded, the subsequent
# services would fail to start. In this case the installation process just
# fails at the postinst stage. The user could do
# $ sudo modprobe zfs; sudo dpkg --configure -a
# to complete the installation.
#
modprobe -v zfs || true # modprobe zfs does nothing if zfs.ko was already loaded.
#DEBHELPER#