~cyphermox/debian-cd/ubuntu-server-live

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
#!/bin/bash
#
# Do install stuff for i386/mac, including making bootable CDs
# Works with debian-installer
#
# $1 is the CD number
# $2 is the temporary CD build dir

. $BASEDIR/tools/boot/$DI_CODENAME/common.sh

set -e

N=$1
CDDIR=$2
BOOTDIR=
if [ "$DI_WWW_HOME" = "default" ];then
   DI_WWW_HOME="http://people.debian.org/~joeyh/d-i/images/daily"
fi
if [ ! "$DI_DIST" ]; then
   export DI_DIST="$DI_CODENAME"
fi
if [ -z "$DI_PATH" ]; then
   DI_PATH="$($BASEDIR/tools/find-newest-installer)"
fi

default_preseed
default_language

cd $CDDIR/..

#
# This script is called with $1 (now $N) as the CD to 
# make bootable.  N may be in the form "n" or "n_NONUS"
# There may be more than 4 disks...support extras.

# Strip NONUS part of disk number
# NN will be 1...N so it can be used as an index
#
NN=`echo $N | sed -e 's/_NONUS//'`

> $N.mkisofs_opts

case "$MKISOFS" in
    *xorriso*)
        echo -n "-isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin " >> $N.mkisofs_opts
        echo -n "-partition_offset 16 " >> $N.mkisofs_opts
        # uncomment to add a small FAT partition on the media
        # /sbin/mkfs.msdos -n Bla -C test.fat 8192
        # echo -n "-append_partition 2 0x01 test.fat " >> $N.mkisofs_opts
        ;;
esac

# List of boot image for each CD
KTYPE[1]="" #elilo multiboot in fact
KTYPE[2]="cdrom"
# XXX add net-image back when it's fixed
KTYPE[3]=""
KTYPE[4]=""
KTYPE[5]=""
KTYPE[6]=""
KTYPE[7]=""
KTYPE[8]=""
KTYPE[9]=""
KTYPE[10]=""

THISTYPE=${KTYPE[$NN]}

BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
DISK_IMAGES=""
TAR_IMAGES="netboot/netboot.tar.gz"

# Download boot images
for image in MANIFEST.udebs $BOOT_IMAGES $DISK_IMAGES $TAR_IMAGES; do
    if [ ! -e "$image" ]; then
	dir=$(dirname $image)
	mkdir -p $dir
	if [ ! "$DI_WWW_HOME" ];then
		cp "$DI_PATH/current/images/$image" "$image"
	else
		wget "$DI_WWW_HOME/$image" -O "$image"
	fi
    fi
done

if [ "$NN" = "1" ]; then
    list_kernel_abis $BOOT_IMAGES | check_kernel_sync

    mkdir -p $CDDIR/../syslinux
    SYSLINUXDEB="$($BASEDIR/tools/apt-selection cache show syslinux-common | \
	grep ^Filename | awk '{print $2}')"
    (dpkg --fsys-tarfile "$MIRROR/$SYSLINUXDEB" | \
	tar xf - -C $CDDIR/../syslinux ./usr/lib)
    ISOLINUXDEB="$($BASEDIR/tools/apt-selection cache show isolinux | \
	grep ^Filename | awk '{print $2}')"
    (dpkg --fsys-tarfile "$MIRROR/$ISOLINUXDEB" | \
	tar xf - -C $CDDIR/../syslinux ./usr/lib)

    echo "Using elilo boot-disks image on CD$N"
    mkdir -p boot$N/install
    ELILODEB="$($BASEDIR/tools/apt-selection cache show elilo | \
	grep ^Filename | awk '{print $2}')"
    (dpkg --fsys-tarfile "$MIRROR/$ELILODEB" | \
	tar xf - -C . ./usr/lib/elilo/elilo.efi)
    mv usr/lib/elilo/elilo.efi boot$N/install/

    rm -rf usr
    if [ "$CDIMAGE_INSTALL_BASE" = 1 ]; then
	cp -lf cdrom/vmlinuz $CDDIR/install/
	cp -lf cdrom/initrd.gz $CDDIR/install/
    fi
    if [ "$CDIMAGE_LIVE" = 1 ]; then
	mv $CDDIR/casper/filesystem.kernel-386 $CDDIR/casper/vmlinuz
	CASPER_INITRD="/casper/initrd$(initrd_suffix "$CDDIR/casper/filesystem.initrd-386")"
	mv $CDDIR/casper/filesystem.initrd-386 "$CDDIR$CASPER_INITRD"
    fi
    echo -n "-cache-inodes -J -l " >> $N.mkisofs_opts
    # HFS hybrid filesystem for booting on Intel-based Macs
    echo -n "--netatalk -hfs -probe -map $BASEDIR/data/hfs.map " >> $N.mkisofs_opts
    echo -n "-part -no-desktop -hfs-bless CD$N/install -hfs-bless-file CD$N/install/elilo.efi -hfs-volid ${CAPPROJECT}_i386_${CODENAME} " >> $N.mkisofs_opts
    # Recommended size for an HFS catalog is 4 MB per GB, defaults to 4 MB
    if [ "$SIZELIMIT1" ]; then
	if [ "$SIZELIMIT1" -gt 1000000000 ]; then
	    echo -n "-hfs-parms MAX_XTCSIZE=$(($SIZELIMIT1 / 256)) " >> $N.mkisofs_opts
	fi
    elif [ "$SIZELIMIT" ]; then
	if [ "$SIZELIMIT" -gt 1000000000 ]; then
	    echo -n "-hfs-parms MAX_XTCSIZE=$(($SIZELIMIT / 256)) " >> $N.mkisofs_opts
	fi
    elif [ "$DEFBINSIZE" ]; then
	if [ "$DEFBINSIZE" -gt 1000 ]; then
	    echo -n "-hfs-parms MAX_XTCSIZE=$(($DEFBINSIZE * 4096)) " >> $N.mkisofs_opts
	fi
    fi
