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
 
275 beyerleu 112
# Services which should be on, but are not on per default
113
SERVICES_ON=""
114
 
269 beyerleu 115
EOF_livesysconf
116
 
117
 
270 beyerleu 118
cat > /etc/init.d/livesys.functions << 'EOF_livesysfunctions'
269 beyerleu 119
###--------------------------------------------------------------------
120
### livesys functions
121
###--------------------------------------------------------------------
122
 
123
# egrep_o is a replacement for "egrep -o". It prints only the last matching text
124
egrep_o() {
125
   cat | egrep "$1" | sed -r "s/.*($1).*/\\1/"
126
}
127
 
128
# boot parameter
129
cmdline_parameter() {
130
   CMDLINE=/proc/cmdline
131
   cat "$CMDLINE" | egrep_o "(^|[[:space:]]+)$1(\$|=|[[:space:]]+)" | egrep_o "$1"
132
}
133
 
134
# boot parameter value
135
cmdline_value()
136
{
137
   CMDLINE=/proc/cmdline
138
   cat "$CMDLINE" | egrep_o "(^|[[:space:]]+)$1=([^[:space:]]+)" | egrep_o "=.*" | cut -b 2- | tail -n 1
139
}
140
 
141
exists() {
142
    which $1 >/dev/null 2>&1 || return
143
    $*
144
}
145
 
146
EOF_livesysfunctions
147
 
148
 
149
 
150
########################################################################
151
# Create a sub-script so the output can be captured
152
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
153
########################################################################
154
 
155
cat > /root/post-install << EOF_post
156
#!/bin/bash
157
 
158
 
159
echo ###################################################################
160
echo ## Creating the livesys init script - livesys
161
echo ###################################################################
162
 
163
cat > /etc/rc.d/init.d/livesys << EOF_initscript
164
#!/bin/bash
165
#
166
# live: Init script for live image
167
#
168
# chkconfig: 345 00 99
169
# description: Init script for live image.
170
 
171
. /etc/init.d/functions
172
. /etc/livesys.conf
173
. /etc/init.d/livesys.functions
174
 
275 beyerleu 175
# exit if not running from LiveCD
269 beyerleu 176
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
177
    exit 0
178
fi
179
 
275 beyerleu 180
[ -e /.liveimg-configured ] && configdone=1
269 beyerleu 181
 
182
touch /.liveimg-configured
183
 
184
# read boot parameters out of /proc/cmdline
275 beyerleu 185
 
186
# hostname
273 beyerleu 187
hostname=\\\$( cmdline_value hostname )
275 beyerleu 188
 
189
# afs cell
273 beyerleu 190
CELL=\\\$( cmdline_value cell )
275 beyerleu 191
 
192
# services to turn on / off
273 beyerleu 193
SERVICEON=\\\$( cmdline_value serviceon )
194
SERVICEOFF=\\\$( cmdline_value serviceoff )
269 beyerleu 195
 
275 beyerleu 196
# cups server
197
CUPS=\\\$( cmdline_value cups )
198
 
269 beyerleu 199
# set livecd user
200
LIVECD_USER=\\\$( cmdline_value user )
201
[ ! "\\\$LIVECD_USER" ] && LIVECD_USER=\\\$LIVECD_DEF_USER
202
 
