~mythbuntu/mythbuntu/mythbuntu-livedisk

1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
1
#!/bin/bash
2
#Mythbuntu live cd generating script
3
4
#####################
5
#
6
# License:
7
#
8
# Copyright © 2007  Mario Limonciello
9
#
10
# This script is loosely based from Linux Mint's live CD building script remastersys.
11
#
12
# * This program is free software; you can redistribute it and/or modify
13
# * it under the terms of the GNU General Public License as published by
14
# * the Free Software Foundation; either version 3 of the License, or
15
# * (at your option) any later version.
16
# *
17
# * This program is distributed in the hope that it will be useful,
18
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
# * GNU General Public License for more details.
21
# *
22
# * You should have received a copy of the GNU General Public License
23
# * along with this program; if not, write to the Free Software
24
# * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
25
#
26
# On Ubuntu systems, a copy of the GPLv3 is available in /usr/share/common-licenses/GPL-3
27
#
28
#####################
29
#
30
# Requirements:
31
# * Root permissions
32
# * debootstrap taken from ubuntu/main of the target Ubuntu release
33
# * Approx 2GB during the build process
34
#  - 1GB in the build location
35
#  - 1GB on the partition containing /var/cache/apt/archives
36
#    This script will link externally to /var/cache/apt/archives for
37
#    quicker future builds.
38
#
39
#####################
40
#
41
# Release Configuration & Environment Variables:
42
#
43
44
#Working Directory.  You will need 2-3 GB space here.
45
if [ -z "$BASE_INSTALL" ] ; then
46
    BASE_INSTALL='/tmp/mythbuntu_iso'
47
fi
48
49
#Base mirror for repositories
50
if [ -z "$BASE_MIRROR" ] ; then
51
#    BASE_MIRROR='http://mirror.imbrandon.com/ubuntu/'
52
    BASE_MIRROR='http://mirror.cs.umn.edu/ubuntu/'
53
#    BASE_MIRROR='http://ftp.ussg.iu.edu/linux/ubuntu'
54
#    BASE_MIRROR='http://archive.ubuntu.com/ubuntu'
55
fi
56
57
#Proxy if needed
58
if [ -z "$http_proxy" ] ; then
59
    http_proxy=""
60
fi
61
62
#Number of APT Retries
63
if [ -z "$APT_RETRIES" ] ; then
64
    APT_RETRIES=25
65
fi
66
67
#Ubuntu Release to base from
68
if [ -z "$BASE_RELEASE" ] ; then
69
    BASE_RELEASE='gutsy'
70
fi
71
72
#Ubuntu Version to base from
73
if [ -z "$VERSION" ] ; then
74
    VERSION='7.10'
75
fi
76
77
#Mythbuntu Release
78
if [ -z "$MYTHBUNTU_RELEASE" ] ; then
79
    MYTHBUNTU_RELEASE='alpha3'
80
fi
81
82
#Architecture we are building on
83
if [ -z "$ARCHITECTURE" ] ; then
84
    ARCHITECTURE='i386'
85
fi
86
87
#Place to put the final ISO when done.  You will need 300-700 MB here.
88
if [ -z "$NEW_DIRECTORY" ] ; then
89
    NEW_DIRECTORY="/var/cache/mythbuntu_isos/result"
90
fi
91
92
#For minor changes not requiring an entire rebuild
93
if [ -z "$DONT_CLEAN_SYSTEM" ]; then
94
    DONT_CLEAN_SYSTEM="no"
95
fi
96
97
#Install all packages and configuration
98
if [ -z "$BUILD_SYSTEM" ]; then
99
    BUILD_SYSTEM="yes"
100
fi
101
102
#Build the target ISO image
103
if [ -z "$BUILD_ISO" ]; then
104
    BUILD_ISO="yes"
105
fi
106
107
#APT Key that we sign our packages with
108
if [ -z "$APT_KEY" ]; then
109
    APT_KEY="EEED06D0"
110
fi
111
112
#Enable the on CD repository
113
if [ -z "$CDREPOSITORY" ]; then
114
    CDREPOSITORY="yes"
