Rebase against version 1.136.2-2
[live-initramfs-grml.git] / hooks / live
1 #!/bin/sh
2
3 # initramfs hook for live-initramfs (Debian Live)
4
5 set -e
6
7 # initramfs-tools header
8
9 PREREQ=""
10
11 prereqs()
12 {
13         echo "${PREREQ}"
14 }
15
16 case "${1}" in
17         prereqs)
18                 prereqs
19                 exit 0
20                 ;;
21 esac
22
23 . /usr/share/initramfs-tools/hook-functions
24
25 # live-initramfs hook
26
27 # Handling live-initramfs
28
29 # Configuration
30 if [ -r /etc/live.conf ]
31 then
32         . /etc/live.conf
33
34         mkdir -p "${DESTDIR}"/etc
35         cp /etc/live.conf "${DESTDIR}"/etc
36 fi
37
38 # Directories
39 mkdir -p "${DESTDIR}"/lib/live-initramfs
40
41 # Executables
42 copy_exec /usr/share/live-initramfs/live-reconfigure /bin
43 copy_exec /usr/share/live-initramfs/live-preseed /bin
44
45 # Scripts
46 cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
47 cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts
48
49 # klibc dependencies
50 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
51 do
52         if [ ! -e "${DESTDIR}"/"${FILE}" ]
53         then
54                 cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
55         fi
56 done
57
58 # Handling other stuff
59
60 # Configuration: keymap (usefull when using encryption)
61 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
62 then
63         copy_exec /bin/loadkeys /bin
64
65         mkdir -p "${DESTDIR}"/etc
66         cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
67 fi
68
69 # Configuration: Unique ID
70 if [ -n "${LIVE_GENERATE_UUID}" ]
71 then
72         mkdir -p "${DESTDIR}"/conf
73         uuidgen -r > "${DESTDIR}"/conf/uuid.conf
74 fi
75
76 # Filesystem: cifs
77 if [ -x /sbin/mount.cifs ]
78 then
79         copy_exec /sbin/mount.cifs /sbin
80         manual_add_modules cifs
81 fi
82
83 # Filesystem: ext3
84 manual_add_modules ext3
85
86 # Filesystem: jffs2
87 manual_add_modules jffs2
88
89 # Filesystem: squashfs
90 copy_exec /sbin/losetup /sbin
91 manual_add_modules loop
92 manual_add_modules squashfs
93
94 # Filesystem: aufs/unionfs
95 manual_add_modules aufs
96 manual_add_modules unionfs
97
98 # Filesystem: vfat
99 manual_add_modules nls_cp437
100 manual_add_modules nls_iso8859-1
101 manual_add_modules nls_utf8
102 manual_add_modules vfat
103
104 # Hardware: cdrom
105 manual_add_modules ide-cd
106 manual_add_modules ide-generic
107 manual_add_modules ohci1394
108 manual_add_modules sbp2
109 manual_add_modules sr_mod
110
111 # Hardware: usb
112 manual_add_modules sd_mod
113
114 # Hardware: network
115 auto_add_modules net
116
117 # Program: eject
118 if [ -x /usr/bin/eject ]
119 then
120         copy_exec /usr/bin/eject /bin
121 fi
122
123 # Program: md5sum
124 copy_exec /usr/bin/md5sum /bin
125
126 # Program: udev
127 if [ -x /sbin/udevadm ]
128 then
129         # lenny
130         copy_exec /sbin/udevadm /sbin
131 else
132         # etch
133         copy_exec /sbin/udevtrigger /sbin
134         copy_exec /sbin/udevsettle /sbin
135 fi
136 copy_exec /usr/bin/udevinfo /bin
137
138 # Program: wget
139 if [ -x /usr/bin/wget ]
140 then
141         copy_exec /usr/bin/wget /bin
142 fi
143
144 # FUSE kernel module
145 manual_add_modules fuse
146
147 # FUSE filesystem: httpfs2
148 if [ -x /usr/bin/httpfs2_ssl ]
149 then
150         copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
151 elif [ -x /usr/bin/httpfs2 ]
152 then
153         copy_exec /usr/bin/httpfs2 /bin/httpfs
154 fi
155
156 # FUSE filesystem: curlftpfs
157 if [ -x /usr/bin/curlftpfs ]
158 then
159         copy_exec /usr/bin/curlftpfs /bin
160 fi