Adding upstream version 1.177.1.
[debian-live-boot/hramrach.git] / hooks / live
blob5973d2002f48e532c026332da6287ac4008332be
1 #!/bin/sh
3 # initramfs hook for live-initramfs (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-initramfs hook
27 # Handling live-initramfs
29 # Configuration
30 if [ -r /etc/live.conf ]
31 then
32 . /etc/live.conf
34 mkdir -p "${DESTDIR}"/etc
35 cp /etc/live.conf "${DESTDIR}"/etc
38 mkdir -p "${DESTDIR}"/usr/share/live-initramfs
39 cp /usr/share/live-initramfs/languagelist "${DESTDIR}"/usr/share/live-initramfs
41 # Directories
42 mkdir -p "${DESTDIR}"/lib/live-initramfs
44 # Executables
45 copy_exec /usr/share/live-initramfs/live-reconfigure /bin
46 copy_exec /usr/share/live-initramfs/live-preseed /bin
48 # Scripts
49 cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
50 cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts
52 # klibc dependencies
53 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
55 if [ ! -e "${DESTDIR}"/"${FILE}" ]
56 then
57 cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
59 done
61 # udev dependencies (squeeze and newer)
62 for FILE in /lib/udev/*_id
64 if [ ! -e "${DESTDIR}/${FILE}" ]
65 then
66 mkdir -p "${DESTDIR}/lib/udev"
67 copy_exec "${FILE}" /lib/udev
69 done
71 # Handling other stuff
73 # Configuration: keymap (usefull when using encryption)
74 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
75 then
76 copy_exec /bin/loadkeys /bin
78 mkdir -p "${DESTDIR}"/etc
79 cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
82 # Configuration: Unique ID
83 if [ -n "${LIVE_GENERATE_UUID}" ]
84 then
85 mkdir -p "${DESTDIR}"/conf
86 uuidgen -r > "${DESTDIR}"/conf/uuid.conf
89 # Filesystem: cifs
90 if [ -x /sbin/mount.cifs ]
91 then
92 copy_exec /sbin/mount.cifs /sbin
93 manual_add_modules cifs
96 # Filesystem: ext3/ext4
97 manual_add_modules ext3
98 manual_add_modules ext4
100 # Filesystem: jffs2
101 manual_add_modules jffs2
103 if [ -x /usr/bin/rsync ]
104 then
105 copy_exec /usr/bin/rsync /bin
108 # Filesystem: squashfs
109 copy_exec /sbin/losetup /sbin
110 manual_add_modules loop
111 manual_add_modules squashfs
112 manual_add_modules sqlzma
113 manual_add_modules unlzma
115 # Filesystem: aufs/unionfs
116 manual_add_modules aufs
117 manual_add_modules unionfs
119 # Filesystem: unionfs-fuse
120 if [ -x /usr/bin/unionfs-fuse ]
121 then
122 copy_exec /usr/bin/unionfs-fuse /bin
125 # Filesystem: vfat
126 manual_add_modules nls_cp437
127 manual_add_modules nls_iso8859-1
128 manual_add_modules nls_utf8
129 manual_add_modules vfat
131 # Filesystem: ntfs
132 manual_add_modules ntfs
134 # Hardware: cdrom
135 manual_add_modules ide-cd
136 manual_add_modules ide-generic
137 manual_add_modules ohci1394
138 manual_add_modules sbp2
139 manual_add_modules sr_mod
141 # Hardware: usb
142 manual_add_modules sd_mod
144 # Hardware: network
145 auto_add_modules net
147 # Program: eject
148 if [ -x /usr/bin/eject ]
149 then
150 copy_exec /usr/bin/eject /bin
153 # Program: md5sum
154 copy_exec /usr/bin/md5sum /bin
156 # Program: cpio
157 # busybox and klibc lacks --no-absolute-filenames and --sparse, needed for snapshots
158 if [ -e "${DESTDIR}/bin/cpio" ]
159 then
160 # Override already present cpio's, mostly klibc's
161 rm "${DESTDIR}/bin/cpio"
163 copy_exec /bin/cpio /bin
165 # Program: udev
166 if [ -x /sbin/udevadm ]
167 then
168 # lenny
169 copy_exec /sbin/udevadm /sbin
170 else
171 # etch
172 copy_exec /sbin/udevtrigger /sbin
173 copy_exec /sbin/udevsettle /sbin
175 if [ -x /usr/bin/udevinfo ]
176 then
177 copy_exec /usr/bin/udevinfo /bin
180 # Program: wget
181 if [ -x /usr/bin/wget ]
182 then
183 copy_exec /usr/bin/wget /bin
186 # Program: blockdev
187 if [ -x /sbin/blockdev ]
188 then
189 copy_exec /sbin/blockdev /sbin
192 # FUSE kernel module
193 manual_add_modules fuse
195 # FUSE filesystem: httpfs2
196 if [ -x /usr/bin/httpfs2_ssl ]
197 then
198 copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
199 elif [ -x /usr/bin/httpfs2 ]
200 then
201 copy_exec /usr/bin/httpfs2 /bin/httpfs
204 # FUSE filesystem: curlftpfs
205 if [ -x /usr/bin/curlftpfs ]
206 then
207 copy_exec /usr/bin/curlftpfs /bin