Adding noprompt={usb,cd} feature.
[debian-live-boot.git] / hooks / live
blob93a2831e70109e2127a2b131de3c3ad555cc3462
1 #!/bin/sh
3 # initramfs hook for live-boot (Debian Live)
5 set -e
7 # initramfs-tools header
9 PREREQ=""
11 prereqs()
13 echo "${PREREQ}"
16 case "${1}" in
17 prereqs)
18 prereqs
19 exit 0
21 esac
23 . /usr/share/initramfs-tools/hook-functions
25 # live-boot hook
27 # Reading configuration file from filesystem
28 if [ -e /etc/live/boot.conf ]
29 then
30 . /etc/live/boot.conf
33 if ls /etc/live/boot.d/* > /dev/null 2>&1
34 then
35 for _FILE in /etc/live/boot.d/*
37 . ${_FILE}
38 done
41 # Handling live-boot
43 # Configuration
44 if [ -e /usr/share/live-boot/languagelist ]
45 then
46 mkdir -p "${DESTDIR}"/usr/share/live-boot
47 cp /usr/share/live-boot/languagelist "${DESTDIR}"/usr/share/live-boot
50 # Directories
51 mkdir -p "${DESTDIR}"/lib/live-boot
53 # Executables
54 copy_exec /usr/share/live-boot/live-reconfigure /bin
55 copy_exec /usr/share/live-boot/live-preseed /bin
57 # Scripts
58 cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
59 cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts
61 # klibc dependencies
62 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
64 if [ ! -e "${DESTDIR}"/"${FILE}" ] && ls ${FILE} > /dev/null 2>&1
65 then
66 cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
68 done
70 # udev dependencies (squeeze and newer)
71 for FILE in /lib/udev/*_id
73 if [ ! -e "${DESTDIR}/${FILE}" ]
74 then
75 mkdir -p "${DESTDIR}/lib/udev"
76 copy_exec "${FILE}" /lib/udev
78 done
80 if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
81 then
82 mkdir -p ${DESTDIR}/lib/udev/rules.d
83 cp -p /lib/udev/rules.d/60-cdrom_id.rules ${DESTDIR}/lib/udev/rules.d
86 # Handling other stuff
88 # Configuration: keymap (usefull when using encryption)
89 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
90 then
91 copy_exec /bin/loadkeys /bin
93 mkdir -p "${DESTDIR}"/etc
94 cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
97 # Configuration: Unique ID
98 if [ -n "${LIVE_GENERATE_UUID}" ]
99 then
100 mkdir -p "${DESTDIR}"/conf
101 uuidgen -r > "${DESTDIR}"/conf/uuid.conf
104 # Filesystem: btrfs
105 manual_add_modules btrfs
107 # Filesystem: cifs
108 if [ -x /sbin/mount.cifs ]
109 then
110 copy_exec /sbin/mount.cifs /sbin
111 manual_add_modules cifs
114 # Filesystem: ext3/ext4
115 manual_add_modules ext3
116 manual_add_modules ext4
118 # Filesystem: jffs2
119 manual_add_modules jffs2
121 if [ -x /usr/bin/rsync ]
122 then
123 copy_exec /usr/bin/rsync /bin
126 # Filesystem: squashfs
127 copy_exec /sbin/losetup /sbin
128 manual_add_modules loop
129 manual_add_modules squashfs
130 manual_add_modules sqlzma
131 manual_add_modules unlzma
133 # Filesystem: aufs/unionfs
134 manual_add_modules aufs
135 manual_add_modules unionfs
137 # Filesystem: unionfs-fuse
138 if [ -x /usr/bin/unionfs-fuse ]
139 then
140 copy_exec /usr/bin/unionfs-fuse /bin
143 # Filesystem: vfat
144 manual_add_modules nls_cp437
145 manual_add_modules nls_iso8859-1
146 manual_add_modules nls_utf8
147 manual_add_modules vfat
149 # Filesystem: ntfs
150 manual_add_modules ntfs
152 # Hardware: cdrom
153 manual_add_modules ide-cd
154 manual_add_modules ide-generic
155 manual_add_modules ohci1394
156 manual_add_modules sbp2
157 manual_add_modules sr_mod
159 # Hardware: usb
160 manual_add_modules sd_mod
162 # Hardware: network
163 auto_add_modules net
165 # Program: eject
166 if [ -x /usr/bin/eject ]
167 then
168 copy_exec /usr/bin/eject /bin
171 # Program: md5sum
172 copy_exec /usr/bin/md5sum /bin
174 # Program: memdisk
175 if [ -x /usr/bin/memdiskfind ]
176 then
177 copy_exec /usr/bin/memdiskfind
178 manual_add_modules phram mtdblock
181 # Program: cpio
182 # busybox and klibc lacks --no-absolute-filenames and --sparse, needed for snapshots
183 if [ -e "${DESTDIR}/bin/cpio" ]
184 then
185 # Override already present cpio's, mostly klibc's
186 rm "${DESTDIR}/bin/cpio"
188 copy_exec /bin/cpio /bin
190 # Program: udev
191 if [ -x /sbin/udevadm ]
192 then
193 copy_exec /sbin/udevadm /sbin
195 if [ -x /usr/bin/udevinfo ]
196 then
197 copy_exec /usr/bin/udevinfo /bin
200 # Program: wget
201 if [ -x /usr/bin/wget ]
202 then
203 copy_exec /usr/bin/wget /bin
206 # Program: blockdev
207 if [ -x /sbin/blockdev ]
208 then
209 copy_exec /sbin/blockdev /sbin
212 # FUSE kernel module
213 manual_add_modules fuse
215 # FUSE filesystem: httpfs2
216 if [ -x /usr/bin/httpfs2_ssl ]
217 then
218 copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
219 elif [ -x /usr/bin/httpfs2 ]
220 then
221 copy_exec /usr/bin/httpfs2 /bin/httpfs
224 # FUSE filesystem: curlftpfs
225 if [ -x /usr/bin/curlftpfs ]
226 then
227 copy_exec /usr/bin/curlftpfs /bin
230 # iSCSI
231 if [ -x /usr/sbin/iscsistart ]
232 then
233 copy_exec /usr/sbin/iscsistart /bin
234 #manual_add_modules ib_iser
235 manual_add_modules iscsi_tcp
236 manual_add_modules crc32c
239 if [ "${LIVE_DNS}" = "true" ]
240 then
241 #copy_exec /lib/libnss_files.so.* /lib # /etc/hosts and /etc/passwd
242 copy_exec /lib/libnss_dns.so.* /lib # DNS server
243 #copy_exec /lib/libnss_compat.so.* /lib # /etc/passwd
245 # Configuration file - may be needed if /etc/hosts is used.
246 #mkdir -p $DESTDIR/etc
247 #cp -p /etc/nsswitch.conf $DESTDIR/etc
250 if [ "${LIVE_UNIONMOUNT}" = "true" ]
251 then
252 # UnionMount
253 # only mount from patched util-linux can do this currently
254 copy_exec /bin/mount /bin/mount_full