203
# mount live image
204
if [ -b \\\`readlink -f /dev/live\\\` ]; then
205
   mkdir -p /mnt/live
206
   mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live
207
fi
208
 
209
livedir="LiveOS"
210
for arg in \\\`cat /proc/cmdline\\\` ; do
211
  if [ "\\\${arg##live_dir=}" != "\\\${arg}" ]; then
212
    livedir=\\\${arg##live_dir=}
213
    return
214
  fi
215
done
216
 
217
# enable swaps unless requested otherwise
218
swaps=\\\`blkid -t TYPE=swap -o device\\\`
219
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -n "\\\$swaps" ] ; then
220
  for s in \\\$swaps ; do
221
    action "Enabling swap partition \\\$s" swapon \\\$s
222
  done
223
fi
224
if ! strstr "\\\`cat /proc/cmdline\\\`" noswap && [ -f /mnt/live/\\\${livedir}/swap.img ] ; then
225
  action "Enabling swap file" swapon /mnt/live/\\\${livedir}/swap.img
226
fi
227
 
228
mountPersistentHome() {
229
  # support label/uuid
230
  if [ "\\\${homedev##LABEL=}" != "\\\${homedev}" -o "\\\${homedev##UUID=}" != "\\\${homedev}" ]; then
231
    homedev=\\\`/sbin/blkid -o device -t "\\\$homedev"\\\`
232
  fi
233
 
234
  # if we're given a file rather than a blockdev, loopback it
235
  if [ "\\\${homedev##mtd}" != "\\\${homedev}" ]; then
236
    # mtd devs don't have a block device but get magic-mounted with -t jffs2
237
    mountopts="-t jffs2"
238
  elif [ ! -b "\\\$homedev" ]; then
239
    loopdev=\\\`losetup -f\\\`
240
    if [ "\\\${homedev##/mnt/live}" != "\\\${homedev}" ]; then
241
      action "Remounting live store r/w" mount -o remount,rw /mnt/live
242
    fi
243
    losetup \\\$loopdev \\\$homedev
244
    homedev=\\\$loopdev
245
  fi
246
 
247
  # if it's encrypted, we need to unlock it
248
  if [ "\\\$(/sbin/blkid -s TYPE -o value \\\$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
249
    echo
250
    echo "Setting up encrypted /home device"
251
    plymouth ask-for-password --command="cryptsetup luksOpen \\\$homedev EncHome"
252
    homedev=/dev/mapper/EncHome
253
  fi
254
 
255
  # and finally do the mount
256
  mount \\\$mountopts \\\$homedev /home
257
  # if we have /home under what's passed for persistent home, then
258
  # we should make that the real /home.  useful for mtd device on olpc
259
  if [ -d /home/home ]; then mount --bind /home/home /home ; fi
260
  [ -x /sbin/restorecon ] && /sbin/restorecon /home
261
  if [ -d /home/\\\$LIVECD_USER ]; then USERADDARGS="-M" ; fi
262
}
263
 
264
findPersistentHome() {
265
  for arg in \\\`cat /proc/cmdline\\\` ; do
266
    if [ "\\\${arg##persistenthome=}" != "\\\${arg}" ]; then
267
      homedev=\\\${arg##persistenthome=}
268
      return
269
    fi
270
  done
271
}
272
 
273
if strstr "\\\`cat /proc/cmdline\\\`" persistenthome= ; then
274
  findPersistentHome
275
elif [ -e /mnt/live/\\\${livedir}/home.img ]; then
276
  homedev=/mnt/live/\\\${livedir}/home.img
277
fi
278
 
279
# if we have a persistent /home, then we want to go ahead and mount it
280
if ! strstr "\\\`cat /proc/cmdline\\\`" nopersistenthome && [ -n "\\\$homedev" ] ; then
281
  action "Mounting persistent /home" mountPersistentHome
282
fi
283
 
284
# make it so that we don't do writing to the overlay for things which
285
# are just tmpdirs/caches
286
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
287
mount -t tmpfs tmp /tmp
288
mount -t tmpfs vartmp /var/tmp
289
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1
290
 
275 beyerleu 291
# set afs cell if given by boot parameter
292
if [ "\\\$CELL" ]; then
293
    [ -e /usr/vice/etc/ThisCell ] && echo \\\$CELL > /usr/vice/etc/ThisCell
294
fi
295
 
296
# set cups server
297
if [ "\\\$CUPS" ]; then
298
    if [ -e /etc/cups/client.conf ]; then
299
        sed -i "s|.*ServerName .*|ServerName  \\\$CUPS|" /etc/cups/client.conf
300
        grep -q ServerName /etc/cups/client.conf || echo "ServerName  \\\$CUPS" >> /etc/cups/client.conf 
301
    fi
302
fi
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
# happens if you start the LiveCD with persistent changes #
313
###########################################################
314
[ "\\\$configdone" ] && exit 0
315
 
273 beyerleu 316
# turn off services, which are not useful on LiveCD, to preserve resources
274 beyerleu 317
if [ "\\\$SERVICES_OFF" ]; then
318
    for service in \\\$SERVICES_OFF ; do
273 beyerleu 319
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
320
    done
321
fi
322
 
275 beyerleu 323
# turn on services, which are off by default
324
if [ "\\\$SERVICES_ON" ]; then
325
    for service in \\\$SERVICES_ON ; do
326
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service ofn  2>/dev/null
327
    done
328
fi
329
 
330
# services off, from command line parameter (turn it off once again)
273 beyerleu 331
if [ "\\\$SERVICEOFF" ]; then
332
    for service in \\\$( echo "\\\$SERVICEOFF" | tr ':' ' ' ); do
333
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service off 2>/dev/null
334
    done
335
fi
336
 
275 beyerleu 337
# services on, from command line parameter (turn it ofn once again)
273 beyerleu 338
if [ "\\\$SERVICEON" ]; then
339
    for service in \\\$( echo "\\\$SERVICEON" | tr ':' ' ' ); do
340
        [ -f /etc/init.d/\\\$service ] && chkconfig \\\$service on  2>/dev/null
341
    done
342
fi
343
 
269 beyerleu 344
## fix various bugs and issues
345
# unmute sound card
346
exists alsaunmute 0 2> /dev/null
347
 
270 beyerleu 348
# turn off firstboot for livecd boots
349
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
350
 
351
# start afs with option -memcache (is this correct?)
352
[ -e /etc/sysconfig/afs ] && sed -i "s|^OPTIONS=.*|OPTIONS=\"-memcache\"|" /etc/sysconfig/afs
353
 
269 beyerleu 354
# Stopgap fix for RH #217966; should be fixed in HAL instead
355
touch /media/.hal-mtab
356
 
357
## create the LiveCD default user
358
# add default user with no password
359
/usr/sbin/useradd -c "LiveCD default user" \\\$LIVECD_USER
360
/usr/bin/passwd -d \\\$LIVECD_USER > /dev/null
361
# give default user sudo privileges
362
echo "\\\$LIVECD_USER     ALL=(ALL)     NOPASSWD: ALL" >> /etc/sudoers
363
 
364
## configure default user's desktop
365
# set up timed auto-login at 10 seconds
366
cat >> /etc/gdm/custom.conf << FOE
367
[daemon]
368
TimedLoginEnable=true
369
TimedLogin=LIVECD_USER
370
TimedLoginDelay=$LOGIN_DELAY
371
FOE
372
sed -i "s|LIVECD_USER|\\\$LIVECD_USER|" /etc/gdm/custom.conf
373
 
374
# add keyboard and display configuration utilities to the desktop
375
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
376
cp /usr/share/applications/gnome-keyboard.desktop           /home/\\\$LIVECD_USER/Desktop/
377
cp /usr/share/applications/gnome-display-properties.desktop /home/\\\$LIVECD_USER/Desktop/
378
 
379
# disable screensaver locking
380
gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool   /apps/gnome-screensaver/lock_enabled "false" >/dev/null
381
 
382
# disable PackageKit update checking by default
383
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
384
 
385
# detecting disk partitions and logical volumes 
386
CreateDesktopIconHD()
387
{
388
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
389
[Desktop Entry]
390
Encoding=UTF-8
391
Version=1.0
392
Type=Link
393
Name=Local hard drives
394
Name[en_US]=Local hard drives
395
Name[fr_CA]=Disques durs locaux
396
URL=/mnt/disc
397
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
398
EOF_HDicon
399
 
400
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
401
}
402
 
403
CreateDesktopIconLVM()
404
{
405
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
406
 
407
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
408
[Desktop Entry]
409
Encoding=UTF-8
410
Version=1.0
411
Type=Link
412
Name=Local logical volumes
413
Name[en_US]=Local logical volumes
414
Name[fr_CA]=Volumes logiques locaux
415
URL=/mnt/lvm
416
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
417
EOF_LVMicon
418
 
419
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
420
}
421
 
422
# don't mount disk partitions if 'nodiskmount' is given as a boot option
423
if ! strstr "\\\`cat /proc/cmdline\\\`" nodiskmount ; then
424
	MOUNTOPTION="ro"
425
	HARD_DISKS=\\\`egrep "[sh]d.\\\$" /proc/partitions | tr -s ' ' | sed 's/^  *//' | cut -d' ' -f4\\\`
426
 
427
	echo "Mounting hard disk partitions... "
428
	for DISK in \\\$HARD_DISKS; do
429
	    # Get the device and system info from fdisk (but only for fat and linux partitions).
430
	    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-\\\`
431
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
432
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
433
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
434
		mkdir -p \\\$MOUNTPOINT
435
		MOUNTED=FALSE
436
 
437
		# get the partition type
438
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
439
		*fat*) 
440
		    FSTYPES="vfat"
441
		    EXTRAOPTIONS=",uid=500";;
442
		*)
443
		    FSTYPES="ext4 ext3 ext2"
444
		    EXTRAOPTIONS="";;
445
		esac
446
 
447
		# try to mount the partition
448
		for FSTYPE in \\\$FSTYPES; do
449
		    if mount -o "\\\${MOUNTOPTION}\\\${EXTRAOPTIONS}" -t \\\$FSTYPE \\\$PARTITION \\\$MOUNTPOINT &>/dev/null; then
450
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
451
			echo -n "\\\$PARTITION "
452
			MOUNTED=TRUE
453
			CreateDesktopIconHD
454
		    fi
455
		done
456
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
457
	    done
458
	done
459
	echo
460
fi
461
 
462
# don't mount logical volumes if 'nolvmmount' is given as a boot option
463
if ! strstr "\\\`cat /proc/cmdline\\\`" nolvmmount ; then
464
        MOUNTOPTION="ro"
465
	FSTYPES="ext4 ext3 ext2"
466
	echo "Scanning for logical volumes..."
467
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
468
	    echo "Activating logical volumes ..."
469
	    modprobe dm_mod >/dev/null
470
	    lvm vgchange -ay
471
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
472
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
473
		echo "Making device nodes ..."
474
		lvm vgmknodes
475
		echo -n "Mounting logical volumes ... "
476
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
477
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
478
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
479
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
480
		    mkdir -p \\\$MOUNTPOINT
481
 
482
		    MOUNTED=FALSE
483
		    for FSTYPE in \\\$FSTYPES; do
484
			if mount -o \\\$MOUNTOPTION -t \\\$FSTYPE \\\$VOLUME_NAME \\\$MOUNTPOINT &>/dev/null; then
485
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
486
			    echo -n "\\\$VOLUME_NAME "
487
			    MOUNTED=TRUE
488
			    CreateDesktopIconLVM
489
			    break
490
			fi
491
		    done
492
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
493
		done
494
		echo
495
 
496
	    else
497
		echo "No logical volumes found"
498
	    fi
499
	fi
500
fi
501
 
502
# give back ownership to the default user
503
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
504
 
505
EOF_initscript
506
echo ###################################################################
507
echo ## End of livesys script
508
echo ###################################################################
509
 
510
 
511
 
512
echo ###################################################################
513
echo ## Creating the livesys init script - livesys-late
514
echo ###################################################################
515
 
516
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
517
#!/bin/bash
518
#
519
# live: Late init script for live image
520
#
521
# chkconfig: 345 99 01
522
# description: Late init script for live image.
523
 
524
. /etc/init.d/functions
525
. /etc/livesys.conf
526
. /etc/init.d/livesys.functions
527
 
275 beyerleu 528
# exit if not running from LiveCD
529
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
269 beyerleu 530
    exit 0
531
fi
532
 
533
touch /.liveimg-late-configured
534
 
535
# read boot parameters out of /proc/cmdline
536
ks=\\\$( cmdline_value ks )
537
xdriver=\\\$( cmdline_value xdriver )
538
kb=\\\$( cmdline_value kb )
539
 
540
# if liveinst or textinst is given, start anaconda
541
if [ "\\\$( cmdline_parameter liveinst )" ]; then
542
   plymouth --quit
543
   /usr/sbin/liveinst \\\$ks
544
fi
545
if [ "\\\$( cmdline_parameter textinst )" ] ; then
546
   plymouth --quit
547
   /usr/sbin/liveinst --text \\\$ks
548
fi
549
 
550
# configure X, allowing user to override xdriver
551
if [ "\\\$xdriver" ]; then
552
    exists system-config-display --noui --reconfig --set-depth=24 --set-driver=\\\$xdriver
553
fi
554
 
555
# configure keyboard
556
if [ "\\\$kb" ]; then
557
    exists system-config-keyboard --noui \\\$kb 
558
fi
559
 
560
EOF_lateinitscript
561
echo ###################################################################
562
echo ## End of livesys-late script
563
echo ###################################################################
564
 
565
 
566
 
567
echo ###################################################################
568
echo ## Configure the LiveCD
569
echo ###################################################################
570
 
571
# workaround avahi segfault (#279301)
572
touch /etc/resolv.conf
573
/sbin/restorecon /etc/resolv.conf
574
 
575
chmod 755 /etc/rc.d/init.d/livesys
576
/sbin/restorecon /etc/rc.d/init.d/livesys
577
/sbin/chkconfig --add livesys
578
 
579
chmod 755 /etc/rc.d/init.d/livesys-late
580
/sbin/restorecon /etc/rc.d/init.d/livesys-late
581
/sbin/chkconfig --add livesys-late
582
 
583
# go ahead and pre-make the man -k cache (#455968)
584
/usr/sbin/makewhatis -w
585
 
586
# save a little bit of space at least...
587
rm -f /var/lib/rpm/__db*
588
rm -f /boot/initrd*
589
rm -f /boot/initramfs*
590
# make sure there aren't core files lying around
591
rm -f /core*
592
 
593
# convince readahead not to collect
594
rm -f /.readahead_collect
595
touch /var/lib/readahead/early.sorted
596
 
597
# workaround clock syncing on shutdown that we don't want (#297421)
598
sed -i -e 's/hwclock/no-such-hwclock/g' /etc/rc.d/init.d/halt
599
 
600
# import RPM GPG keys
601
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
602
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
603
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
604
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
605
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
606
 
607
# evolution is in the gnome launch panel (workaround to start thunderbird instead)
608
[ ! -e /usr/bin/evolution ] && ln -s /usr/bin/thunderbird /usr/bin/evolution
609
 
610
EOF_post
611
 
612
# run post-install script
613
/bin/bash -x /root/post-install 2>&1 | tee /root/post-install.log
614
 
615
%end
616
########################################################################
617
# End of configure LiveCD in chroot
618
########################################################################
619
 
620
 
621
 
622
%post --nochroot
623
########################################################################
624
# Post install in no chroot
625
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
626
########################################################################
627
cat > /root/postnochroot-install << EOF_postnochroot
628
#!/bin/bash
629
 
630
# Copy licensing information
631
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
632
 
633
# add livecd-iso-to-disk utility on the LiveCD
634
# only works on x86, x86_64
635
if [ "\$(uname -i)" = "i386" -o "\$(uname -i)" = "x86_64" ]; then
636
  if [ ! -d \$LIVE_ROOT/LiveOS ]; then mkdir -p \$LIVE_ROOT/LiveOS ; fi
637
  cp /usr/bin/livecd-iso-to-disk \$LIVE_ROOT/LiveOS
638
fi
639
 
640
# customize boot menu entries
641
grep -B4 'menu default'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
642
grep -B3 'xdriver=vesa'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
643
grep -A3 'label check0'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
644
grep -A2 'label memtest' \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
645
grep -A2 'label local'   \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
646
 
647
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
648
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
649
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
650
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
651
 
652
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
653
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
654
sed -i "s/liveimg/liveimg liveinst noswap nolvmmount/"                      \$LIVE_ROOT/isolinux/install.txt
655
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
656
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
657
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
658
 
659
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
660
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
661
sed -i "s/liveimg/liveimg textinst noswap nolvmmount/"                      \$LIVE_ROOT/isolinux/textinstall.txt
662
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
663
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
664
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
665
 
666
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
667
diff \$LIVE_ROOT/isolinux/isolinux.cfg \$LIVE_ROOT/isolinux/current.txt | sed '/^[0-9][0-9]*/d; s/^. //; /^---$/d' > \$LIVE_ROOT/isolinux/cleaned.txt
668
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
669
rm -f \$LIVE_ROOT/isolinux/*.txt
670
 
671
EOF_postnochroot
672
 
673
# run postnochroot-install script
674
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
675
 
676
%end
677
########################################################################
678
# End of configure LiveCD in nochroot
679
########################################################################