summaryrefslogtreecommitdiff
path: root/pcr/spl-dkms/spl.install
blob: 1438151a81368e1731212af6351c548aedd31b7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
post_install() {
    check_hostid
}

check_hostid() {
    # Check /etc/hostid to see if it set to the sentinel value, see
    # https://wiki.archlinux.org/index.php/ZFS for more information.
    HOSTID=$(hostid)
    if [ "0x$HOSTID" == "0xffffffff" ]; then
        # Generate a new hostid
        : >/etc/hostid
        HOSTID=$(hostid)
        # hostid is 4 byte little endian
        printf $(echo -n $HOSTID | sed 's/\(..\)\(..\)\(..\)\(..\)/\\x\4\\x\3\\x\2\\x\1/') >/etc/hostid
    fi
}