Magellan Linux

Contents of /trunk/mlivecdbuild/mlivecdbuild2.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1821 - (show annotations) (download) (as text)
Tue May 29 11:08:26 2012 UTC (11 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 16980 byte(s)
-more systemd and dracut fixes and honor new pathes as well
1 #!/bin/bash
2
3 # some default settings - gets overidden with the profile config
4 CDPROFILE="$2"
5 [[ -z ${CDPROFILE} ]] && CDPROFILE="default"
6 LIVECDROOT="/mnt/MLIVECDBUILD/${CDPROFILE}"
7 CDCHROOTDIR="${LIVECDROOT}/chroot"
8 CDISONAME="livecd-${CDPROFILE}.iso"
9 CDISOROOT="${LIVECDROOT}/isoroot"
10 CDKERNELNAME="magelive"
11 CDHOSTNAME="livecd-${CDPROFILE}"
12 MAGERC="/etc/mage.rc"
13 MAGE_PROFILE="$(basename $(readlink /etc/mage-profile))"
14 #TOOLCHAIN=toolchain
15 BASESYSTEM=livecdsystem26
16 CDID="mlcd-$(date +%F-%k%M)"
17
18 # global profile pathes
19 PROFILES_DIR="/usr/lib/mlivecdbuild/profiles"
20 GLOBAL_PROFILE="${PROFILES_DIR}/global"
21
22 # get full path to isolinux.bin, may vary on multilib systems
23 if [[ -f /usr/share/syslinux/isolinux.bin ]]
24 then
25 ISOLINUX_BIN=/usr/share/syslinux/isolinux.bin
26 elif [[ -f /usr/lib64/mkinitrd/isolinux.bin ]]
27 then
28 ISOLINUX_BIN=/usr/lib64/mkinitrd/isolinux.bin
29 else
30 ISOLINUX_BIN=/usr/lib/mkinitrd/isolinux.bin
31 fi
32
33 die() { echo "ERROR: $@"; exit 1; }
34
35 # get_profile $filename
36 get_profile()
37 {
38 local file="$1"
39
40 if [[ -z ${file} ]] || [[ ! -e ${PROFILES_DIR}/${CDPROFILE}/${file} ]]
41 then
42 echo "${GLOBAL_PROFILE}/${file}"
43 return 0
44 fi
45
46 echo "${PROFILES_DIR}/${CDPROFILE}/${file}"
47 }
48
49 bootstrap_system()
50 {
51 mage-bootstrap \
52 --root "${CDCHROOTDIR}" \
53 --magerc "${MAGERC}" \
54 --profile "${MAGE_PROFILE}" \
55 --toolchain "${TOOLCHAIN}" \
56 --basesystem "${BASESYSTEM}" \
57 || die "bootstrapping toolchain"
58 }
59
60 custom_services()
61 {
62 local cmd="$1"
63 local services="$2"
64 local systemdcmd
65
66 case ${cmd} in
67 add|del|default)
68 # add given services from profile
69 if [[ -n ${services} ]]
70 then
71 local i
72 for i in ${services}
73 do
74 # systemd
75 if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] || [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]]
76 then
77 case ${cmd} in
78 add) chroot ${CDCHROOTDIR} systemctl enable ${i} ;;
79 del) chroot ${CDCHROOTDIR} systemctl disable ${i} ;;
80 default)
81 # convert targets
82 case ${i} in
83 2|3|multi-user) service="multi-user.target" ;;
84 5|graphical) service="graphical.target" ;;
85 esac
86 chroot ${CDCHROOTDIR} systemctl enable ${i} ;;
87 esac
88 fi
89 # busybox and sysvinit
90 if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]] && [[ ! -x ${CDCHROOTDIR}/bin/systemctl ]] && [[ ! -x ${CDCHROOTDIR}/usr/bin/systemctl ]]
91 then
92 MROOT="${CDCHROOTDIR}" rc-config ${cmd} ${i} || die "rc ${cmd} ${i}"
93 fi
94 done
95 fi
96 ;;
97 *) die "custom_services: unkown command ${cmd}";;
98 esac
99 }
100
101 add_initrc()
102 {
103 local var="$1"
104
105 # sanity checks
106 [[ -z ${CDCHROOTDIR} ]] && die "\$CDCHROOTDIR not given."
107 echo "${var}" >> ${CDCHROOTDIR}/.installrc || die "add_initrc() adding \$var"
108 }
109
110 custom_packages()
111 {
112 local cmd="$1"
113 local packages="$2"
114
115 case ${cmd} in
116 install|uninstall)
117 if [[ -n ${packages} ]]
118 then
119 :> ${CDCHROOTDIR}/.installrc
120
121 # respect proxies
122 [[ -n ${http_proxy} ]] && add_initrc "export http_proxy=${http_proxy}"
123 [[ -n ${ftp_proxy} ]] && add_initrc "export ftp_proxy=${ftp_proxy}"
124 [[ -n ${no_proxy} ]] && add_initrc "export no_proxy=${no_proxy}"
125
126 # do not auto-start any services!
127 add_initrc "export MAGE_BOOTSTRAP=true"
128 add_initrc 'die() { if [ $? -eq 1 ]; then echo "ERROR: $@"; exit 1; fi; }'
129
130 local i
131 for i in ${packages}
132 do
133 add_initrc "mage ${cmd} ${i} || die ${i}"
134 done
135 add_initrc "mage clean"
136
137 # now run the .installrc script
138 mount -t proc proc ${CDCHROOTDIR}/proc || die "mount proc"
139 mount -t sysfs sysfs ${CDCHROOTDIR}/sys || die "mount sys"
140 mount -o bind /dev ${CDCHROOTDIR}/dev || die "mount dev"
141 chroot ${CDCHROOTDIR} /bin/bash -i /.installrc || die "chr00ting"
142 umount ${CDCHROOTDIR}/dev || die "umount dev"
143 umount ${CDCHROOTDIR}/proc || die "umount proc"
144 umount ${CDCHROOTDIR}/sys || die "umount sys"
145 [ -f ${CDCHROOTDIR}/.installrc ] && rm ${CDCHROOTDIR}/.installrc
146 fi
147 ;;
148 *) die "custom_packages: unkown command ${cmd}";;
149 esac
150 }
151
152 read_config()
153 {
154 local file="$1"
155 local pkg
156
157 ( cat ${file}; echo ) | while read pkg
158 do
159 case "${pkg}" in
160 \#*|"") continue ;;
161 esac
162 echo "${pkg}"
163 done
164 }
165
166 prepare_iso()
167 {
168 echo Preparing LiveCD ISO Image ...
169
170 # fixes some issues with xfree/xorg xkb
171 if [[ -L ${CDCHROOTDIR}/etc/X11/xkb ]] &&
172 [[ -d ${CDCHROOTDIR}/usr/X11R6/lib/X11/xkb ]]
173 then
174 rm ${CDCHROOTDIR}/etc/X11/xkb || die
175 mv ${CDCHROOTDIR}/usr/X11R6/lib/X11/xkb ${CDCHROOTDIR}/etc/X11 || die
176 ln -s ../../../../etc/X11/xkb ${CDCHROOTDIR}/usr/X11R6/lib/X11/xkb || die
177 fi
178
179 # fix issues with >=dracut-014 which drops some default modules like livecd
180 if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] ||
181 [[ -x ${CDCHROOTDIR}/usr/sbin/dracut ]] ||
182 [[ -x ${CDCHROOTDIR}/usr/bin/dracut ]]
183 then
184 install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die
185 echo 'add_dracutmodules+=" dmsquash-live "' \
186 > ${CDCHROOTDIR}/etc/dracut.conf.d/02-livecd.conf || die
187 fi
188
189 # only on sysvinit or busybox systems
190 if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]]
191 then
192 install -m 0644 $(get_profile inittab) ${CDCHROOTDIR}/etc/inittab || die
193 fi
194 if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] || [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]]
195 then
196 # check lock group on systemd systems
197 if [[ -z $(chroot ${CDCHROOTDIR} getent group lock) ]]
198 then
199 echo "adding missing group 'lock'"
200 chroot ${CDCHROOTDIR} groupadd -g 54 lock
201 fi
202 # dbus plugdev group
203 if [[ -z $(chroot ${CDCHROOTDIR} getent group plugdev) ]]
204 then
205 echo "adding missing group 'plugdev'"
206 chroot ${CDCHROOTDIR} groupadd -g 302 plugdev
207 fi
208 # dbus messagebus group
209 if [[ -z $(chroot ${CDCHROOTDIR} getent group messagebus) ]]
210 then
211 echo "adding missing group 'messagebus'"
212 chroot ${CDCHROOTDIR} groupadd -g 300 messagebus
213 fi
214 # dbus messagebus user
215 if [[ -z $(chroot ${CDCHROOTDIR} getent passwd messagebus) ]]
216 then
217 echo "adding missing user 'messagebus'"
218 chroot ${CDCHROOTDIR} useradd -u 300 -g messagebus -d /dev/null -s /bin/false messagebus
219 fi
220 fi
221 install -m 0644 $(get_profile fstab) ${CDCHROOTDIR}/etc/fstab || die
222 install -m 0644 $(get_profile motd) ${CDCHROOTDIR}/etc/motd || die
223 install -m 0644 $(get_profile issue) ${CDCHROOTDIR}/etc/issue || die
224 install -m 0644 $(get_profile net.eth0) ${CDCHROOTDIR}/etc/conf.d/net.eth0 || die
225 echo "${CDHOSTNAME}" > ${CDCHROOTDIR}/etc/hostname || die
226 install -d ${CDCHROOTDIR}/mnt/magellan || die
227
228 echo Setting up services ...
229
230 # install systemd default services
231 if [[ -x ${CDCHROOTDIR}/bin/systemctl ]]
232 then
233 # install tmpfs /tmp and /var/tmp
234 install -m 0644 $(get_profile tmp.mount) ${CDCHROOTDIR}/lib/systemd/system/ || die
235 install -m 0644 $(get_profile var-tmp.mount) ${CDCHROOTDIR}/lib/systemd/system/ || die
236 # enable them
237 ln -snf ../tmp.mount ${CDCHROOTDIR}/lib/systemd/system/local-fs.target.wants/tmp.mount || die
238 ln -snf ../var-tmp.mount ${CDCHROOTDIR}/lib/systemd/system/local-fs.target.wants/var-tmp.mount || die
239 fi
240 # newer systemd goes to /usr/lib
241 if [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]]
242 then
243 # install tmpfs /tmp and /var/tmp
244 install -m 0644 $(get_profile tmp.mount) ${CDCHROOTDIR}/usr/lib/systemd/system/ || die
245 install -m 0644 $(get_profile var-tmp.mount) ${CDCHROOTDIR}/usr/lib/systemd/system/ || die
246 # enable them
247 ln -snf ../tmp.mount ${CDCHROOTDIR}/usr/lib/systemd/system/local-fs.target.wants/tmp.mount || die
248 ln -snf ../var-tmp.mount ${CDCHROOTDIR}/usr/lib/systemd/system/local-fs.target.wants/var-tmp.mount || die
249 fi
250
251 if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] || [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]]
252 then
253 install -m 0644 $(get_profile getty) ${CDCHROOTDIR}/etc/conf.d/getty || die
254
255 custom_services add getty@.service
256 custom_services add remote-fs.target
257 # disable readahead
258 custom_services del systemd-readahead-replay.service
259 custom_services del systemd-readahead-collect.service
260 fi
261
262 # # add hardware detection
263 # if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]]
264 # then
265 # MROOT="${CDCHROOTDIR}" rc-config add hwdetect || die "rc add hwdetect"
266 # fi
267
268 # del checkfs
269 if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]]
270 then
271 MROOT="${CDCHROOTDIR}" rc-config del checkfs || die "rc del checkfs"
272 fi
273
274 # add custom packages
275 [[ -n ${ADD_PACKAGES} ]] && custom_packages install "${ADD_PACKAGES}"
276 [ -f $(get_profile add_packages) ] && custom_packages install "$(read_config $(get_profile add_packages))"
277
278 # del custom packages
279 [[ -n ${DEL_PACKAGES} ]] && custom_packages uninstall "${DEL_PACKAGES}"
280 [ -f $(get_profile del_packages) ] && custom_packages uninstall "$(read_config $(get_profile del_packages))"
281
282 # add given services from profile
283 [[ -n ${ADD_SERVICES} ]] && custom_services add "${ADD_SERVICES}"
284 [ -f $(get_profile add_services) ] && custom_services add "$(read_config $(get_profile add_services))"
285
286 # del given services from profile
287 [[ -n ${DEL_SERVICES} ]] && custom_services del "${DEL_SERVICES}"
288 [ -f $(get_profile del_services) ] && custom_services del "$(read_config $(get_profile del_services))"
289
290 # setup default runlevel
291 [[ -n ${DEFAULT_RUNLEVEL} ]] && custom_services default "${DEFAULT_RUNLEVEL}"
292
293 if [ -f $(get_profile prepare_custom) ]
294 then
295 echo Running custom user script ...
296 source $(get_profile prepare_custom) || die "running custom user script"
297 fi
298
299 echo Cleaning unwanted files ...
300 # do this only if not a symlink!
301 if [[ ! -L ${CDCHROOTDIR}/etc/mtab ]]
302 then
303 :> ${CDCHROOTDIR}/etc/mtab || die "whiping /etc/mtab"
304 fi
305 [ -f ${CDCHROOTDIR}/root/.bash_history ] && rm ${CDCHROOTDIR}/root/.bash_history
306 }
307
308 generate_rootfs()
309 {
310 local loopdev
311 local size
312
313 if [ -f ${LIVECDROOT}/loop/LiveOS/ext3fs.img ]
314 then
315 rm ${LIVECDROOT}/loop/LiveOS/ext3fs.img || die
316 fi
317 if [ -f ${CDISOROOT}/LiveOS/squashfs.img ]
318 then
319 rm ${CDISOROOT}/LiveOS/squashfs.img
320 fi
321 if [ -f ${CDISOROOT}/livecdrootfs.sqsh ]
322 then
323 rm ${CDISOROOT}/livecdrootfs.sqsh
324 fi
325
326 echo Generating squashfs compressed rootfs loopfile ...
327 if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] ||
328 [[ -x ${CDCHROOTDIR}/usr/sbin/dracut ]] ||
329 [[ -x ${CDCHROOTDIR}/usr/bin/dracut ]]
330 then
331 install -d ${LIVECDROOT}/loop/{LiveOS,mnt} || die
332
333 # get the actual size of the chroot
334 size=$(du -s ${LIVECDROOT}/chroot | sed 's:^\(.*\)[[:space:]].*:\1:')
335
336 # generate a ext3fs file for devicemapper
337 dd if=/dev/zero of=${LIVECDROOT}/loop/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 10 )) || die
338 # create a filesystem
339 mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/loop/LiveOS/ext3fs.img || die
340 # set mount_counts and check_intervals to 0
341 # set dir_index top, to speed up thing with hashed b-trees
342 # allow acls too
343 tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/loop/LiveOS/ext3fs.img || die
344
345 # losetup the device
346 loopdev=$(losetup -f)
347 [[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?"
348
349 # mount the image
350 losetup ${loopdev} ${LIVECDROOT}/loop/LiveOS/ext3fs.img || die
351 mount ${loopdev} ${LIVECDROOT}/loop/mnt || die
352
353 # copy everything to the image file and preserve permissions
354 ( cd ${CDCHROOTDIR} && tar cpf - . ) | ( cd ${LIVECDROOT}/loop/mnt && tar xvpf - )
355
356 # now umount everything and create the squashfs image
357 umount ${LIVECDROOT}/loop/mnt || die
358 losetup -d ${loopdev} || die
359 # remove mount to not ending up in the squashfs image
360 if [[ -d ${LIVECDROOT}/loop/mnt ]]
361 then
362 rm -r ${LIVECDROOT}/loop/mnt || die
363 fi
364 mksquashfs ${LIVECDROOT}/loop ${LIVECDROOT}/livecdrootfs.sqsh || die
365
366 # final cleanup
367 if [[ -d ${LIVECDROOT}/loop ]]
368 then
369 rm -r ${LIVECDROOT}/loop || die
370 fi
371 else
372 mksquashfs ${CDCHROOTDIR} ${LIVECDROOT}/livecdrootfs.sqsh || die
373 fi
374
375 echo Moving rootfs loopfile to isoroot ...
376 install -d ${CDISOROOT}
377 if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] ||
378 [[ -x ${CDCHROOTDIR}/usr/sbin/dracut ]] ||
379 [[ -x ${CDCHROOTDIR}/usr/bin/dracut ]]
380 then
381 install -d ${CDISOROOT}/LiveOS
382 mv ${LIVECDROOT}/livecdrootfs.sqsh ${CDISOROOT}/LiveOS/squashfs.img
383 else
384 mv ${LIVECDROOT}/livecdrootfs.sqsh ${CDISOROOT}
385 fi
386 }
387
388 install_bootloader()
389 {
390 echo Installing Bootloader ...
391
392 # iso linux binary
393 install -d ${CDISOROOT}/isolinux
394 install ${ISOLINUX_BIN} ${CDISOROOT}/isolinux || die
395
396 # kernel
397 local kimg="$(basename $(readlink ${CDCHROOTDIR}/boot/vmlinuz))"
398 install ${CDCHROOTDIR}/boot/${kimg} ${CDISOROOT}/isolinux/${CDKERNELNAME} || die
399
400 install -m 0644 $(get_profile isolinux.cfg) ${CDISOROOT}/isolinux || die
401 install -m 0644 $(get_profile boot.lss) ${CDISOROOT}/isolinux || die
402 install -m 0644 $(get_profile boot.msg) ${CDISOROOT}/isolinux || die
403 install -m 0644 $(get_profile help.msg) ${CDISOROOT}/isolinux || die
404 # support the new layout too
405 if [[ -f $(get_profile index.msg) ]]
406 then
407 install -m 0644 $(get_profile index.msg) ${CDISOROOT}/isolinux || die
408 fi
409 if [[ -f $(get_profile debug.msg) ]]
410 then
411 install -m 0644 $(get_profile debug.msg) ${CDISOROOT}/isolinux || die
412 fi
413
414 return 0
415 }
416
417 generate_initrd()
418 {
419 local CHROOTSH="$(mktemp -p ${CDCHROOTDIR})"
420
421 is_loc_mounted "${CDCHROOTDIR}/sys" || mount -t sysfs sysfs ${CDCHROOTDIR}/sys
422 is_loc_mounted "${CDCHROOTDIR}/proc" || mount -t proc proc ${CDCHROOTDIR}/proc
423 is_loc_mounted "${CDCHROOTDIR}/dev" || mount -o bind /dev ${CDCHROOTDIR}/dev
424
425 echo Generating initrd image ...
426 echo '#!/bin/bash' > ${CHROOTSH} || die
427 echo 'export LC_ALL=C' >> ${CHROOTSH} || die
428 echo 'kv="$(readlink /boot/vmlinuz)"' >> ${CHROOTSH} || die
429 echo 'kv="${kv/kernel-}/"' >> ${CHROOTSH} || die
430 # prefer dracut
431 echo 'if [[ -x /sbin/dracut ]] || [[ -x /usr/sbin/dracut ]] || [[ -x /usr/bin/dracut ]]' >> ${CHROOTSH} || die
432 echo 'then' >> ${CHROOTSH} || die
433 echo ' dracut -v -f /initrd.gz ${kv}' >> ${CHROOTSH} || die
434 echo 'else' >> ${CHROOTSH} || die
435 echo ' mkinitrd-livecd -f --initramfs /initrd.gz ${kv}' >> ${CHROOTSH} || die
436 echo 'fi' >> ${CHROOTSH} || die
437 chmod +x ${CHROOTSH} || die
438 chroot ${CDCHROOTDIR} /$(basename ${CHROOTSH}) || die
439 [[ -f ${CHROOTSH} ]] && rm ${CHROOTSH} || die
440
441 is_loc_mounted "${CDCHROOTDIR}/dev" && umount ${CDCHROOTDIR}/dev
442 is_loc_mounted "${CDCHROOTDIR}/proc" && umount ${CDCHROOTDIR}/proc
443 is_loc_mounted "${CDCHROOTDIR}/sys" && umount ${CDCHROOTDIR}/sys
444
445 # move initrd to isoroot
446 install -d ${CDISOROOT}/isolinux || die
447 mv ${CDCHROOTDIR}/initrd.gz ${CDISOROOT}/isolinux || die
448 }
449
450 generate_iso()
451 {
452 echo Generating ISO Image ...
453 install -d ${CDISOROOT}
454 pushd ${CDISOROOT} &&
455 mkisofs -rock \
456 -full-iso9660-filenames \
457 -allow-leading-dots \
458 -disable-deep-relocation \
459 -output ${LIVECDROOT}/${CDISONAME} \
460 -eltorito-boot isolinux/isolinux.bin \
461 -eltorito-catalog isolinux/boot.cat \
462 -no-emul-boot \
463 -boot-load-size 4 \
464 -boot-info-table \
465 -volid "${CDID}" \
466 ${CDISOROOT} #&> /dev/null
467 popd
468 }
469
470 enter_livecd()
471 {
472 is_loc_mounted "${CDCHROOTDIR}/sys" || mount -t sysfs sysfs ${CDCHROOTDIR}/sys
473 is_loc_mounted "${CDCHROOTDIR}/proc" || mount -t proc proc ${CDCHROOTDIR}/proc
474 is_loc_mounted "${CDCHROOTDIR}/dev" || mount -o bind /dev ${CDCHROOTDIR}/dev
475
476 chroot ${CDCHROOTDIR} \
477 /usr/bin/env -i \
478 HOME=/root \
479 TERM=$TERM PS1='\u:\w\$ ' \
480 PATH=/bin:/usr/bin:/sbin:/usr/sbin \
481 http_proxy=${http_proxy} \
482 ftp_proxy=${ftp_proxy} \
483 no_proxy=${no_proxy} \
484 /bin/bash -i
485
486 is_loc_mounted "${CDCHROOTDIR}/dev" && umount ${CDCHROOTDIR}/dev
487 is_loc_mounted "${CDCHROOTDIR}/proc" && umount ${CDCHROOTDIR}/proc
488 is_loc_mounted "${CDCHROOTDIR}/sys" && umount ${CDCHROOTDIR}/sys
489 }
490
491 is_loc_mounted()
492 {
493 local filesys
494 local i
495 filesys=$1
496
497 i="$(cat /proc/mounts | grep " ${filesys} " | cut -d ' ' -f2)"
498 [[ ${i} != ${filesys} ]] && return 1
499
500 return 0
501 }
502
503 trap_exit()
504 {
505 is_loc_mounted "${CDCHROOTDIR}/dev" && umount ${CDCHROOTDIR}/dev
506 is_loc_mounted "${CDCHROOTDIR}/proc" && umount ${CDCHROOTDIR}/proc
507 is_loc_mounted "${CDCHROOTDIR}/sys" && umount ${CDCHROOTDIR}/sys
508 }
509
510 usage()
511 {
512 echo "Usage: $(basename $0) [command] [profile] ..."
513 echo
514 echo "Commands:"
515 echo " bootstrap - bootstraps the rootfs for the livecd"
516 echo " prepare - prepare the rootfs to run from a livecd"
517 echo " rootfs - generates the squashfs rootfs image"
518 echo " initrd - generates a livecd suitable initrd"
519 echo " bootloader - installs the bootloader"
520 echo " isogen - generate the final livecd iso image"
521 echo " all - runs all tasks to get a livecd from zero"
522 echo " enter - enters the rootfs of a livecd"
523 echo
524 echo " for example '$(basename $0) all default'"
525 echo " creates a livecd using the default profile."
526 echo
527 }
528
529 # set some proper traps
530 trap "trap_exit" SIGINT SIGQUIT
531
532 # source profile config - overrides all other vars
533 [ -f ${PROFILES_DIR}/${CDPROFILE}/config ] && . ${PROFILES_DIR}/${CDPROFILE}/config
534
535 case $1 in
536 bootstrap) bootstrap_system;;
537 prepare) prepare_iso;;
538 rootfs) generate_rootfs;;
539 initrd) generate_initrd;;
540 bootloader) install_bootloader;;
541 isogen) generate_iso;;
542 all)
543 bootstrap_system
544 prepare_iso
545 generate_rootfs
546 generate_initrd
547 install_bootloader
548 generate_iso
549 ;;
550 enter) enter_livecd ;;
551 *|'') usage;;
552 esac