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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
#!/bin/sh
# make-live(1) - utility to build Debian Live systems
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# On Debian systems, the complete text of the GNU General Public License
# can be found in /usr/share/common-licenses/GPL file.
set -e
# Source common functions
for FUNCTION in /usr/share/live-helper/functions/*.sh
do
. ${FUNCTION}
done
# Set static variables
PROGRAM="`basename ${0}`"
DESCRIPTION="utility to build Debian Live systems"
USAGE="${PROGRAM} [config] [--mode MODE] [--config CONFIG] [--apt apt|aptitude] [--apt-ftpproxy URL] [--apt-httpproxy URL] [--apt-generic enabled|disabled] [--apt-pdiffs enabled|disabled] [--apt-recommends enabled|disabled] [--apt-secure enabled|disabled] [--bootstrap cdebootstrap|deboostrap] [--cache enabled|disabled] [--debconf-frontend dialog|readline|noninteractive] [--debconf-priority low|medium|high|critical] [--debconf-nowarnings yes|no] [--genisoimage genisoimage|mkisofs] [--losetup losetup|losetup.org] [--tasksel aptitude|tasksel] [-r|--root DIRECTORY] [-a|--architecture ARCHITECTURE] [-d|--distribution stable|testing|unstable|etch|lenny|sid] [--distribution-config DIRECTORY] [-f|--bootstrap-flavour minimal|standard] [-m|--mirror-bootstrap URL] [--mirror-bootstrap-security URL] [--mirror-binary URL] [--mirror-binary-security URL] [--sections SECTION|\"SECTIONS\"] [--interactive shell|x11|xnest] [-k|--linux-flavour FLAVOUR] [--linux-packages PACKAGE|\"PACKAGES\"] [--keyring-packages PACKAGE|\"PACKAGES\"] [--hooks \"COMMAND\"|\"COMMANDS\"] [-l|--language LANGUAGE] [--packages PACKAGE|\"PACKAGES\"] [-p|--packages-lists LIST|\"LISTS\"] [--tasks TASK|\"TASKS\"] [--security enabled|disabled] [--symlinks enabled|disabled] [--sysvinit enabled|disabled] [--bootappend BOOT_PARAMETER|\"BOOT_PARAMETERS\"] [-e|--encryption ALGORITHM] [--username NAME] [--hostname NAME] [--chroot-filesystem ext2|plain|squashfs] [--memtest memtest86|memtest86+] [--iso-volume STRING] [--net-server HOSTNAME|IP] [--net-path DIRECTORY] [--source enabled|disabled] [--bootloader grub|syslinux] [--grub-splash FILE] [--syslinux-splash FILE] [-b|--binary-images hdd|iso|usb-hdd|net] [-s|--source-images generic|hdd|iso|usb-hdd|net] [--includes PATH] [--templates PATH] [--breakpoints] [--debug] [--force] [--quiet] [--verbose] [--root-command sudo]"
HELP="Lists: gnome, gnome-core, gnome-desktop, gnome-full, gnome-junior, gnustep, kde, kde-core, kde-desktop, kde-extra, kde-full, kde-junior, mini, minimal, minimal-net, rescue, standard, standard-x11, xfce, xfce-desktop, xfce-junior"
Local_arguments ()
{
ARGUMENTS="`getopt --longoptions mode:,config:,apt:,apt-ftpproxy:,apt-httpproxy:,apt-generic:,apt-pdiffs:,apt-recommends:,apt-secure:,bootstrap:,cache:,debconf-frontend:,debconf-priority:,debconf-nowarnings:,genisoimage:,losetup:,tasksel:,root:,architecture:,distribution:,distribution-config:,flavour:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,interactive:,kernel:,kernel-packages:,keyring-packages:,hooks:,language:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,bootappend:,encryption:,username:,hostname:,chroot-filesystem:,memtest:,iso-volume:,server-address:,server-path:,source:,bootloader:,grub-splash:,syslinux-splash:,binary-images:,binary-source:,includes:,templates:,help,usage,version,force,breakpoints,debug,quiet,verbose,root-command: --name=${PROGRAM} --options r:a:d:f:m:k:l:p:e:b:s:huv --shell sh -- "${@}"`"
if [ "${?}" != "0" ]
then
echo "Terminating." >&2
exit 1
fi
if [ "${1}" = "config" ]
then
CONFIG="true"
fi
eval set -- "${ARGUMENTS}"
while true
do
case "${1}" in
# common
--mode)
LH_MODE="${2}"; shift 2
;;
--config)
LH_CONFIG="${2}"; shift 2
;;
--apt)
LH_APT="${2}"; shift 2
;;
--apt-ftpproxy)
LH_APT_FTPPROXY="${2}"; shift 2
;;
--apt-httpproxy)
LH_APT_HTTPPROXY="${2}"; shift 2
;;
--apt-generic)
LH_APT_GENERIC="${2}"; shift 2
;;
--apt-pdiffs)
LH_APT_PDIFFS="${2}"; shift 2
;;
--apt-recommends)
LH_APT_RECOMMENDS="${2}"; shift 2
;;
--apt-secure)
LH_APT_SECURE="${2}"; shift 2
;;
--bootstrap)
LH_BOOTSTRAP="${2}"; shift 2
;;
--cache)
LH_CACHE="${2}"; shift 2
;;
--debconf-frontend)
LH_DEBCONF_FRONTEND="${2}"; shift 2
;;
--debconf-priority)
LH_DEBCONF_PRIORITY="${2}"; shift 2
;;
--debconf-nowarnings)
LH_DEBCONF_NOWARNINGS="${2}"; shift 2
;;
--genisoimage)
LH_GENISOIMAGE="${2}"; shift 2
;;
--losetup)
LH_LOSETUP="${2}"; shift 2
;;
--tasksel)
LH_TASKSEL="${2}"; shift 2
;;
-r|--root)
LIVE_ROOT="${2}"; shift 2
;;
--root-command)
LIVE_ROOT_COMMAND="${2}"; shift 2
;;
# bootstrap
-a|--architecture)
LIVE_ARCHITECTURE="${2}"; shift 2
;;
-d|--distribution)
LIVE_DISTRIBUTION="${2}"; shift 2
export LIVE_DISTRIBUTION
;;
--distribution-config)
LIVE_DISTRIBUTION_CONFIG="${2}"; shift 2
;;
-f|--bootstrap-flavour)
LIVE_BOOTSTRAP_FLAVOUR="${2}"; shift 2
;;
-m|--mirror-bootstrap)
LIVE_MIRROR_BOOTSTRAP="${2}"; shift 2
;;
--mirror-bootstrap-security)
LIVE_MIRROR_BOOTSTRAP_SECURITY="${2}"; shift 2
;;
--mirror-binary)
LIVE_MIRROR_BINARY="${2}"; shift 2
;;
--mirror-binary-security)
LIVE_MIRROR_BINARY_SECURITY="${2}"; shift 2
;;
--sections)
LIVE_SECTIONS="${2}"; shift 2
;;
# chroot
--interactive)
LIVE_INTERACTIVE="${2}"; shift 2
;;
-k|--linux-flavours)
LIVE_LINUX_FLAVOURS="${2}"; shift 2
;;
--linux-packages)
LIVE_LINUX_PACKAGES="${2}"; shift 2
;;
--keyring-packages)
LIVE_KEYRING_PACKAGS="${2}"; shift 2
;;
--hooks)
LIVE_HOOKS="${2}"; shift 2
;;
-l|--language)
LIVE_LANGUAGE="${2}"; shift 2
;;
--packages)
LIVE_PACKAGES="${2}"; shift 2
;;
-p|--packages-lists)
LIVE_PACKAGES_LISTS="${2}"; shift 2
;;
--tasks)
LIVE_TASKS="${2}"; shift 2
;;
--security)
LIVE_SECURITY="${2}"; shift 2
;;
--symlinks)
LIVE_SYMLINKS="${2}"; shift 2
;;
--sysvinit)
LIVE_SYSVINIT="${2}"; shift 2
;;
# image
--bootappend)
LIVE_BOOTAPPEND="${2}"; shift 2
;;
-e|--encryption)
LIVE_ENCRYPTION="${2}"; shift 2
;;
--username)
LIVE_USERNAME="${2}"; shift 2
;;
--hostname)
LIVE_HOSTNAME="${2}"; shift 2
;;
--chroot-filesystem)
LIVE_CHROOT_FILESYSTEM="${2}"; shift 2
;;
--memtest)
LIVE_MEMTEST="${2}"; shift 2
;;
--iso-volume)
LIVE_ISO_VOLUME="${2}"; shift 2
;;
--net-server)
LIVE_NET_SERVER="${2}"; shift 2
;;
--net-path)
LIVE_NET_PATH="${2}"; shift 2
;;
--source)
LIVE_SOURCE="${2}"; shift 2
;;
--bootloader)
LIVE_BOOTLOADER="${2}"; shift 2
;;
--grub-splash)
LIVE_GRUB_SPLASH="${2}"; shift 2
;;
--syslinux-splash)
LIVE_SYSLINUX_SPLASH="${2}"; shift 2
;;
-b|--binary-images)
LIVE_BINARY_IMAGES="${2}"; shift 2
;;
-s|--source-images)
LIVE_SOURCE_IMAGES="${2}"; shift 2
;;
--includes)
LIVE_INCLUDES="${2}"; shift 2
;;
--templates)
LIVE_TEMPLATES="${2}"; shift 2
;;
# other
-h|--help)
Help; shift
;;
-u|--usage)
Usage; shift
;;
-v|--version)
Version; shift
;;
--breakpoints)
LH_BREAKPOINTS="enabled"; shift
;;
--debug)
LH_DEBUG="enabled"; shift
;;
--force)
LH_FORCE="enabled"; shift
;;
--quiet)
LH_QUIET="enabled"; shift
;;
--verbose)
LH_VERBOSE="enabled"; shift
;;
--)
shift; break
;;
*)
echo "Internal error."
exit 1
;;
esac
done
}
Main ()
{
Local_arguments "${@}"
Set_defaults
if [ -z "${ROOT}" ]
then
ROOT="${LIVE_ROOT}"
fi
# Source existing configuration
Read_conffile "${ROOT}"/config/common
Read_conffile "${ROOT}"/config/bootstrap
Read_conffile "${ROOT}"/config/chroot
Read_conffile "${ROOT}"/config/image
Local_arguments "${@}"
# Configuring (this is really shit!)
LH_MODE="${LH_MODE}" LH_CONFIG="${LH_CONFIG}" LH_APT="${LH_APT}" LH_APT_FTPPROXY="${LH_APT_FTPPROXY}" LH_APT_HTTPPROXY="${LH_APT_HTTPPROXY}" LH_APT_GENERIC="${LH_APT_GENERIC}" LH_APT_PDIFFS="${LH_APT_PDIFFS}" LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}" LH_APT_SECURE="${LH_APT_SECURE}" LH_BOOTSTRAP="${LH_BOOTSTRAP}" LH_CACHE="${LH_CACHE}" LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" LH_DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" LH_GENISOIMAGE="${LH_GENISOIMAGE}" LH_LOSETUP="${LH_LOSETUP}" LH_TASKSEL="${LH_TASKSEL}" LIVE_ROOT="${LIVE_ROOT}" LIVE_ARCHITECTURE="${LIVE_ARCHITECTURE}" LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}" LIVE_BOOTSTRAP_FLAVOUR="${LIVE_BOOTSTRAP_FLAVOUR}" LIVE_MIRROR_BOOTSTRAP="${LIVE_MIRROR_BOOTSTRAP}" LIVE_MIRROR_BOOTSTRAP_SECURITY="${LIVE_MIRROR_BOOTSTRAP_SECURITY}" LIVE_MIRROR_BINARY="${LIVE_MIRROR_BINARY}" LIVE_MIRROR_BINARY_SECURITY="${LIVE_MIRROR_BINARY_SECURITY}" LIVE_SECTIONS="${LIVE_SECTIONS}" LIVE_INTERACTIVE="${LIVE_INTERACTIVE}" LIVE_LINUX_FLAVOURS="${LIVE_LINUX_FLAVOURS}" LIVE_LINUX_PACKAGES="${LIVE_LINUX_PACKAGES}" LIVE_KEYRING_PACKAGES="${LIVE_KEYRING_PACKAGES}" LIVE_HOOKS="${LIVE_HOOKS}" LIVE_LANGUAGE="${LIVE_LANGUAGE}" LIVE_PACKAGES="${LIVE_PACKAGES}" LIVE_PACKAGES_LISTS="${LIVE_PACKAGES_LISTS}" LIVE_TASKS="${LIVE_TASKS}" LIVE_SECURITY="${LIVE_SECURITY}" LIVE_SYMLINKS="${LIVE_SYMLINKS}" LIVE_SYSVINIT="${LIVE_SYSVINIT}" LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND}" LIVE_ENCRYPTION="${LIVE_ENCRYPTION}" LIVE_USERNAME="${LIVE_USERNAME}" LIVE_HOSTNAME="${LIVE_HOSTNAME}" LIVE_CHROOT_FILESYSTEM="${LIVE_CHROOT_FILESYSTEM}" LIVE_MEMTEST="${LIVE_MEMTEST}" LIVE_ISO_VOLUME="${LIVE_ISO_VOLUME}" LIVE_NET_SERVER="${LIVE_NET_SERVER}" LIVE_NET_PATH="${LIVE_NET_PATH}" LIVE_SOURCE="${LIVE_SOURCE}" LIVE_BOOTLOADER="${LIVE_BOOTLOADER}" LIVE_GRUB_SPLASH="${LIVE_GRUB_SPLASH}" LIVE_SYSLINUX_SPLASH="${LIVE_SYSLINUX_SPLASH}" LIVE_BINARY_IMAGES="${LIVE_BINARY_IMAGES}" LIVE_SOURCE_IMAGES="${LIVE_SOURCE_IMAGES}" LIVE_INCLUDES="${LIVE_INCLUDES}" LIVE_TEMPLATES="${LIVE_TEMPLATES}" LH_ROOT_COMMAND="${LH_ROOT_COMMAND}" lh_config newconfig
if [ "${LH_BREAKPOINTS}" = "enabled" ]
then
OPTIONS="${OPTIONS} --breakpoints"
fi
if [ "${LH_DEBUG}" = "enabled" ]
then
OPTIONS="${OPTIONS} --debug"
fi
if [ "${LH_FORCE}" = "enabled" ]
then
OPTIONS="${OPTIONS} --force"
fi
if [ "${LH_QUIET}" = "enabled" ]
then
OPTIONS="${OPTIONS} --quiet"
fi
if [ "${LH_VERBOSE}" = "enabled" ]
then
OPTIONS="${OPTIONS} --verbose"
fi
# Building
if [ -z "${CONFIG}" ]
then
cd "${LIVE_ROOT}" && lh_build "${OPTIONS}"
fi
}
trap "if [ -f ${ROOT}/chroot/proc/version ]; then umount ${ROOT}/chroot/proc; fi; \
if [ -f ${ROOT}/chroot/sys/kernel ]; then umount ${ROOT}/chroot/sys; fi; exit" \
0 1 2 3 9 15
Main "${@}"
|