Adding upstream version 4.0~a8.
[debian-live-boot.git] / backends / initramfs-tools / live.hook
blob1814211655a940269da25f76f6ed87a49a4b6bc2
1 #!/bin/sh
3 set -e
5 . /usr/share/initramfs-tools/hook-functions
7 [ "${QUIET}" ] || echo -n "live-boot:"
9 # Reading configuration file from filesystem and live-media
10 for _FILE in /etc/live/boot.conf /etc/live/boot/* \
11 /lib/live/mount/media/live/boot.conf /lib/live/mount/media/live/boot/*
13 if [ -e "${_FILE}" ]
14 then
15 . "${_FILE}"
17 done
19 # Checking live-boot
20 if [ ! -e /lib/live/boot ]
21 then
22 echo
23 echo "W: live-boot-initramfs-tools (backend) installed without live-boot,"
24 echo "W: this initramfs will *NOT* have live support."
25 exit 0
28 [ "${QUIET}" ] || echo -n " core"
30 mkdir -p "${DESTDIR}/lib/live"
31 cp -a /lib/live/boot.sh /lib/live/boot "${DESTDIR}/lib/live"
33 # klibc dependencies
34 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
36 if [ ! -e "${DESTDIR}"/"${FILE}" ] && ls ${FILE} > /dev/null 2>&1
37 then
38 cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
40 done
42 # udev dependencies
43 for FILE in /lib/udev/*_id
45 copy_exec "${FILE}"
46 done
48 if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
49 then
50 mkdir -p ${DESTDIR}/lib/udev/rules.d
51 cp -p /lib/udev/rules.d/60-cdrom_id.rules ${DESTDIR}/lib/udev/rules.d
54 [ "${QUIET}" ] || echo -n " filesystems"
56 # Configuration: keymap (usefull when using encryption)
57 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
58 then
59 copy_exec /bin/loadkeys
61 mkdir -p "${DESTDIR}"/etc
62 cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
65 # Configuration: Unique ID
66 if [ -n "${LIVE_GENERATE_UUID}" ]
67 then
68 mkdir -p "${DESTDIR}"/conf
69 uuidgen -r > "${DESTDIR}"/conf/uuid.conf
72 # Filesystem: btrfs
73 manual_add_modules btrfs
75 # Filesystem: cifs
76 if [ -x /sbin/mount.cifs ]
77 then
78 copy_exec /sbin/mount.cifs
79 manual_add_modules cifs
82 # Filesystem: ext3/ext4
83 manual_add_modules ext3
84 manual_add_modules ext4
86 # Filesystem: hfs/hfsplus
87 manual_add_modules hfs
88 manual_add_modules hfsplus
90 # Filesystem: jffs2
91 manual_add_modules jffs2
93 if [ -x /usr/bin/rsync ]
94 then
95 copy_exec /usr/bin/rsync /bin
98 # Filesystem: squashfs
99 copy_exec /sbin/losetup
100 manual_add_modules loop
101 manual_add_modules squashfs
102 manual_add_modules sqlzma
103 manual_add_modules unlzma
105 # Filesystem: aufs/overlayfs/unionfs
106 manual_add_modules aufs
107 manual_add_modules overlayfs
108 manual_add_modules unionfs
110 # Filesystem: unionfs-fuse
111 if [ -x /usr/bin/unionfs-fuse ]
112 then
113 copy_exec /usr/bin/unionfs-fuse /bin
116 # Filesystem: vfat
117 manual_add_modules nls_cp437
118 manual_add_modules nls_iso8859-1
119 manual_add_modules nls_utf8
120 manual_add_modules vfat
122 # Filesystem: ntfs
123 manual_add_modules ntfs
125 [ "${QUIET}" ] || echo -n " devices"
126 # Hardware: cdrom
127 manual_add_modules ide-cd
128 manual_add_modules ide-generic
129 manual_add_modules ohci1394
130 manual_add_modules sbp2
131 manual_add_modules sr_mod
133 # Hardware: usb
134 manual_add_modules sd_mod
136 # Hardware: network
137 auto_add_modules net
139 # Program: eject
140 if [ -x /usr/bin/eject ]
141 then
142 copy_exec /usr/bin/eject /bin
145 # Program: mount
146 # fuse does not work with klibc mount
147 copy_exec /bin/mount /bin/mount.util-linux
149 [ "${QUIET}" ] || echo -n " utils"
151 # Feature: Verify Checksums
152 if [ -e /etc/progress-linux_version ]
153 then
154 copy_exec /usr/bin/sha256sum /bin
155 else
156 copy_exec /usr/bin/md5sum /bin
159 # Program: memdisk
160 if [ -x /usr/bin/memdiskfind ]
161 then
162 [ "${QUIET}" ] || echo -n " memdisk"
163 copy_exec /usr/bin/memdiskfind
164 manual_add_modules phram
165 manual_add_modules mtdblock
168 # Program: udev
169 if [ -x /sbin/udevadm ]
170 then
171 [ "${QUIET}" ] || echo -n " udev"
172 copy_exec /sbin/udevadm
175 # Program: wget
176 if [ -x /usr/bin/wget ]
177 then
178 [ "${QUIET}" ] || echo -n " wget"
179 copy_exec /usr/bin/wget /bin
182 # Program: blockdev
183 if [ -x /sbin/blockdev ]
184 then
185 [ "${QUIET}" ] || echo -n " blockdev"
186 copy_exec /sbin/blockdev
189 # FUSE kernel module
190 manual_add_modules fuse
192 # FUSE filesystem: httpfs2
193 if [ -x /usr/bin/httpfs2_ssl ]
194 then
195 [ "${QUIET}" ] || echo -n " httpfs:ssl"
196 copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
197 elif [ -x /usr/bin/httpfs2 ]
198 then
199 [ "${QUIET}" ] || echo -n " httpfs"
200 copy_exec /usr/bin/httpfs2 /bin/httpfs
203 # FUSE filesystem: curlftpfs
204 if [ -x /usr/bin/curlftpfs ]
205 then
206 [ "${QUIET}" ] || echo -n " ftpfs"
207 copy_exec /usr/bin/curlftpfs /bin
210 # iSCSI
211 if [ -x /usr/sbin/iscsistart ]
212 then
213 [ "${QUIET}" ] || echo -n " iscsi"
214 copy_exec /usr/sbin/iscsistart /bin
215 #manual_add_modules ib_iser
216 manual_add_modules iscsi_tcp
217 manual_add_modules crc32c
220 # Some experimental stuff
222 case "${LIVE_DNS}" in
223 true)
224 [ "${QUIET}" ] || echo -n " dns"
226 # /lib/libnss_dns.so.*:a DNS
227 # /lib/libnss_files.so.*: /etc/hosts and /etc/passwd
228 # /lib/libnss_compat.so.*: /etc/passwd
230 for _SHLIB in $(find /lib -name 'libnss_dns.so.*')
232 copy_exec "${_SHLIB}"
233 done
235 # might be needed if /etc/hosts is used
236 #mkdir -p "${DESTDIR}/etc"
237 #cp -p /etc/nsswitch.conf "${DESTDIR}/etc"
239 esac
241 [ "${QUIET}" ] || echo .