Subversion Repositories livecd

Rev

Rev 274 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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