Use PERSISTENCE_PATH with a trailing "/".
[debian-live-boot.git] / backend / initramfs-tools / live.hook
blob76f42187a276f29a68325dcc4d74cc00f8d925a6
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 /bin/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}/bin"
31 cp -a /bin/live-boot /lib/live/boot "${DESTDIR}/bin"
33 mkdir -p "${DESTDIR}/lib/live"
34 cp -a /lib/live/boot "${DESTDIR}/lib/live"
36 # klibc dependencies
37 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
39 if [ ! -e "${DESTDIR}/${FILE}" ] && ls "${FILE}" > /dev/null 2>&1
40 then
41 cp -a "${FILE}" "${DESTDIR}/${FILE}"
43 done
45 # udev dependencies
46 for FILE in /lib/udev/*_id
48 copy_exec "${FILE}"
49 done
51 if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
52 then
53 mkdir -p "${DESTDIR}/lib/udev/rules.d"
54 cp -p /lib/udev/rules.d/60-cdrom_id.rules "${DESTDIR}/lib/udev/rules.d"
57 [ "${QUIET}" ] || echo -n " filesystems"
59 # Configuration: keymap (usefull when using encryption)
60 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
61 then
62 copy_exec /bin/loadkeys
64 mkdir -p "${DESTDIR}/etc"
65 cp /etc/console/boottime.kmap.gz "${DESTDIR}/etc"
68 # Configuration: Unique ID
69 if [ -n "${LIVE_GENERATE_UUID}" ]
70 then
71 mkdir -p "${DESTDIR}/conf"
72 uuidgen -r > "${DESTDIR}/conf/uuid.conf"
75 # Filesystem: btrfs
76 manual_add_modules btrfs
78 # Filesystem: cifs
79 if [ -x /sbin/mount.cifs ]
80 then
81 copy_exec /sbin/mount.cifs
82 manual_add_modules cifs
85 # Filesystem: ext3/ext4
86 manual_add_modules ext3
87 manual_add_modules ext4
89 # Filesystem: hfs/hfsplus
90 manual_add_modules hfs
91 manual_add_modules hfsplus
93 # Filesystem: jffs2
94 manual_add_modules jffs2
96 if [ -x /usr/bin/rsync ]
97 then
98 copy_exec /usr/bin/rsync /bin
101 # Filesystem: squashfs
102 copy_exec /sbin/losetup
103 manual_add_modules loop
104 manual_add_modules squashfs
105 manual_add_modules sqlzma
106 manual_add_modules unlzma
108 # Filesystem: aufs/overlayfs/unionfs
109 manual_add_modules aufs
110 manual_add_modules overlayfs
111 manual_add_modules unionfs
113 # Filesystem: unionfs-fuse
114 if [ -x /usr/bin/unionfs-fuse ]
115 then
116 copy_exec /usr/bin/unionfs-fuse /bin
119 # Filesystem: vfat
120 manual_add_modules nls_cp437
121 manual_add_modules nls_iso8859-1
122 manual_add_modules nls_utf8
123 manual_add_modules vfat
125 # Filesystem: ntfs
126 manual_add_modules ntfs
128 [ "${QUIET}" ] || echo -n " devices"
129 # Hardware: cdrom
130 manual_add_modules ide-cd
131 manual_add_modules ide-generic
132 manual_add_modules ohci1394
133 manual_add_modules sbp2
134 manual_add_modules sr_mod
136 # Hardware: usb
137 manual_add_modules sd_mod
139 # Hardware: network
140 auto_add_modules net
142 # Program: eject
143 if [ -x /usr/bin/eject ]
144 then
145 copy_exec /usr/bin/eject /bin
148 # Program: mount
149 # fuse does not work with klibc mount
150 copy_exec /bin/mount /bin/mount.util-linux
152 [ "${QUIET}" ] || echo -n " utils"
154 # Feature: Verify Checksums
155 if [ -e /etc/progress-linux_version ]
156 then
157 copy_exec /usr/bin/sha256sum /bin
158 else
159 copy_exec /usr/bin/md5sum /bin
162 # Program: memdisk
163 if [ -x /usr/bin/memdiskfind ]
164 then
165 [ "${QUIET}" ] || echo -n " memdisk"
166 copy_exec /usr/bin/memdiskfind
167 manual_add_modules phram
168 manual_add_modules mtdblock
171 # Program: udev
172 if [ -x /sbin/udevadm ]
173 then
174 [ "${QUIET}" ] || echo -n " udev"
175 copy_exec /sbin/udevadm
178 # Program: wget
179 if [ -x /usr/bin/wget ]
180 then
181 [ "${QUIET}" ] || echo -n " wget"
182 copy_exec /usr/bin/wget /bin
185 # Program: blockdev
186 if [ -x /sbin/blockdev ]
187 then
188 [ "${QUIET}" ] || echo -n " blockdev"
189 copy_exec /sbin/blockdev
192 # FUSE kernel module
193 manual_add_modules fuse
195 # FUSE filesystem: httpfs2
196 if [ -x /usr/bin/httpfs2_ssl ]
197 then
198 [ "${QUIET}" ] || echo -n " httpfs:ssl"
199 copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
200 elif [ -x /usr/bin/httpfs2 ]
201 then
202 [ "${QUIET}" ] || echo -n " httpfs"
203 copy_exec /usr/bin/httpfs2 /bin/httpfs
206 # FUSE filesystem: curlftpfs
207 if [ -x /usr/bin/curlftpfs ]
208 then
209 [ "${QUIET}" ] || echo -n " ftpfs"
210 copy_exec /usr/bin/curlftpfs /bin
213 # iSCSI
214 if [ -x /usr/sbin/iscsistart ]
215 then
216 [ "${QUIET}" ] || echo -n " iscsi"
217 copy_exec /usr/sbin/iscsistart /bin
218 #manual_add_modules ib_iser
219 manual_add_modules iscsi_tcp
220 manual_add_modules crc32c
223 # Some experimental stuff
225 case "${LIVE_DNS}" in
226 true)
227 [ "${QUIET}" ] || echo -n " dns"
229 # /lib/libnss_dns.so.*:a DNS
230 # /lib/libnss_files.so.*: /etc/hosts and /etc/passwd
231 # /lib/libnss_compat.so.*: /etc/passwd
233 for _SHLIB in $(find /lib -name 'libnss_dns.so.*')
235 copy_exec "${_SHLIB}"
236 done
238 # might be needed if /etc/hosts is used
239 #mkdir -p "${DESTDIR}/etc"
240 #cp -p /etc/nsswitch.conf "${DESTDIR}/etc"
242 esac
244 [ "${QUIET}" ] || echo .