fi

case "$MKISOFS" in
    *xorriso*)
	;;
    *)
	"$BASEDIR/tools/sorting_weights" "$N"
	echo -n "-sort $(pwd)/$N.weights " >> $N.mkisofs_opts
	;;
esac

#install_languages $CDDIR

# Only disk one gets the extra files installed
#
if [ "$NN" = "1" ]; then


# populate the install directory as well
for disk in $DISK_IMAGES; do
	dir=$(dirname $disk)
	mkdir -p $CDDIR/install/$dir
	cp -lf $disk $CDDIR/install/$dir
done

if [ "$CDIMAGE_INSTALL" = 1 ]; then
	for tar in $TAR_IMAGES; do
		dir=$(dirname $tar)
		mkdir -p $CDDIR/install/$dir
		tar -C $CDDIR/install/$dir -xzpf $tar
	done
fi

# elilo setup

# Extract memtest86+ from the archive
MEMTEST86DEB="$($BASEDIR/tools/apt-selection cache show memtest86+ | \
	grep ^Filename | awk '{print $2}')"
dpkg --fsys-tarfile "$MIRROR/$MEMTEST86DEB" | \
	tar xf - -C $CDDIR/install/ ./boot/memtest86+.bin
mv $CDDIR/install/boot/memtest86+.bin $CDDIR/install/mt86plus
rm -rf $CDDIR/install/boot
# elilo help files come from d-i.
cat cdrom/debian-cd_info.tar.gz | (cd boot$N/install/; tar zx)
# Remove ISOLINUX configuration; only for non-Macs.
rm -f boot$N/install/isolinux*
rm -f boot$N/install/*.txt*
rm -f boot$N/install/*.hlp*
# Override splash screen.
if [ "$SPLASHRLE" ] && [ -e "$SPLASHRLE" ]; then
    cp -p "$SPLASHRLE" boot$N/install/splash.rle
fi
if [ "$GFXSPLASH" ] && [ -e "$GFXSPLASH" ]; then
    cp -p "$GFXSPLASH" boot$N/install/splash.pcx
fi
if [ "$CDIMAGE_INSTALL" = 1 ]; then
    rm -f boot$N/install/*.msg.live
else
    for x in boot$N/install/*.msg.live; do
	[ -f "$x" ] || continue
	mv "$x" "${x%.live}"
    done
    for x in boot$N/install/*.msg.live; do
	[ -f "$x" ] || continue
	mv "$x" "${x%.live}"
    done
fi

fi

# write final lines to mkisofs_opts
if [ "$NN" = "1" ]; then
    echo -n "boot$N " >> $N.mkisofs_opts
else
    if [ -n "$THISTYPE" ]; then
	echo -n "-c boot/boot.catalog boot$N "  >> $N.mkisofs_opts
    fi
fi

# th,th, thats all