115
fi
116
117
#####################
118
#
119
# Experimental Environment Variables:
120
# WARNING: These will produce unpredictable results
121
122
#For testing the port to non root user
123
#FAKECHROOT='no'
124
125
#####################
126
#
127
# Calculated env variables (don't change)
128
#
129
130
#Setup our date that is used throughout the rest of the build
131
DATE=`date '+%y%m%d'`
132
133
#Find the user building this
134
ID=`id -u`
135
136
#ISO & MD5Sum file names
137
NEW_ISO="mythbuntu-$VERSION~$DATE-$ARCHITECTURE.iso"
138
NEW_MD5="$NEW_ISO.md5sum"
139
140
#####################
141
#
142
# Test enviornment, cleanup old builds, and pre-chroot steps
143
#
144
145
#Step 0 - Check users, Clean up old stuf
146
if [ -z $FAKECHROOT ] ; then
147
    if [ $ID != '0' ] ; then
148
        echo "Not building with fakechroot, need to build as root"
149
        exit 1
150
    else
151
        echo "Initializing normal Mythbuntu build initiated by $ID at `date`"
152
    fi
153
else
154
    if [ $ID != '0' ] ; then
155
        echo "Initializing fakechroot'ed Mythbuntu build initiated by $ID at `date`"
156
    else
157
        echo "Don't build in fakechroot as root."
158
        exit 1
159
    fi
160
fi
161
if [ $BASE_INSTALL = '/' ] ; then
162
    echo "Aborting build.  BASE_INSTALL was set to be / which would obliterate this filesystem."
163
    exit 2
164
fi
165
if [ -d work ] ; then
166
    #when building on pegasus, we build from a work directory
167
    cd work
168
fi
169
mkdir -p $BASE_INSTALL
170
umount $BASE_INSTALL/proc 2>&1
171
umount $BASE_INSTALL/sys 2>&1
172
umount $BASE_INSTALL/dev/pts 2>&1
173
umount $BASE_INSTALL/var/cache/apt/archives 2>&1
174
find   $BASE_INSTALL/lib/modules/ -name volatile | xargs umount 2>&1
175
rm -rf $BASE_INSTALL/home/remastersys/ISOTMP/casper/filesystem.squashfs
176
rm -rf $BASE_INSTALL/home/remastersys/mythbuntu.iso
177
if [ "$DONT_CLEAN_SYSTEM" != "yes" ] ; then
178
    echo "Starting cleanup for Mythbuntu build, `date`"
