Refresh dracut module setup
[zfs.git] / dracut / 90zfs / module-setup.sh.in
1 #!/bin/sh
2
3 check() {
4         # We depend on udev-rules being loaded
5         [ "$1" = "-d" ] && return 0
6
7         # Verify the zfs tool chain
8         which zpool >/dev/null 2>&1 || return 1
9         which zfs >/dev/null 2>&1 || return 1
10
11         return 0
12 }
13
14 depends() {
15         echo udev-rules
16         return 0
17 }
18
19 installkernel() {
20         instmods zfs
21         instmods zcommon
22         instmods znvpair
23         instmods zavl
24         instmods zunicode
25         instmods spl
26         instmods zlib_deflate
27         instmods zlib_inflate
28 }
29
30 install() {
31         inst_rules @udevruledir@/90-zfs.rules
32         inst_rules @udevruledir@/69-vdev.rules
33         inst_rules @udevruledir@/60-zvol.rules
34         dracut_install @sbindir@/zfs
35         dracut_install @sbindir@/zpool
36         dracut_install @udevdir@/vdev_id
37         dracut_install @udevdir@/zvol_id
38         dracut_install mount.zfs
39         dracut_install hostid
40         inst_hook cmdline 95 "$moddir/parse-zfs.sh"
41         inst_hook mount 98 "$moddir/mount-zfs.sh"
42
43         if [ -e @sysconfdir@/zfs/zpool.cache ]; then
44                 inst @sysconfdir@/zfs/zpool.cache
45         fi
46
47         # Synchronize initramfs and system hostid
48         TMP=`mktemp`
49         AA=`hostid | cut -b 1,2`
50         BB=`hostid | cut -b 3,4`
51         CC=`hostid | cut -b 5,6`
52         DD=`hostid | cut -b 7,8`
53         printf "\x$DD\x$CC\x$BB\x$AA" >$TMP
54         inst_simple "$TMP" /etc/hostid
55         rm "$TMP"
56 }