Subversion Repositories livecd

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
269 beyerleu 1
########################################################################
2
#
3
#  Mini LiveCD with icewm dekstop
4
#
5
########################################################################
6
 
7
lang en_US.UTF-8
8
keyboard us
9
timezone US/Eastern
10
auth --useshadow --enablemd5
11
selinux --enforcing
12
firewall --enabled --service=mdns
13
repo --name=base     --baseurl=http://ftp.scientificlinux.org/linux/scientific/6rolling/$basearch/os/
14
repo --name=updates  --baseurl=http://ftp.scientificlinux.org/linux/scientific/6rolling/$basearch/updates/
15
xconfig --startxonboot
16
part / --size 4096 --fstype ext4
17
services --enabled=NetworkManager --disabled=network,sshd
18
 
19
%packages
20
syslinux
21
kernel
22
@base
23
 #package added to @base
24
  squashfs-tools
25
 #packages removed from @base
26
 -bind-utils
27
 -ed
28
 -kexec-tools
29
 -libaio
30
 -libhugetlbfs
31
 -microcode_ctl
32
 -psacct
33
 -quota
34
@core
270 beyerleu 35
#@fonts
36
dejavu-fonts-common
37
dejavu-sans-fonts
38
dejavu-sans-mono-fonts
39
dejavu-serif-fonts
40
fontpackages-filesystem
41
xorg-x11-fonts-misc
269 beyerleu 42
@graphical-admin-tools
43
@network-file-system-client
44
@network-tools
45
 #package added to @network-tools
46
 nmap
47
@remote-desktop-clients
48
 #packages added to @remote-desktop-clients
49
 rdesktop
50
 tsclient
51
@x11
52
 
53
# login manager
54
gdm
55
 
56
# icewm desktop
57
@ice-desktop
58
 
59
# other usefull packages
60
busybox
61
mailx
62
memtest86+
63
livecd-tools
64
 
65
# livecd bits to set up the livecd and be able to install
66
anaconda
67
device-mapper-multipath
68
isomd5sum
69
 
70
## mini SL LiveCD specific changes
71
 
72
# packages to remove
73
-scenery-backgrounds
74
-qt3
75
-xinetd
76
 
77
# packages to add
78
ibus-gtk
79
thunderbird
80
firefox
270 beyerleu 81
@openafs-client
269 beyerleu 82
 
83
%end
84
 
85
########################################################################
86
#
87
#  LiveCD post install 
88
#
89
########################################################################
90
 
91
%post
92
 
93
########################################################################
94
# LiveCD configuration file and LiveCD functions
95
########################################################################
96
 
97
cat > /etc/livesys.conf << 'EOF_livesysconf'
98
###--------------------------------------------------------------------
99
### Configuration file for LiveCD
100
###--------------------------------------------------------------------
101
 
273 beyerleu 102
# default LiveCD user
269 beyerleu 103
LIVECD_DEF_USER="sluser"
104
 
105
# delay in sec. before auto login
106
LOGIN_DELAY=15
107
 
273 beyerleu 108
# Services which are off (not running) on the LiveCD
109
SERVICES_OFF="mdmonitor setroubleshoot auditd crond atd readahead_early \
110
              readahead_later kdump microcode_ctl openct pcscd postfix"
111
 
269 beyerleu 112
EOF_livesysconf
113
 
114
 
270 beyerleu 115
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
269 beyerleu 116
###--------------------------------------------------------------------
117
### livesys functions
118
###--------------------------------------------------------------------
119
 
120
# egrep_o is a replacement for "egrep -o". It prints only the last matching text
121
egrep_o() {
122
   cat | egrep "$1" | sed -r "s/.*($1).*/\\1/"
123
}
124
 
125
# boot parameter
126
cmdline_parameter() {
127
   CMDLINE=/proc/cmdline
128
   cat "$CMDLINE" | egrep_o "(^|[[:space:]]+)$1(\$|=|[[:space:]]+)" | egrep_o "$1"
129
}
130
 
