c01915e82eee71667b40e358bb106794edbaab60
[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@/60-zpool.rules
33         inst_rules @udevruledir@/60-zvol.rules
34         inst @sysconfdir@/zfs/zdev.conf
35         inst @sysconfdir@/zfs/zpool.cache
36         dracut_install @sbindir@/zfs
37         dracut_install @sbindir@/zpool
38         dracut_install @bindir@/zpool_layout
39         dracut_install @udevdir@/zpool_id
40         dracut_install @udevdir@/zvol_id
41         dracut_install mount.zfs
42         dracut_install hostid
43         inst_hook cmdline 95 "$moddir/parse-zfs.sh"
44         inst_hook mount 98 "$moddir/mount-zfs.sh"
45
46         # Synchronize initramfs and system hostid
47         TMP=`mktemp`
48         AA=`hostid | cut -b 1,2`
49         BB=`hostid | cut -b 3,4`
50         CC=`hostid | cut -b 5,6`
51         DD=`hostid | cut -b 7,8`
52         printf "\x$DD\x$CC\x$BB\x$AA" >$TMP
53         inst_simple "$TMP" /etc/hostid
54         rm "$TMP"
55 }