summaryrefslogtreecommitdiff
path: root/hooks/live
blob: aa7b020ac9eb117f7972b7785d522b2f67c7791f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/sh

# initramfs hook for live-initramfs (Debian Live)

set -e

# initramfs-tools header

PREREQ=""

prereqs()
{
	echo "${PREREQ}"
}

case "${1}" in
	prereqs)
		prereqs
		exit 0
		;;
esac

. /usr/share/initramfs-tools/hook-functions

# live-initramfs hook

# Handling live-initramfs

# Configuration
if [ -r /etc/live.conf ]
then
	. /etc/live.conf

	mkdir -p "${DESTDIR}"/etc
	cp /etc/live.conf "${DESTDIR}"/etc
fi

mkdir -p "${DESTDIR}"/usr/share/live-initramfs
cp /usr/share/live-initramfs/languagelist "${DESTDIR}"/usr/share/live-initramfs

# Directories
mkdir -p "${DESTDIR}"/lib/live-initramfs

# Executables
copy_exec /usr/share/live-initramfs/live-reconfigure /bin
copy_exec /usr/share/live-initramfs/live-preseed /bin

# Scripts
cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts

# klibc dependencies
for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
do
	if [ ! -e "${DESTDIR}"/"${FILE}" ]
	then
		cp -a "${FILE}" "${DESTDIR}"/"${FILE}"
	fi
done

# udev dependencies (squeeze and newer)
for FILE in /lib/udev/*_id
do
	if [ ! -e "${DESTDIR}/${FILE}" ]
	then
		mkdir -p "${DESTDIR}/lib/udev"
		copy_exec "${FILE}" /lib/udev
	fi
done

# Handling other stuff

# Configuration: keymap (usefull when using encryption)
if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
then
	copy_exec /bin/loadkeys /bin

	mkdir -p "${DESTDIR}"/etc
	cp /etc/console/boottime.kmap.gz "${DESTDIR}"/etc
fi

# Configuration: Unique ID
if [ -n "${LIVE_GENERATE_UUID}" ]
then
	mkdir -p "${DESTDIR}"/conf
	uuidgen -r > "${DESTDIR}"/conf/uuid.conf
fi

# Filesystem: cifs
if [ -x /sbin/mount.cifs ]
then
	copy_exec /sbin/mount.cifs /sbin
        manual_add_modules cifs
fi

# Filesystem: ext3/ext4
manual_add_modules ext3
manual_add_modules ext4

# Filesystem: jffs2
manual_add_modules jffs2

copy_exec /usr/bin/rsync /bin

# Filesystem: squashfs
copy_exec /sbin/losetup /sbin
manual_add_modules loop
manual_add_modules squashfs
manual_add_modules sqlzma
manual_add_modules unlzma

# Filesystem: aufs/unionfs
manual_add_modules aufs
manual_add_modules unionfs

# Filesystem: vfat
manual_add_modules nls_cp437
manual_add_modules nls_iso8859-1
manual_add_modules nls_utf8
manual_add_modules vfat

# Filesystem: ntfs
manual_add_modules ntfs

# Hardware: cdrom
manual_add_modules ide-cd
manual_add_modules ide-generic
manual_add_modules ohci1394
manual_add_modules sbp2
manual_add_modules sr_mod

# Hardware: usb
manual_add_modules sd_mod

# Hardware: network
auto_add_modules net

# Program: eject
if [ -x /usr/bin/eject ]
then
	copy_exec /usr/bin/eject /bin
fi

# Program: md5sum
copy_exec /usr/bin/md5sum /bin

# Program: cpio
# busybox and klibc lacks --no-absolute-filenames and --sparse, needed for snapshots
if [ -e "${DESTDIR}/bin/cpio" ]
then
	# Override already present cpio's, mostly klibc's
	rm "${DESTDIR}/bin/cpio"
fi
copy_exec /bin/cpio /bin

# Program: udev
if [ -x /sbin/udevadm ]
then
	# lenny
	copy_exec /sbin/udevadm /sbin
else
	# etch
	copy_exec /sbin/udevtrigger /sbin
	copy_exec /sbin/udevsettle /sbin
fi
if [ -x /usr/bin/udevinfo ]
then
	copy_exec /usr/bin/udevinfo /bin
fi

# Program: wget
if [ -x /usr/bin/wget ]
then
	copy_exec /usr/bin/wget /bin
fi

# Program: blockdev
if [ -x /sbin/blockdev ]
then
	copy_exec /sbin/blockdev /sbin
fi

# FUSE kernel module
manual_add_modules fuse

# FUSE filesystem: httpfs2
if [ -x /usr/bin/httpfs2_ssl ]
then
	copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
elif [ -x /usr/bin/httpfs2 ]
then
	copy_exec /usr/bin/httpfs2 /bin/httpfs
fi

# FUSE filesystem: curlftpfs
if [ -x /usr/bin/curlftpfs ]
then
	copy_exec /usr/bin/curlftpfs /bin
fi