]>
Commit | Line | Data |
---|---|---|
5b9cd1ad SI |
1 | #!/bin/sh |
2 | set -e | |
3 | # The hostname and hostid of the last system to access a ZFS pool are stored in | |
4 | # the ZFS pool itself. A pool is foreign if, during `zpool import`, the | |
5 | # current hostname and hostid are different than the stored values thereof. | |
6 | # | |
7 | # The only way of having a stable hostid is to define it in /etc/hostid. | |
8 | # This postinst helper will check if we already have the hostid stabilized by | |
9 | # checking the existence of the file /etc/hostid to be 4 bytes at least. | |
10 | # If this file don't already exists on our system or has less than 4 bytes, then | |
11 | # a new (random) value is generated with zgenhostid (8) and stored in | |
12 | # /etc/hostid | |
13 | ||
14 | if [ ! -f /etc/hostid ] || [ "$(stat -c %s /etc/hostid)" -lt 4 ] ; then | |
15 | zgenhostid | |
16 | fi | |
17 | ||
18 | #DEBHELPER# | |
19 |