2 # Filename: grml-live-remaster
3 # Purpose: remaster a grml from the live cd
4 # Authors: grml-team (grml.org), (c) Michael Schierl <schierlm@gmx.de>, (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 # Latest change: Sun Feb 24 14:23:27 CET 2008 [mika]
8 ################################################################################
10 # this script currently lacks LOTS of error checking code... any help welcome...
11 ################################################################################
13 set -e # exit on any error
17 # source core functions {{{
18 . /etc/grml/lsb-functions
19 . /etc/grml/script-functions
22 # make sure we have what we need {{{
23 check4progs mkisofs mksquashfs || exit 1
27 if [ x"$1" == x ]; then
28 echo "$0 - version $VERSION"
30 echo "Usage: $0 destination.iso"
31 echo " destination.iso should point to a path that is on a hard disk,"
32 echo " you might want to mount some swap partitions or swap files"
33 echo " first, because grml-live-remaster will need a lot ot RAM."
35 echo "Please report bugs and feature requests: http://grml.org/bugs/"
39 if [ ! -d /remaster ]; then
40 mkdir -p /remaster/chroot /remaster/tmp /remaster/cdrom
41 mount -t tmpfs tmpfs /remaster/tmp
42 echo "#:# edit the following two lines to change the boot message" \
44 echo "#:#" >>/remaster/msg
45 if [ -r /live/image/boot/isolinux/boot.msg ] ; then
46 sed 1,2d /live/image/boot/isolinux/boot.msg >>/remaster/msg
48 sed 1,2d /live/image/boot.msg >>/remaster/msg
52 SQUASHFS_FILE="$(find /live/image/live -name \*.squashfs | head -1)"
53 if ! grep -q "/remaster/cdrom squashfs" /proc/mounts ; then
54 mount -t squashfs "$SQUASHFS_FILE" /remaster/cdrom -o ro,loop
57 if ! grep -q "aufs /remaster/chroot" /proc/mounts ; then
58 mount -t aufs aufs /remaster/chroot -o br:/remaster/tmp=rw:/remaster/cdrom=rr
61 for i in dev proc root sys tmp; do
62 mount --bind /$i /remaster/chroot/$i
65 echo "Now edit the contents of the live CD in this chrooted shell:"
66 chroot /remaster/chroot
68 for i in dev proc root sys tmp; do
69 umount /remaster/chroot/$i
74 [ -d /remaster/iso ] || mkdir /remaster/iso
76 for i in /live/image/*; do
77 if [ ! $i == /live/image/live ]; then
78 cp -R $i /remaster/iso
82 if [ -r /remaster/iso/boot/isolinux/boot.msg ] ; then
83 rm /remaster/iso/boot/isolinux/boot.msg
86 # make sure we support usb sticks as well:
87 if [ -d /live/image/boot/isolinux ] ; then
88 BOOTSTUFF=/live/image/boot/isolinux
93 [ -d /remaster/iso/boot/isolinux ] || mkdir -p /remaster/iso/boot/isolinux
95 sed 3,4d "${BOOTSTUFF}"/boot.msg \
96 >/remaster/iso/boot/isolinux/boot.msg
97 sed 1,2d /remaster/msg >>/remaster/iso/boot/isolinux/boot.msg
99 mkdir /remaster/iso/live
100 mksquashfs /remaster/chroot /remaster/iso/live/"$(basename $SQUASHFS_FILE)"
101 umount /remaster/chroot /remaster/cdrom
103 if [ -f /remaster/iso/boot/isolinux/isolinux.bin ] ; then
104 ISOLINUX=boot/isolinux/isolinux.bin
105 ISOLINUX_BOOTCAT=boot/isolinux/boot.cat
107 ISOLINUX=isolinux.bin
108 ISOLINUX_BOOTCAT=boot.cat
111 mkisofs -b $ISOLINUX -no-emul-boot -c $ISOLINUX_BOOTCAT \
112 -boot-info-table -l -r -J -o "$1" /remaster/iso
116 echo "ISO generation complete:"
118 echo "If you want to customize your ISO, just call grml-live-remaster again."
120 ## END OF FILE #################################################################
121 # vim: ai filetype=sh expandtab