131
# boot parameter value
132
cmdline_value()
133
{
134
   CMDLINE=/proc/cmdline
135
   cat "$CMDLINE" | egrep_o "(^|[[:space:]]+)$1=([^[:space:]]+)" | egrep_o "=.*" | cut -b 2- | tail -n 1
136
}
137
 
138
exists() {
139
    which $1 >/dev/null 2>&1 || return
140
    $*
141
}
142
 
143
EOF_livesysfunctions
144
 
145
 
146
 
147
########################################################################
148
# Create a sub-script so the output can be captured
149
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
150
########################################################################
151
 
152
cat > /root/post-install << EOF_post
153
#!/bin/bash
154
 
155
 
156
echo ###################################################################
157
echo ## Creating the livesys init script - livesys
158
echo ###################################################################
159
 
160
cat > /etc/rc.d/init.d/livesys << EOF_initscript
161
#!/bin/bash
162
#
163
# live: Init script for live image
164
#
165
# chkconfig: 345 00 99
166
# description: Init script for live image.
167
 
168
. /etc/init.d/functions
169
. /etc/livesys.conf
170
. /etc/init.d/livesys.functions
171
 
172
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
173
    exit 0
174
fi
175
 
176
if [ -e /.liveimg-configured ] ; then
177
    configdone=1
178
fi
179
 
180
touch /.liveimg-configured
181
 
182
# read boot parameters out of /proc/cmdline
273 beyerleu 183
hostname=\\\$( cmdline_value hostname )
184
CELL=\\\$( cmdline_value cell )
185
SERVICEON=\\\$( cmdline_value serviceon )
186
SERVICEOFF=\\\$( cmdline_value serviceoff )
269 beyerleu 187
 
188
# set livecd user
189
LIVECD_USER=\\\$( cmdline_value user )
190
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
191
 
