blob: 7258b6af11f537e87018f564d09ecc76a02e5f51 (
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
#!/bin/sh
# make-live - utility to build Debian Live systems
#
# Copyright (C) 2006 Daniel Baumann <daniel@debian.org>
# Copyright (C) 2006 Marco Amadori <marco.amadori@gmail.com>
#
# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.
Indices ()
{
case "${1}" in
custom)
# Configure custom sources.list
case "${LIVE_DISTRIBUTION}" in
oldstable)
echo "deb ${LIVE_MIRROR} oldstable ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR} oldstable ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb ${LIVE_MIRROR_SECURITY} oldstable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR_SECURITY} oldstable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
;;
stable)
echo "deb ${LIVE_MIRROR} stable ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR} stable ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb ${LIVE_MIRROR_SECURITY} stable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR_SECURITY} stable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
;;
testing)
echo "deb ${LIVE_MIRROR} testing ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR} testing ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb ${LIVE_MIRROR_SECURITY} testing/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR_SECURITY} testing/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
;;
unstable)
echo "deb ${LIVE_MIRROR} unstable ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR} unstable ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ]
then
echo "deb ${LIVE_MIRROR} experimental ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src ${LIVE_MIRROR} experimental ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
cat > "${LIVE_CHROOT}"/etc/apt/preferences << EOF
Package: *
Pin: release a=experimental
Pin-Priority: 999
EOF
fi
;;
esac
;;
default)
# Configure default sources.list
case "${LIVE_DISTRIBUTION}" in
oldstable)
echo "deb http://ftp.debian.org/debian/ oldstable ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ oldstable ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb http://security.debian.org/ oldstable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://security.debian.org/ oldstable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
;;
stable)
echo "deb http://ftp.debian.org/debian/ stable ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ stable ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb http://security.debian.org/ stable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://security.debian.org/ stable/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
;;
testing)
echo "deb http://ftp.debian.org/debian/ testing ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ testing ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb http://security.debian.org/ testing/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://security.debian.org/ testing/updates ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
;;
unstable)
echo "deb http://ftp.debian.org/debian/ unstable ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ unstable ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ]
then
echo "deb http://ftp.debian.org/debian/ experimental ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ experimental ${LIVE_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
fi
;;
esac
;;
esac
# Update indices
Chroot_exec "apt-get update"
if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ]
then
# experimental is sometimes broken,
# therefore this is intentionally kept interactive.
Chroot_exec "apt-get upgrade" || return 0
Chroot_exec "apt-get dist-upgrade" || return 0
fi
}
Genrootfs ()
{
case "${LIVE_FILESYSTEM}" in
ext2)
DU_DIM="`du -ks ${LIVE_CHROOT} | cut -f1`"
REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.ext2
;;
plain)
cd "${LIVE_CHROOT}"
find . | cpio -pumd "${LIVE_ROOT}"/binary/casper/filesystem.dir
cd "${OLDPWD}"
;;
squashfs)
if [ -f "${LIVE_ROOT}"/binary/casper/filesystem.squashfs ]
then
rm "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
fi
mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
;;
esac
}
Syslinux ()
{
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
# Install syslinux
Patch_network apply
Chroot_exec "apt-get install --yes --force-yes syslinux"
case "${1}" in
iso)
# Copy syslinux
mkdir -p "${LIVE_ROOT}"/binary/isolinux
cp "${LIVE_CHROOT}"/usr/lib/syslinux/isolinux.bin "${LIVE_ROOT}"/binary/isolinux
# Install syslinux templates
cp -r "${LIVE_TEMPLATES}"/syslinux/* \
"${LIVE_ROOT}"/binary/isolinux
rm -f "${LIVE_ROOT}"/binary/isolinux/pxelinux.cfg
# Configure syslinux templates
sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg
sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" "${LIVE_ROOT}"/binary/isolinux/f1.txt
sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/binary/isolinux/f10.txt
;;
net)
# Copy syslinux
mkdir -p "${LIVE_ROOT}"/tftpboot
cp "${LIVE_ROOT}"/chroot/usr/lib/syslinux/pxelinux.0 "${LIVE_ROOT}"/tftpboot
# Install syslinux templates
mkdir -p "${LIVE_ROOT}"/tftpboot/pxelinux.cfg
cp -r "${LIVE_TEMPLATES}"/syslinux/* \
"${LIVE_ROOT}"/tftpboot/pxelinux.cfg
mv "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/pxelinux.cfg "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/default
rm -f "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.cfg
sed -i -e 's#splash.rle#pxelinux.cfg/splash.rle#' "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.txt
# Configure syslinux templates
sed -i -e "s/LIVE_SERVER_ADDRESS/${LIVE_SERVER_ADDRESS}/" -e "s#LIVE_SERVER_PATH#${LIVE_SERVER_PATH}#" -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/default
sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/f1.txt
sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/f10.txt
;;
esac
# Remove syslinux
Chroot_exec "apt-get remove --purge --yes syslinux"
Patch_network deapply
fi
}
Linuximage ()
{
case "${1}" in
iso)
# Copy linux-image
if [ "${LIVE_FLAVOUR}" = "minimal" ]
then
mv "${LIVE_CHROOT}"/boot/vmlinuz-* "${LIVE_ROOT}"/binary/isolinux/vmlinuz
mv "${LIVE_CHROOT}"/boot/initrd.img-* "${LIVE_ROOT}"/binary/isolinux/initrd.gz
else
cp "${LIVE_CHROOT}"/boot/vmlinuz-* "${LIVE_ROOT}"/binary/isolinux/vmlinuz
cp "${LIVE_CHROOT}"/boot/initrd.img-* "${LIVE_ROOT}"/binary/isolinux/initrd.gz
fi
;;
net)
# Copy linux-image
if [ "${LIVE_FLAVOUR}" = "minimal" ]
then
mv "${LIVE_ROOT}"/chroot/boot/vmlinuz-* "${LIVE_ROOT}"/tftpboot/vmlinuz
mv "${LIVE_ROOT}"/chroot/boot/initrd.img-* "${LIVE_ROOT}"/tftpboot/initrd.gz
else
cp "${LIVE_ROOT}"/chroot/boot/vmlinuz-* "${LIVE_ROOT}"/tftpboot/vmlinuz
cp "${LIVE_ROOT}"/chroot/boot/initrd.img-* "${LIVE_ROOT}"/tftpboot/initrd.gz
fi
;;
esac
}
Memtest ()
{
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
# Install memtest
Patch_network apply
Chroot_exec "apt-get install --yes --force-yes memtest86+"
case "$1" in
iso)
# Copy memtest
cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${LIVE_ROOT}"/binary/isolinux/memtest
;;
net)
# Copy memtest
cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${LIVE_ROOT}"/tftpboot/memtest
;;
esac
# Remove memtest
Chroot_exec "apt-get remove --purge --yes memtest86+"
Patch_network deapply
fi
}
Md5sum ()
{
# Calculating md5sums
cd "${LIVE_ROOT}"/binary
find . -type f -print0 | xargs -0 md5sum > "${LIVE_ROOT}"/md5sum.txt
cd "${OLDPWD}"
if [ -d "${LIVE_INCLUDE_IMAGE}" ]
then
cd "${LIVE_INCLUDE_IMAGE}"
find . -type f -print0 | xargs -0 md5sum >> "${LIVE_ROOT}"/md5sum.txt
cd "${OLDPWD}"
fi
mv "${LIVE_ROOT}"/md5sum.txt "${LIVE_ROOT}"/binary
}
Mkisofs ()
{
case "${1}" in
binary)
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
# Create image
mkisofs -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "Debian Live `date +%Y%m%d`" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE}
else
echo "W: Bootloader on your architecture not yet supported (Continuing in 5 seconds)."
sleep 5
# Create image
mkisofs -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "Debian Live `date +%Y%m%d`" "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE}
fi
;;
source)
# Create image
mkisofs -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"source.iso -r -J -l -V "Debian Live `date +%Y%m%d`" "${LIVE_ROOT}"/source
;;
esac
}
Sources ()
{
# Download sources
Chroot_exec "dpkg --get-selections" | awk '{ print $1 }' > "${LIVE_CHROOT}"/root/dpkg-selection.txt
Chroot_exec "xargs --arg-file=/root/dpkg-selection.txt apt-get source --download-only"
rm -f "${LIVE_CHROOT}"/root/dpkg-selection.txt
# Sort sources
for DSC in "${LIVE_CHROOT}"/*.dsc
do
SOURCE="`awk '/Source:/ { print $2; }' ${DSC}`"
if [ "`echo ${SOURCE} | cut -b 1-3`" == "lib" ]
then
LETTER="`echo ${SOURCE} | cut -b 1-4`"
else
LETTER="`echo ${SOURCE} | cut -b 1`"
fi
# Install directory
install -d -m 0755 "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
# Move sources
mv "${LIVE_CHROOT}"/"${SOURCE}"_* "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
done
}
|