Using /etc/live/boot/*.conf instead of /etc/live/boot.d/*.conf and /live/image/live...
[debian-live-boot/hramrach.git] / backends / initramfs-tools / live.hook
blob00da049cd309477a5e2b59d9bf8a4fa0aefbf51b
1 #!/bin/sh
3 set -e
5 . /usr/share/initramfs-tools/hook-functions
7 [ "${QUIET}" ] || echo -n "live-boot:"
9 # Reading configuration files
10 if [ -e /etc/live/boot.conf ]
11 then
12 . /etc/live/boot.conf
15 if ls /etc/live/boot/* > /dev/null 2>&1
16 then
17 for _FILE in /etc/live/boot/*
19 . ${_FILE}
20 done
23 # Checking live-boot
24 if [ ! -e /lib/live/boot ]
25 then
26 echo
27 echo "W: live-boot-initramfs-tools (backend) installed without live-boot,"
28 echo "W: this initramfs will *NOT* have live support."
29 exit 0
32 [ "${QUIET}" ] || echo -n " core"
34 mkdir -p "${DESTDIR}/lib/live"
35 cp -a /lib/live/boot.sh /lib/live/boot "${DESTDIR}/lib/live"
37 # klibc dependencies
38 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
40 if [ ! -e "${DESTDIR}"/"${FILE}" ] && ls ${FILE} > /dev/null 2>&1
41 then
42 cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
44 done
46 # udev dependencies
47 for FILE in /lib/udev/*_id
49 copy_exec "${FILE}"
50 done
52 # wheezy/sid
53 if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
54 then
55 mkdir -p ${DESTDIR}/lib/udev/rules.d
56 cp -p /lib/udev/rules.d/60-cdrom_id.rules ${DESTDIR}/lib/udev/rules.d
59 [ "${QUIET}" ] || echo -n " filesystems"
61 # Configuration: keymap (usefull when using encryption)
62 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
63 then
64 copy_exec /bin/loadkeys
66 mkdir -p "${DESTDIR}"/etc
67 cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
70 # Configuration: Unique ID
71 if [ -n "${LIVE_GENERATE_UUID}" ]
72 then
73 mkdir -p "${DESTDIR}"/conf
74 uuidgen -r > "${DESTDIR}"/conf/uuid.conf
77 # Filesystem: btrfs
78 manual_add_modules btrfs
80 # Filesystem: cifs
81 if [ -x /sbin/mount.cifs ]
82 then
83 copy_exec /sbin/mount.cifs
84 manual_add_modules cifs
87 # Filesystem: ext3/ext4
88 manual_add_modules ext3
89 manual_add_modules ext4
91 # Filesystem: jffs2
92 manual_add_modules jffs2
94 if [ -x /usr/bin/rsync ]
95 then
96 copy_exec /usr/bin/rsync /bin
99 # Filesystem: squashfs
100 copy_exec /sbin/losetup
101 manual_add_modules loop
102 manual_add_modules squashfs
103 manual_add_modules sqlzma
104 manual_add_modules unlzma
106 # Filesystem: aufs/overlayfs/unionfs
107 manual_add_modules aufs
108 manual_add_modules overlayfs
109 manual_add_modules unionfs
111 # Filesystem: unionfs-fuse
112 if [ -x /usr/bin/unionfs-fuse ]
113 then
114 copy_exec /usr/bin/unionfs-fuse /bin
117 # Filesystem: vfat
118 manual_add_modules nls_cp437
119 manual_add_modules nls_iso8859-1
120 manual_add_modules nls_utf8
121 manual_add_modules vfat
123 # Filesystem: ntfs
124 manual_add_modules ntfs
126 [ "${QUIET}" ] || echo -n " devices"
127 # Hardware: cdrom
128 manual_add_modules ide-cd
129 manual_add_modules ide-generic
130 manual_add_modules ohci1394
131 manual_add_modules sbp2
132 manual_add_modules sr_mod
134 # Hardware: usb
135 manual_add_modules sd_mod
137 # Hardware: network
138 auto_add_modules net
140 # Program: eject
141 if [ -x /usr/bin/eject ]
142 then
143 copy_exec /usr/bin/eject /bin
146 [ "${QUIET}" ] || echo -n " utils"
148 # Feature: Verify Checksums
149 copy_exec /usr/bin/sha256sum /bin
150 copy_exec /usr/bin/md5sum /bin
152 # Program: memdisk
153 if [ -x /usr/bin/memdiskfind ]
154 then
155 [ "${QUIET}" ] || echo -n " memdisk"
156 copy_exec /usr/bin/memdiskfind
157 manual_add_modules phram
158 manual_add_modules mtdblock
161 # Program: udev
162 if [ -x /sbin/udevadm ]
163 then
164 [ "${QUIET}" ] || echo -n " udev"
165 copy_exec /sbin/udevadm
167 if [ -x /usr/bin/udevinfo ]
168 then
169 [ "${QUIET}" ] || echo -n " udev"
170 copy_exec /usr/bin/udevinfo /bin
173 # Program: wget
174 if [ -x /usr/bin/wget ]
175 then
176 [ "${QUIET}" ] || echo -n " wget"
177 copy_exec /usr/bin/wget /bin
180 # Program: blockdev
181 if [ -x /sbin/blockdev ]
182 then
183 [ "${QUIET}" ] || echo -n " blockdev"
184 copy_exec /sbin/blockdev
187 # FUSE kernel module
188 manual_add_modules fuse
190 # FUSE filesystem: httpfs2
191 if [ -x /usr/bin/httpfs2_ssl ]
192 then
193 [ "${QUIET}" ] || echo -n " httpfs:ssl"
194 copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
195 elif [ -x /usr/bin/httpfs2 ]
196 then
197 [ "${QUIET}" ] || echo -n " httpfs"
198 copy_exec /usr/bin/httpfs2 /bin/httpfs
201 # FUSE filesystem: curlftpfs
202 if [ -x /usr/bin/curlftpfs ]
203 then
204 [ "${QUIET}" ] || echo -n " ftpfs"
205 copy_exec /usr/bin/curlftpfs /bin
208 # iSCSI
209 if [ -x /usr/sbin/iscsistart ]
210 then
211 [ "${QUIET}" ] || echo -n " iscsi"
212 copy_exec /usr/sbin/iscsistart /bin
213 #manual_add_modules ib_iser
214 manual_add_modules iscsi_tcp
215 manual_add_modules crc32c
218 # Some experimental stuff
220 case "${LIVE_DNS}" in
221 true)
222 [ "${QUIET}" ] || echo -n " dns"
224 # /lib/libnss_dns.so.*:a DNS
225 # /lib/libnss_files.so.*: /etc/hosts and /etc/passwd
226 # /lib/libnss_compat.so.*: /etc/passwd
228 for _SHLIB in $(find /lib -name 'libnss_dns.so.*')
230 copy_exec "${_SHLIB}"
231 done
233 # might be needed if /etc/hosts is used
234 #mkdir -p "${DESTDIR}/etc"
235 #cp -p /etc/nsswitch.conf "${DESTDIR}/etc"
237 esac
239 case "${LIVE_UNIONMOUNT}" in
240 true)
241 [ "${QUIET}" ] || echo -n " unionmount"
243 # UnionMount
244 # only mount from patched util-linux can do this currently
245 copy_exec /bin/mount /bin/mount_full
247 esac
249 [ "${QUIET}" ] || echo .