192
# mount live image
193
if [ -b \\\`readlink -f /dev/live\\\` ]; then
194
   mkdir -p /mnt/live
195
   mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live
196
fi
197
 
198
livedir="LiveOS"
199
for arg in \\\`cat /proc/cmdline\\\` ; do
200
  if [ "\\\${arg##live_dir=}" != "\\\${arg}" ]; then
201
    livedir=\\\${arg##live_dir=}
202
    return
203
  fi
204
done
205
 
206
# enable swaps unless requested otherwise
207
swaps=\\\`blkid -t TYPE=swap -o device\\\`
208
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -n "\\\$swaps" ] ; then
209
  for s in \\\$swaps ; do
210
    action "Enabling swap partition \\\$s" swapon \\\$s
211
  done
212
fi
213
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -f /mnt/live/\\\${livedir}/swap.img ] ; then
214
  action "Enabling swap file" swapon /mnt/live/\\\${livedir}/swap.img
215
fi
216
 
217
mountPersistentHome() {
218
  # support label/uuid
219
  if [ "\\\${homedev##LABEL=}" != "\\\${homedev}" -o "\\\${homedev##UUID=}" != "\\\${homedev}" ]; then
220
    homedev=\\\`/sbin/blkid -o device -t "\\\$homedev"\\\`
221
  fi
222
 
223
  # if we're given a file rather than a blockdev, loopback it
224
  if [ "\\\${homedev##mtd}" != "\\\${homedev}" ]; then
225
    # mtd devs don't have a block device but get magic-mounted with -t jffs2
226
    mountopts="-t jffs2"
227
  elif [ ! -b "\\\$homedev" ]; then
228
    loopdev=\\\`losetup -f\\\`
229
    if [ "\\\${homedev##/mnt/live}" != "\\\${homedev}" ]; then
230
      action "Remounting live store r/w" mount -o remount,rw /mnt/live
231
    fi
232
    losetup \\\$loopdev \\\$homedev
233
    homedev=\\\$loopdev
234
  fi
235
 
236
  # if it's encrypted, we need to unlock it
237
  if [ "\\\$(/sbin/blkid -s TYPE -o value \\\$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
238
    echo
239
    echo "Setting up encrypted /home device"
240
    plymouth ask-for-password --command="cryptsetup luksOpen \\\$homedev EncHome"
241
    homedev=/dev/mapper/EncHome
242
  fi
243
 
244
  # and finally do the mount
245
  mount \\\$mountopts \\\$homedev /home
246
  # if we have /home under what's passed for persistent home, then
247
  # we should make that the real /home.  useful for mtd device on olpc
248
  if [ -d /home/home ]; then mount --bind /home/home /home ; fi
249
  [ -x /sbin/restorecon ] && /sbin/restorecon /home
250
  if [ -d /home/\\\$LIVECD_USER ]; then USERADDARGS="-M" ; fi
251
}
252
 
253
findPersistentHome() {
254
  for arg in \\\`cat /proc/cmdline\\\` ; do
255
    if [ "\\\${arg##persistenthome=}" != "\\\${arg}" ]; then
256
      homedev=\\\${arg##persistenthome=}
257
      return
258
    fi
259
  done
260
}
261
 
262
if strstr "\\\`cat /proc/cmdline\\\`" persistenthome= ; then
263
  findPersistentHome
264
elif [ -e /mnt/live/\\\${livedir}/home.img ]; then
265
  homedev=/mnt/live/\\\${livedir}/home.img
266
fi
267
 
268
# if we have a persistent /home, then we want to go ahead and mount it
269
if ! strstr "\\\`cat /proc/cmdline\\\`" nopersistenthome && [ -n "\\\$homedev" ] ; then
270
  action "Mounting persistent /home" mountPersistentHome
271
fi
272
 
273
# make it so that we don't do writing to the overlay for things which
274
# are just tmpdirs/caches
275
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
276
mount -t tmpfs tmp /tmp
277
mount -t tmpfs vartmp /var/tmp
278
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
279
 
273 beyerleu 280
# turn off services, which are not useful on LiveCD, to preserve resources
274 beyerleu 281
if [ "\\\$SERVICES_OFF" ]; then
282
    for service in \\\$SERVICES_OFF ; do
273 beyerleu 283
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
284
    done
285
fi
286
 
287
# services off, from command line paramter
288
if [ "\\\$SERVICEOFF" ]; then
289
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
290
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
291
    done
292
fi
293
 
294
# services on, from command line paramter
295
if [ "\\\$SERVICEON" ]; then
296
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
297
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
298
    done
299
fi
300
 
301
# set afs cell if given by boot parameter
302
[ "\\\$CELL" ] && echo \\\$CELL > /usr/vice/etc/ThisCell
303
 
304
# set the LiveCD hostname
305
[ ! "\\\$hostname" ] && hostname="livecd.localdomain"
306
sed -i -e "s|HOSTNAME=.*|HOSTNAME=\\\$hostname|g" /etc/sysconfig/network
307
/bin/hostname \\\$hostname
308
 
309
 
310
###################################################
311
# EXIT here if LiveCD has already been configured #
312
###################################################
269 beyerleu 313
if [ -n "\\\$configdone" ]; then
314
  exit 0
315
fi
316
 
317
## fix various bugs and issues
318
# unmute sound card
319
exists alsaunmute 0 2> /dev/null
320
 
270 beyerleu 321
# turn off firstboot for livecd boots
322
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
323
 
324
# start afs with option -memcache (is this correct?)
325
[ -e /etc/sysconfig/afs ] && sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
326
 
269 beyerleu 327
# Stopgap fix for RH #217966; should be fixed in HAL instead
328
touch /media/.hal-mtab
329
 
330
## create the LiveCD default user
331
# add default user with no password
332
/usr/sbin/useradd -c "LiveCD default user" \\\$LIVECD_USER
333
/usr/bin/passwd -d \\\$LIVECD_USER > /dev/null
334
# give default user sudo privileges
335
echo "\\\$LIVECD_USER     ALL=(ALL)     NOPASSWD: ALL" >> /etc/sudoers
336
 
337
## configure default user's desktop
338
# set up timed auto-login at 10 seconds
339
cat >> /etc/gdm/custom.conf << FOE
340
[daemon]
341
TimedLoginEnable=true
342
TimedLogin=LIVECD_USER
343
TimedLoginDelay=$LOGIN_DELAY
344
FOE
345
sed -i "s|LIVECD_USER|\\\$LIVECD_USER|" /etc/gdm/custom.conf
346
 
347
# add keyboard and display configuration utilities to the desktop
348
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
349
cp /usr/share/applications/gnome-keyboard.desktop           /home/\\\$LIVECD_USER/Desktop/
350
cp /usr/share/applications/gnome-display-properties.desktop /home/\\\$LIVECD_USER/Desktop/
351
 
352
# disable screensaver locking
353
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool   /apps/gnome-screensaver/lock_enabled "false" >/dev/null
354
 
355
# disable PackageKit update checking by default
356
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t int /apps/gnome-packagekit/update-icon/frequency_get_updates "0" >/dev/null
357
 
358
# detecting disk partitions and logical volumes 
359
CreateDesktopIconHD()
360
{
361
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
362
[Desktop Entry]
363
Encoding=UTF-8
364
Version=1.0
365
Type=Link
366
Name=Local hard drives
367
Name[en_US]=Local hard drives
368
Name[fr_CA]=Disques durs locaux
369
URL=/mnt/disc
370
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
371
EOF_HDicon
372
 
373
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
374
}
375
 
376
CreateDesktopIconLVM()
377
{
378
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
379
 
380
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
381
[Desktop Entry]
382
Encoding=UTF-8
383
Version=1.0
384
Type=Link
385
Name=Local logical volumes
386
Name[en_US]=Local logical volumes
387
Name[fr_CA]=Volumes logiques locaux
388
URL=/mnt/lvm
389
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
390
EOF_LVMicon
391
 
392
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
393
}
394
 
395
# don't mount disk partitions if 'nodiskmount' is given as a boot option
396
if ! strstr "\\\`cat /proc/cmdline\\\`" nodiskmount ; then
397
	MOUNTOPTION="ro"
398
	HARD_DISKS=\\\`egrep "[sh]d.\\\$" /proc/partitions | tr -s ' ' | sed 's/^  *//' | cut -d' ' -f4\\\`
399
 
400
	echo "Mounting hard disk partitions... "
401
	for DISK in \\\$HARD_DISKS; do
402
	    # Get the device and system info from fdisk (but only for fat and linux partitions).
403
	    FDISK_INFO=\\\`fdisk -l /dev/\\\$DISK | tr [A-Z] [a-z] | egrep "fat|linux" | egrep -v "swap|extended|lvm" | sed 's/*//' | tr -s ' ' | tr ' ' ':' | cut -d':' -f1,6-\\\`
404
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
405
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
406
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
407
		mkdir -p \\\$MOUNTPOINT
408
		MOUNTED=FALSE
409
 
410
		# get the partition type
411
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
412
		*fat*) 
413
		    FSTYPES="vfat"
414
		    EXTRAOPTIONS=",uid=500";;
415
		*)
416
		    FSTYPES="ext4 ext3 ext2"
417
		    EXTRAOPTIONS="";;
418
		esac
419
 
420
		# try to mount the partition
421
		for FSTYPE in \\\$FSTYPES; do
422
		    if mount -o "\\\${MOUNTOPTION}\\\${EXTRAOPTIONS}" -t \\\$FSTYPE \\\$PARTITION \\\$MOUNTPOINT &>/dev/null; then
423
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
424
			echo -n "\\\$PARTITION "
425
			MOUNTED=TRUE
426
			CreateDesktopIconHD
427
		    fi
428
		done
429
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
430
	    done
431
	done
432
	echo
433
fi
434
 
435
# don't mount logical volumes if 'nolvmmount' is given as a boot option
436
if ! strstr "\\\`cat /proc/cmdline\\\`" nolvmmount ; then
437
        MOUNTOPTION="ro"
438
	FSTYPES="ext4 ext3 ext2"
439
	echo "Scanning for logical volumes..."
440
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
441
	    echo "Activating logical volumes ..."
442
	    modprobe dm_mod >/dev/null
443
	    lvm vgchange -ay
444
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
445
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
446
		echo "Making device nodes ..."
447
		lvm vgmknodes
448
		echo -n "Mounting logical volumes ... "
449
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
450
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
451
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
452
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
453
		    mkdir -p \\\$MOUNTPOINT
454
 
455
		    MOUNTED=FALSE
456
		    for FSTYPE in \\\$FSTYPES; do
457
			if mount -o \\\$MOUNTOPTION -t \\\$FSTYPE \\\$VOLUME_NAME \\\$MOUNTPOINT &>/dev/null; then
458
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
459
			    echo -n "\\\$VOLUME_NAME "
460
			    MOUNTED=TRUE
461
			    CreateDesktopIconLVM
462
			    break
463
			fi
464
		    done
465
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
466
		done
467
		echo
468
 
469
	    else
470
		echo "No logical volumes found"
471
	    fi
472
	fi
473
fi
474
 
475
# give back ownership to the default user
476
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
477
 
478
EOF_initscript
479
echo ###################################################################
480
echo ## End of livesys script
481
echo ###################################################################
482
 
483
 
484
 
485
echo ###################################################################
486
echo ## Creating the livesys init script - livesys-late
487
echo ###################################################################
488
 
489
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
490
#!/bin/bash
491
#
492
# live: Late init script for live image
493
#
494
# chkconfig: 345 99 01
495
# description: Late init script for live image.
496
 
497
. /etc/init.d/functions
498
. /etc/livesys.conf
499
. /etc/init.d/livesys.functions
500
 
501
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
502
    exit 0
503
fi
504
 
505
touch /.liveimg-late-configured
506
 
507
# read boot parameters out of /proc/cmdline
508
ks=\\\$( cmdline_value ks )
509
xdriver=\\\$( cmdline_value xdriver )
510
kb=\\\$( cmdline_value kb )
511
 
512
# if liveinst or textinst is given, start anaconda
513
if [ "\\\$( cmdline_parameter liveinst )" ]; then
514
   plymouth --quit
515
   /usr/sbin/liveinst \\\$ks
516
fi
517
if [ "\\\$( cmdline_parameter textinst )" ] ; then
518
   plymouth --quit
519
   /usr/sbin/liveinst --text \\\$ks
520
fi
521
 
522
# configure X, allowing user to override xdriver
523
if [ "\\\$xdriver" ]; then
524
    exists system-config-display --noui --reconfig --set-depth=24 --set-driver=\\\$xdriver
525
fi
526
 
527
# configure keyboard
528
if [ "\\\$kb" ]; then
529
    exists system-config-keyboard --noui \\\$kb 
530
fi
531
 
532
EOF_lateinitscript
533
echo ###################################################################
534
echo ## End of livesys-late script
535
echo ###################################################################
536
 
537
 
538
 
539
echo ###################################################################
540
echo ## Configure the LiveCD
541
echo ###################################################################
542
 
543
# workaround avahi segfault (#279301)
544
touch /etc/resolv.conf
545
/sbin/restorecon /etc/resolv.conf
546
 
547
chmod 755 /etc/rc.d/init.d/livesys
548
/sbin/restorecon /etc/rc.d/init.d/livesys
549
/sbin/chkconfig --add livesys
550
 
551
chmod 755 /etc/rc.d/init.d/livesys-late
552
/sbin/restorecon /etc/rc.d/init.d/livesys-late
553
/sbin/chkconfig --add livesys-late
554
 
555
# go ahead and pre-make the man -k cache (#455968)
556
/usr/sbin/makewhatis -w
557
 
558
# save a little bit of space at least...
559
rm -f /var/lib/rpm/__db*
560
rm -f /boot/initrd*
561
rm -f /boot/initramfs*
562
# make sure there aren't core files lying around
563
rm -f /core*
564
 
565
# convince readahead not to collect
566
rm -f /.readahead_collect
567
touch /var/lib/readahead/early.sorted
568
 
569
# workaround clock syncing on shutdown that we don't want (#297421)
570
sed -i -e 's/hwclock/no-such-hwclock/g' /etc/rc.d/init.d/halt
571
 
572
# import RPM GPG keys
573
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
574
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
575
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
576
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
577
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
578
 
579
# evolution is in the gnome launch panel (workaround to start thunderbird instead)
580
[ ! -e /usr/bin/evolution ] && ln -s /usr/bin/thunderbird /usr/bin/evolution
581
 
582
EOF_post
583
 
584
# run post-install script
585
/bin/bash -x /root/post-install 2>&1 | tee /root/post-install.log
586
 
587
%end
588
########################################################################
589
# End of configure LiveCD in chroot
590
########################################################################
591
 
592
 
593
 
594
%post --nochroot
595
########################################################################
596
# Post install in no chroot
597
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
598
########################################################################
599
cat > /root/postnochroot-install << EOF_postnochroot
600
#!/bin/bash
601
 
602
# Copy licensing information
603
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
604
 
605
# add livecd-iso-to-disk utility on the LiveCD
606
# only works on x86, x86_64
607
if [ "\$(uname -i)" = "i386" -o "\$(uname -i)" = "x86_64" ]; then
608
  if [ ! -d \$LIVE_ROOT/LiveOS ]; then mkdir -p \$LIVE_ROOT/LiveOS ; fi
609
  cp /usr/bin/livecd-iso-to-disk \$LIVE_ROOT/LiveOS
610
fi
611
 
612
# customize boot menu entries
613
grep -B4 'menu default'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
614
grep -B3 'xdriver=vesa'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
615
grep -A3 'label check0'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
616
grep -A2 'label memtest' \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
617
grep -A2 'label local'   \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
618
 
619
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
620
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
621
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
622
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
623
 
624
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
625
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
626
sed -i "s/liveimg/liveimg liveinst noswap nolvmmount/"                      \$LIVE_ROOT/isolinux/install.txt
627
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
628
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
629
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
630
 
631
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
632
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
633
sed -i "s/liveimg/liveimg textinst noswap nolvmmount/"                      \$LIVE_ROOT/isolinux/textinstall.txt
634
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
635
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
636
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
637
 
638
cat \$LIVE_ROOT/isolinux/default.txt \$LIVE_ROOT/isolinux/basicvideo.txt \$LIVE_ROOT/isolinux/check.txt \$LIVE_ROOT/isolinux/memtest.txt \$LIVE_ROOT/isolinux/localboot.txt > \$LIVE_ROOT/isolinux/current.txt
639
diff \$LIVE_ROOT/isolinux/isolinux.cfg \$LIVE_ROOT/isolinux/current.txt | sed '/^[0-9][0-9]*/d; s/^. //; /^---$/d' > \$LIVE_ROOT/isolinux/cleaned.txt
640
cat \$LIVE_ROOT/isolinux/cleaned.txt \$LIVE_ROOT/isolinux/default.txt \$LIVE_ROOT/isolinux/textboot.txt \$LIVE_ROOT/isolinux/basicvideo.txt \$LIVE_ROOT/isolinux/install.txt \$LIVE_ROOT/isolinux/textinstall.txt \$LIVE_ROOT/isolinux/memtest.txt \$LIVE_ROOT/isolinux/localboot.txt > \$LIVE_ROOT/isolinux/isolinux.cfg
641
rm -f \$LIVE_ROOT/isolinux/*.txt
642
 
643
EOF_postnochroot
644
 
645
# run postnochroot-install script
646
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
647
 
648
%end
649
########################################################################
650
# End of configure LiveCD in nochroot
651
########################################################################