179
    rm -rf $BASE_INSTALL/*
180
else
181
    echo "Skipping clean because DONT_CLEAN_SYSTEM variable was set to yes."
182
    rm $BASE_INSTALL/home/remastersys/ISOTMP/ubuntu #symlink is recreated (Prevent the error)
183
fi
184
185
186
#Step 1 - debootstrap new base system
187
if [ "$DONT_CLEAN_SYSTEM" != "yes" ] ;then
188
    echo "Starting actual Mythbuntu build, `date`"
189
    if [ -z $FAKECHROOT ] ; then
190
        debootstrap --arch $ARCHITECTURE $BASE_RELEASE $BASE_INSTALL $BASE_MIRROR
191
    else
192
        fakeroot fakechroot debootstrap  --variant=fakechroot --arch $ARCHITECTURE $BASE_RELEASE $BASE_INSTALL $BASE_MIRROR
193
    fi
194
else
195
    echo "Skipping debootstrap, but starting mythbuntu build, `date`"
196
fi
197
198
#Step 2, Prep remastersys directory
199
mkdir -p $BASE_INSTALL/home/remastersys
200
mkdir -p $BASE_INSTALL/home/remastersys/dummysys
201
mkdir -p $BASE_INSTALL/home/remastersys/dummysys/proc
202
mkdir -p $BASE_INSTALL/home/remastersys/dummysys/tmp
203
chmod ug+rwx,o+rwt $BASE_INSTALL/home/remastersys/dummysys/tmp
204
mkdir -p $BASE_INSTALL/home/remastersys/dummysys/sys
205
mkdir -p $BASE_INSTALL/home/remastersys/dummysys/mnt
206
mkdir -p $BASE_INSTALL/home/remastersys/dummysys/media
207
mkdir -p $BASE_INSTALL/home/remastersys/dummysys/var
208
mkdir -p $BASE_INSTALL/var/cache/apt/archives/partial
209
mkdir -p $BASE_INSTALL/tmp
210
mkdir -p $BASE_INSTALL/etc/apt
211
cp -L -R ISOTMP $BASE_INSTALL/home/remastersys
212
mkdir -p $BASE_INSTALL/home/remastersys/ISOTMP/casper
213
ln -s . $BASE_INSTALL/home/remastersys/ISOTMP/ubuntu
214
215
#Step 3 - copy over networking config
216
if [ -f /etc/resolv.conf ]; then
217
    cp /etc/resolv.conf $BASE_INSTALL/etc/.
218
fi
219
if [ -f /etc/apt/apt.conf ]; then
220
    cp /etc/apt/apt.conf  $BASE_INSTALL/etc/apt/.
221
fi
222
223
#Step 4, Copy in our apt key
224
cp $APT_KEY.gpg $BASE_INSTALL/tmp
225
226
#Step 5, Copy in our background files
227
cp background_install.xpm $BASE_INSTALL/tmp
228
229
#Step 5a, make symlinks to directories we will need to access in fakechroot mode (Experimental)
230
if [ ! -z $FAKECHROOT ] ; then
231
    rm $BASE_INSTALL/proc -r
232
    rm $BASE_INSTALL/sys -r
233
    rm $BASE_INSTALL/dev -r
234
    ln -s /proc $BASE_INSTALL/proc
235
    ln -s /dev  $BASE_INSTALL/dev
236
    ln -s /sys  $BASE_INSTALL/sys
237
fi
238
239
#####################################
240
#Step 6, generate our chroot system script
241
cat <<EOCHROOT >$BASE_INSTALL/tmp/mythbuntu-system-script
242
#!/bin/bash
243
#Mythbuntu chroot system script
244
# Copyright © 2007  Mario Limonciello
245
246
export DEBIAN_FRONTEND=noninteractive
247
248
#Step A: Don't start any init scripts in this env
249
#This will keep any build machines clean of rogue processes
250
mv /sbin/start-stop-daemon /sbin/start-stop-daemon.real
251
cat <<EOF > /sbin/start-stop-daemon
252
#!/bin/sh
253
echo 1>&2
254
echo 'Warning: Fake start-stop-daemon called, doing nothing.' 1>&2
255
exit 0
256
EOF
257
cat <<EOF > /usr/sbin/policy-rc.d
258
#!/bin/sh
259
exit 101
260
EOF
261
chmod 755 /usr/sbin/policy-rc.d
262
chmod 755 /sbin/start-stop-daemon
263
264
#Step B: Install the minimal ubuntu system in fakechroot mode, mount imaginary systems in normal mode
265
if [ ! -z $FAKECHROOT ] ; then
266
    #Note, this needs to be forced because we don't yet have any apt keys
267
    apt-get install ubuntu-minimal -y --force-yes -o Acquire::Retries=$APT_RETRIES
268
    echo "Running fakechroot"
269
else
270
    mount -t proc   none  /proc
271
    mount -t devpts none  /dev/pts
272
    mount -t sysfs  sysfs /sys
273
fi
274
275
#Step C: Generate sources.list
276
cat <<EOF >/etc/apt/sources.list
277
deb $BASE_MIRROR $BASE_RELEASE main restricted universe multiverse
278
deb $BASE_MIRROR $BASE_RELEASE-updates main restricted universe multiverse
279
deb $BASE_MIRROR $BASE_RELEASE-security main restricted universe multiverse
280
deb $BASE_MIRROR $BASE_RELEASE-backports main restricted universe multiverse
281
deb http://www.mythbuntu.org/files/packages $BASE_RELEASE mythbuntu
282
deb-src $BASE_MIRROR $BASE_RELEASE-updates main restricted universe multiverse
283
deb-src $BASE_MIRROR $BASE_RELEASE universe multiverse main restricted
284
deb-src $BASE_MIRROR $BASE_RELEASE-backports main restricted universe multiverse
285
deb-src $BASE_MIRROR $BASE_RELEASE-security main restricted universe multiverse
286
deb-src http://www.mythbuntu.org/files/packages $BASE_RELEASE mythbuntu
287
EOF
288
289
#Step D: Set default locale and timezone
290
localedef -i en_US -c -f UTF-8 en_US.UTF-8
291
echo "America/Chicago" > /etc/timezone
292
cp /usr/share/zoneinfo/America/Chicago /etc/localtime
293
294
#Step E: Set up base configuration files for the rest of installation
295
cat <<EOF >/etc/network/interfaces
296
auto lo
297
iface lo inet loopback
298
EOF
299
cat <<EOF >/etc/kernel-img.conf
300
do_symlinks = yes
301
do_initrd = yes
302
EOF
303
cat <<EOF >/etc/casper.conf
304
# This file should go in /etc/casper.conf
305
# Supported variables are:
306
# USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM
307
308
export USERNAME="ubuntu"
309
export USERFULLNAME="Live session user"
310
export HOST="ubuntu"
311
export BUILD_SYSTEM="Ubuntu"
312
EOF
313
314
#Step F: Update the bootstrapped install
315
apt-key add /tmp/$APT_KEY.gpg
316
apt-get update
317
apt-get upgrade -y
318
3 by Mario Limonciello
update splash image
319
#Step G: install kernels
320
if [ "$ARCHITECTURE" = "i386" ]; then
321
    apt-get install -y -o Acquire::Retries=$APT_RETRIES linux-image-generic linux-restricted-modules-generic
322
fi
323
if [ "$ARCHITECTURE" = "amd64" ]; then
324
    apt-get install -y -o Acquire::Retries=$APT_RETRIES linux-image-generic linux-restricted-modules-generic
325
fi
326
if [ "$ARCHITECTURE" = "powerpc" ]; then
327
    apt-get install -y -o Acquire::Retries=$APT_RETRIES linux-image-powerpc linux-restricted-modules-powerpc
328
fi
329
330
#Step H: install everything else
6 by Mario Limonciello
install ubuntu-standard in sep step so that update-grub isn't called when memtest86+ is installed
331
apt-get install -y -o Acquire::Retries=$APT_RETRIES ubuntu-standard
332
apt-get install -y -o Acquire::Retries=$APT_RETRIES mythbuntu-live mythbuntu-standalone mythbuntu-lirc-generator libdvdcss2
3 by Mario Limonciello
update splash image
333
334
#Step I: place modified artwork in user's folders
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
335
cp /etc/skel/.gtkrc-2.0 /root
336
cp /etc/skel/.gtkrc-2.0 /home/mythtv
337
chown mythtv:mythtv /home/mythtv/.gtkrc-2.0
338
3 by Mario Limonciello
update splash image
339
#Step J: unmount imaginary filesystems
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
340
#the last one gets mounted during l-r-m install, but can be from many different kernels
341
if [ -z $FAKECHROOT ] ; then
342
    umount /proc
343
    umount /dev/pts
344
    umount /sys
345
    umount /var/cache/apt/archives
346
    find /lib/modules/ -name volatile | xargs umount
347
fi
348
3 by Mario Limonciello
update splash image
349
#Step K: Remove our archives directory that was linked in from the outside world
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
350
rm -rf /var/cache/apt/archives
351
mkdir -p /var/cache/apt/archives/partial
352
3 by Mario Limonciello
update splash image
353
#Step L: Build CD information & CD repository
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
354
cd /
355
mkdir -p /home/remastersys/ISOTMP/.disk
356
cat > /home/remastersys/ISOTMP/.disk/info << EOF
357
Mythbuntu $VERSION "$BASE_RELEASE" - $MYTHBUNTU_RELEASE $ARCHITECTURE ($DATE)
358
EOF
359
cat > /home/remastersys/ISOTMP/.disk/release_notes_url << EOF
360
www.mythbuntu.org/$VERSION/release_notes
361
EOF
362
if [ "$CDREPOSITORY" = "yes" ]; then
363
    #Acquire Packages
7 by Mario Limonciello
don't do nvidia-glx/fglrx on powerpc
364
    if [ "$ARCHITECTURE" != "powerpc" ]; then
365
        apt-get install -y -d -o Acquire::Retries=$APT_RETRIES vnc4server nfs-kernel-server portmap nvidia-glx
366
        apt-get install -y -d -o Acquire::Retries=$APT_RETRIES xorg-driver-fglrx
367
    else
368
        apt-get install -y -d -o Acquire::Retries=$APT_RETRIES vnc4server nfs-kernel-server portmap
369
    fi
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
370
    #Place In the directory structure
371
    mkdir -p /home/remastersys/ISOTMP/pool/main
372
    mkdir -p /home/remastersys/ISOTMP/pool/main/g
373
    mv /var/cache/apt/archives/g* /home/remastersys/ISOTMP/pool/main/g
374
    mkdir -p /home/remastersys/ISOTMP/pool/main/n
375
    mv /var/cache/apt/archives/nfs* /home/remastersys/ISOTMP/pool/main/n
376
    mkdir -p /home/remastersys/ISOTMP/pool/main/p
377
    mv /var/cache/apt/archives/port* /home/remastersys/ISOTMP/pool/main/p
378
    mkdir -p /home/remastersys/ISOTMP/pool/main/l
379
    mv /var/cache/apt/archives/l* /home/remastersys/ISOTMP/pool/main/l
380
    mkdir -p /home/remastersys/ISOTMP/pool/main/v
381
    mv /var/cache/apt/archives/v* /home/remastersys/ISOTMP/pool/main/v
382
    mkdir -p /home/remastersys/ISOTMP/pool/restricted
383
    mkdir -p /home/remastersys/ISOTMP/pool/restricted/n
384
    mv /var/cache/apt/archives/n* /home/remastersys/ISOTMP/pool/restricted/n
385
    mkdir -p /home/remastersys/ISOTMP/pool/restricted/x
386
    mv /var/cache/apt/archives/x* /home/remastersys/ISOTMP/pool/restricted/x
387
    #Write Release Files
388
    mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/binary-$ARCHITECTURE
389
    mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/source
390
    cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Release <<EOF
391
392
Archive: $BASE_RELEASE
393
Version: $VERSION
394
Component: main
395
Origin: Ubuntu
396
Label: Ubuntu
397
Architecture: $ARCHITECTURE
398
EOF
399
    mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/restricted/binary-$ARCHITECTURE
400
    mkdir -p /home/remastersys/ISOTMP/dists/$BASE_RELEASE/restricted/source
401
    cat > /home/remastersys/ISOTMP/dists/$BASE_RELEASE/restricted/binary-$ARCHITECTURE/Release <<EOF
402
403
Archive: $BASE_RELEASE
404
Version: $VERSION
405
Component: restricted
406
Origin: Ubuntu
407
Label: Ubuntu
408
Architecture: $ARCHITECTURE
409
EOF
410
    cd /home/remastersys/ISOTMP
411
    dpkg-scanpackages pool/main /dev/null > dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages
412
    cat dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/main/binary-$ARCHITECTURE/Packages.gz
413
    dpkg-scanpackages pool/restricted /dev/null > dists/$BASE_RELEASE/restricted/binary-$ARCHITECTURE/Packages
414
    cat dists/$BASE_RELEASE/restricted/binary-$ARCHITECTURE/Packages | gzip -9 > dists/$BASE_RELEASE/restricted/binary-$ARCHITECTURE/Packages.gz
415
fi
416
3 by Mario Limonciello
update splash image
417
#Step M: prepare ubiquity
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
418
rm -f /usr/share/ubiquity/apt-setup
419
echo "#do nothing" > /usr/share/ubiquity/apt-setup
420
chmod 755 /usr/share/ubiquity/apt-setup
421
dpkg-reconfigure casper
422
3 by Mario Limonciello
update splash image
423
#Step N: copy current kernel/initrd
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
424
cp /vmlinuz /home/remastersys/ISOTMP/casper/
425
cp /initrd.img /home/remastersys/ISOTMP/casper/initrd.gz
426
cp /boot/memtest86+.bin /home/remastersys/ISOTMP/install/mt86plus
427
3 by Mario Limonciello
update splash image
428
#Step O: remove our proxy conf file
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
429
if [ -f /etc/apt/apt.conf ]; then
430
    rm /etc/apt/apt.conf
431
fi
432
3 by Mario Limonciello
update splash image
433
#Step P: Remove our fake scripts
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
434
rm /usr/sbin/policy-rc.d
435
rm /sbin/start-stop-daemon
436
mv /sbin/start-stop-daemon.real /sbin/start-stop-daemon
437
3 by Mario Limonciello
update splash image
438
#Step Q: Remove Autostarting of:
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
439
update-rc.d -f mythtv-backend remove
440
update-rc.d -f mysql remove
441
update-rc.d -f apache2 remove
442
update-rc.d -f ntp remove
443
update-rc.d -f samba remove
444
update-rc.d -f ssh remove
445
3 by Mario Limonciello
update splash image
446
#Step R: Re-enable apache upon reinstall
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
447
cat > /etc/default/apache2 <<EOF
448
# 0 = start on boot; 1 = don't start on boot
449
NO_START=0
450
EOF
451
EOCHROOT
452
453
#Step 6, generate our chroot iso script
454
cat <<EOCHROOT >$BASE_INSTALL/tmp/mythbuntu-iso-script
455
#!/bin/bash
456
#Mythbuntu chroot iso build script
457
# Copyright © 2007  Mario Limonciello
458
3 by Mario Limonciello
update splash image
459
#Step S: Create Live Disk User & prep their personalized desktop
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
460
groupadd -g 999 ubuntu
461
useradd -g 999 -u 999 -s /bin/bash -m -G adm,dialout,cdrom,floppy,audio,dip,video,plugdev,mythtv ubuntu
462
mv /tmp/background_install.xpm /home/ubuntu/.background.xpm
463
rm /home/ubuntu/.idesktop/*
464
cat > /home/ubuntu/.idesktop/gmplayer.lnk <<EOF
465
table Icon
466
  Caption: GMplayer
467
  CaptionTip: Runs mplayer from livecd
468
  Command: gmplayer
469
  Icon: /usr/share/pixmaps/mplayer.xpm
470
  FontColor: #FFFFFA
471
  Width: 48
472
  Height: 48
473
  X: 273
474
  Y: 0
475
end
476
EOF
477
cat > /home/ubuntu/.idesktop/mythfrontend.lnk <<EOF
478
table Icon
479
  Caption: Mythbuntu Live Frontend
480
  CaptionTip: Runs directly from live cd
481
  Command: echo | sudo mythbuntu-startup
482
  Icon: /usr/share/mythtv/themes/blue/myth_tv_logo.png
483
  FontColor: #FFFFFA
484
  Width: 145
485
  Height: 48
486
  X: 31
487
  Y: 0
488
end
489
EOF
490
cat > /home/ubuntu/.idesktop/ubiquity.lnk <<EOF
491
table Icon
492
  Caption: Install Mythbuntu
493
  Caption Tip: Installs Mythbuntu directly to this system
494
  Command: echo | sudo -S /usr/bin/ubiquity mythbuntu_ui
495
  Icon: /usr/share/pixmaps/ubiquity.png
496
  FontColor: #FFFFFA
497
  Width: 64
498
  Height: 64
499
  X: 81
500
  Y: 85
501
end
502
EOF
503
cat > /home/ubuntu/.idesktop/vlc.lnk <<EOF
504
table Icon
505
  Caption: VLC
506
  CaptionTip: Runs VLC from live cd
507
  Command: vlc
508
  Icon: /usr/share/vlc/vlc.xpm
509
  FontColor: #FFFFFA
510
  Width: 48
511
  Height: 48
512
  X: 193
513
  Y: 0
514
end
515
EOF
516
cat > /home/ubuntu/.idesktop/firefox.lnk <<EOF
517
table Icon
518
  Caption: Firefox
519
  CaptionTip: Runs Firefox from live cd
520
  Command: firefox http://www.mythbuntu.org
521
  Icon: /usr/share/pixmaps/firefox.png
522
  FontColor: #FFFFFA
523
  Width: 48
524
  Height: 48
525
  X: 353
526
  Y: 0
527
end
528
EOF
529
chown 999:999 /home/ubuntu/.idesk* -R
530
3 by Mario Limonciello
update splash image
531
#Step T: Generate manifests and control scripts
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
532
dpkg-query -W --showformat='\${Package} \${Version}\n' | grep -v deinstall > /home/remastersys/ISOTMP/casper/filesystem.manifest
533
cat > /home/remastersys/control <<EOF
534
/casper/d
535
/libdebian-installer4/d
536
/os-prober/d
537
/ubiquity/d
538
/user-setup/d
539
/gnome-mount/d
540
/gnome-volume-manager/d
541
EOF
542
sed -f /home/remastersys/control < /home/remastersys/ISOTMP/casper/filesystem.manifest > /home/remastersys/ISOTMP/casper/filesystem.manifest-desktop
543
3 by Mario Limonciello
update splash image
544
#Step U: Prep remastersys directories
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
545
find /var/log -name *log.* > /home/remastersys/varexc
546
find /var -name *.pid >> /home/remastersys/varexc
547
find /var/tmp -name *cache* >> /home/remastersys/varexc
548
rsync --exclude-from=/home/remastersys/varexc -av /var/. /home/remastersys/dummysys/var/.
549
3 by Mario Limonciello
update splash image
550
#Step V: create squashfs
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
551
if [ ! -z $FAKECHROOT ] ; then
552
    #Clean up directories before making
553
    rm -r /proc /sys /dev
554
    mkdir -p /proc
555
    mkdir -p /dev
556
    mkdir -p /sys
557
fi
558
mksquashfs / /home/remastersys/ISOTMP/casper/filesystem.squashfs -e \
559
.thumbnails \
560
Cache \
561
/etc/X11/xorg.conf \
562
/etc/resolv.conf \
563
/etc/mtab \
564
/etc/fstab \
565
/media \
566
/mnt \
567
/proc \
568
/sys \
569
/tmp \
570
/var \
571
/home/remastersys
572
3 by Mario Limonciello
update splash image
573
#Step W: add other live cd folder requirements
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
574
mksquashfs /home/remastersys/dummysys/ /home/remastersys/ISOTMP/casper/filesystem.squashfs
575
3 by Mario Limonciello
update splash image
576
#Step X: remove our live user
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
577
userdel ubuntu
578
3 by Mario Limonciello
update splash image
579
#Step Y: create a md5sum for the ISO
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
580
cd /home/remastersys/ISOTMP && find . -type f -print0 | xargs -0 md5sum | sed /md5sum/d | sed /boot.cat/d | sed /isolinux.bin/d > md5sum.txt
581
3 by Mario Limonciello
update splash image
582
#Step Z: create ISO
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
583
mkisofs    \
584
 -r    \
585
 -V "Mythbuntu $VERSION $MYTHBUNTU_RELEASE"    \
586
 -cache-inodes    \
587
 -J    \
588
 -l    \
589
 -b isolinux/isolinux.bin    \
590
 -c isolinux/boot.cat    \
591
 -no-emul-boot    \
592
 -boot-load-size 4    \
593
 -boot-info-table    \
594
 -o /home/remastersys/mythbuntu.iso "/home/remastersys/ISOTMP"
595
ls -hs /home/remastersys/mythbuntu.iso
596
EOCHROOT
597
598
#####################################
599
#Step 7, run our chroot script
600
chmod +x $BASE_INSTALL/tmp/mythbuntu-system-script
601
chmod +x $BASE_INSTALL/tmp/mythbuntu-iso-script
602
if [ ! -z $FAKECHROOT ] ; then
603
    TIME="The fakechroot build process ran for %E." time fakeroot fakechroot chroot $BASE_INSTALL /tmp/mythbuntu-system-script
604
    TIME2="The fakechroot build process ran for %E." time fakeroot fakechroot chroot $BASE_INSTALL /tmp/mythbuntu-iso-script
605
else
606
607
    if [ $BUILD_SYSTEM = "yes" ]; then
608
        mount --bind /var/cache/apt/archives $BASE_INSTALL/var/cache/apt/archives
609
        TIME="The chroot build process ran for %E." time chroot $BASE_INSTALL /tmp/mythbuntu-system-script
3 by Mario Limonciello
update splash image
610
        umount $BASE_INSTALL/var/cache/apt/archives 2>&1
1 by Mario Limonciello
initial checkin, moving from the old ~mythbuntu/mythbuntu/mythbuntu branch
611
    else
612
        echo "Skipping chroot build process as requested by user."
613
    fi
614
    if [ $BUILD_ISO = "yes" ]; then
615
        TIME2="The chroot iso process ran for %E." time chroot $BASE_INSTALL /tmp/mythbuntu-iso-script
616
    else
617
        echo "Skipping chroot iso process as requested by user."
618
    fi
619
620
621
fi
622
623
#####################################
624
#Step 8, Cleanup
625
rm $BASE_INSTALL/tmp/mythbuntu-system-script
626
rm $BASE_INSTALL/tmp/mythbuntu-iso-script
627
628
#####################################
629
#Step 9, Finished up
630
#####################################
631
if [ $BUILD_ISO = "yes" ]; then
632
    mv $BASE_INSTALL/home/remastersys/mythbuntu.iso $NEW_DIRECTORY/$NEW_ISO
633
    cd $NEW_DIRECTORY
634
    md5sum $NEW_ISO > $NEW_MD5
635
    echo "Your mythbuntu image generation completed at `date`"
636
637
    echo "The ISO image is located in $NEW_DIRECTORY/$NEW_ISO"
638
    echo "The ISO md5sum is located in $NEW_DIRECTORY/$NEW_MD5"
639
else
640
    echo "The base install is located in $BASE_INSTALL"
641
    echo "No ISO image was generated as requested by user."
642
fi