10_support_ethdevice.dpatch: support setting NIC name via ethdevice
[live-initramfs-grml.git] / hooks / live
1 #!/bin/sh
2
3 # initramfs hook for live-initramfs (Debian Live)
4
5 set -e
6
7 # initramfs-tools header
8
9 PREREQ=""
10
11 prereqs()
12 {
13         echo "${PREREQ}"
14 }
15
16 case "${1}" in
17         prereqs)
18                 prereqs
19                 exit 0
20                 ;;
21 esac
22
23 . /usr/share/initramfs-tools/hook-functions
24
25 # live-initramfs hook
26
27 # Handling live-initramfs
28
29 # Configuration
30 if [ -r /etc/live.conf ]
31 then
32         . /etc/live.conf
33
34         mkdir -p "${DESTDIR}"/etc
35         cp /etc/live.conf "${DESTDIR}"/etc
36 fi
37
38 # Directories
39 mkdir -p "${DESTDIR}"/lib/live-initramfs
40
41 # Executables
42 copy_exec /usr/share/live-initramfs/live-reconfigure /bin
43 copy_exec /usr/share/live-initramfs/live-preseed /bin
44
45 # Scripts
46 cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
47 cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts
48
49 # klibc dependencies
50 for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
51 do
52         if [ ! -e "${DESTDIR}"/"${FILE}" ]
53         then
54                 cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
55         fi
56 done
57
58 # Handling other stuff
59
60 # Configuration: keymap (usefull when using encryption)
61 if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
62 then
63         copy_exec /bin/loadkeys /bin
64
65         mkdir -p "${DESTDIR}"/etc
66         cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
67 fi
68
69 # Configuration: Unique ID
70 if [ -n "${LIVE_GENERATE_UUID}" ]
71 then
72         mkdir -p "${DESTDIR}"/conf
73         uuidgen -r > "${DESTDIR}"/conf/uuid.conf
74 fi
75
76 # Filesystem: cifs
77 if [ -x /sbin/mount.cifs ]
78 then
79         copy_exec /sbin/mount.cifs /sbin
80         manual_add_modules cifs
81 fi
82
83 # Filesystem: ext3/ext4
84 manual_add_modules ext3
85 manual_add_modules ext4
86
87 # Filesystem: jffs2
88 manual_add_modules jffs2
89
90 # Filesystem: squashfs
91 copy_exec /sbin/losetup /sbin
92 manual_add_modules loop
93 manual_add_modules squashfs
94 manual_add_modules sqlzma
95 manual_add_modules unlzma
96
97 # Filesystem: aufs/unionfs
98 manual_add_modules aufs
99 manual_add_modules unionfs
100
101 # Filesystem: vfat
102 manual_add_modules nls_cp437
103 manual_add_modules nls_iso8859-1
104 manual_add_modules nls_utf8
105 manual_add_modules vfat
106
107 # Filesystem: ntfs
108 manual_add_modules ntfs
109
110 # Hardware: cdrom
111 manual_add_modules ide-cd
112 manual_add_modules ide-generic
113 manual_add_modules ohci1394
114 manual_add_modules sbp2
115 manual_add_modules sr_mod
116
117 # Hardware: usb
118 manual_add_modules sd_mod
119
120 # Hardware: network
121 auto_add_modules net
122
123 # Program: eject
124 if [ -x /usr/bin/eject ]
125 then
126         copy_exec /usr/bin/eject /bin
127 fi
128
129 # Program: md5sum
130 copy_exec /usr/bin/md5sum /bin
131
132 # Program: cpio
133 # busybox and klibc lacks --no-absolute-filenames and --sparse, needed for snapshots
134 if [ -e "${DESTDIR}/bin/cpio" ]
135 then
136         # Override already present cpio's, mostly klibc's
137         rm "${DESTDIR}/bin/cpio"
138 fi
139 copy_exec /bin/cpio /bin
140
141 # Program: udev
142 if [ -x /sbin/udevadm ]
143 then
144         # lenny
145         copy_exec /sbin/udevadm /sbin
146 else
147         # etch
148         copy_exec /sbin/udevtrigger /sbin
149         copy_exec /sbin/udevsettle /sbin
150 fi
151 if [ -x /usr/bin/udevinfo ]
152 then
153         copy_exec /usr/bin/udevinfo /bin
154 fi
155
156 # Program: wget
157 if [ -x /usr/bin/wget ]
158 then
159         copy_exec /usr/bin/wget /bin
160 fi
161
162 # FUSE kernel module
163 manual_add_modules fuse
164
165 # FUSE filesystem: httpfs2
166 if [ -x /usr/bin/httpfs2_ssl ]
167 then
168         copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
169 elif [ -x /usr/bin/httpfs2 ]
170 then
171         copy_exec /usr/bin/httpfs2 /bin/httpfs
172 fi
173
174 # FUSE filesystem: curlftpfs
175 if [ -x /usr/bin/curlftpfs ]
176 then
177         copy_exec /usr/bin/curlftpfs /bin
178 fi