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
 
277 beyerleu 385
 
386
### detecting disk partitions and logical volumes (disabled by default)
387
### use boot parameter automount to enable it
388
 
269 beyerleu 389
CreateDesktopIconHD()
390
{
391
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
392
[Desktop Entry]
393
Encoding=UTF-8
394
Version=1.0
395
Type=Link
396
Name=Local hard drives
397
Name[en_US]=Local hard drives
398
Name[fr_CA]=Disques durs locaux
399
URL=/mnt/disc
400
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
401
EOF_HDicon
402
 
403
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
404
}
405
 
406
CreateDesktopIconLVM()
407
{
408
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
409
 
410
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
411
[Desktop Entry]
412
Encoding=UTF-8
413
Version=1.0
414
Type=Link
415
Name=Local logical volumes
416
Name[en_US]=Local logical volumes
417
Name[fr_CA]=Volumes logiques locaux
418
URL=/mnt/lvm
419
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
420
EOF_LVMicon
421
 
422
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
423
}
424
 
277 beyerleu 425
# mount disk partitions if 'automount' is given as a boot option
426
if [ "\\\$( cmdline_parameter automount )" ]; then
427
	MOUNTOPTION="rw"
269 beyerleu 428
	HARD_DISKS=\\\`egrep "[sh]d.\\\$" /proc/partitions | tr -s ' ' | sed 's/^  *//' | cut -d' ' -f4\\\`
429
 
430
	echo "Mounting hard disk partitions... "
431
	for DISK in \\\$HARD_DISKS; do
432
	    # Get the device and system info from fdisk (but only for fat and linux partitions).
433
	    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-\\\`
434
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
435
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
436
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
437
		mkdir -p \\\$MOUNTPOINT
438
		MOUNTED=FALSE
439
 
440
		# get the partition type
441
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
442
		*fat*) 
443
		    FSTYPES="vfat"
444
		    EXTRAOPTIONS=",uid=500";;
445
		*)
446
		    FSTYPES="ext4 ext3 ext2"
447
		    EXTRAOPTIONS="";;
448
		esac
449
 
450
		# try to mount the partition
451
		for FSTYPE in \\\$FSTYPES; do
452
		    if mount -o "\\\${MOUNTOPTION}\\\${EXTRAOPTIONS}" -t \\\$FSTYPE \\\$PARTITION \\\$MOUNTPOINT &>/dev/null; then
453
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
454
			echo -n "\\\$PARTITION "
455
			MOUNTED=TRUE
456
			CreateDesktopIconHD
457
		    fi
458
		done
459
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
460
	    done
461
	done
462
	echo
463
fi
464
 
277 beyerleu 465
# mount logical volumes if 'automount' is given as a boot option
466
if [ "\\\$( cmdline_parameter automount )" ]; then
467
        MOUNTOPTION="rw"
269 beyerleu 468
	FSTYPES="ext4 ext3 ext2"
469
	echo "Scanning for logical volumes..."
470
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
471
	    echo "Activating logical volumes ..."
472
	    modprobe dm_mod >/dev/null
473
	    lvm vgchange -ay
474
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
475
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
476
		echo "Making device nodes ..."
477
		lvm vgmknodes
478
		echo -n "Mounting logical volumes ... "
479
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
480
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
481
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
482
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
483
		    mkdir -p \\\$MOUNTPOINT
484
 
485
		    MOUNTED=FALSE
486
		    for FSTYPE in \\\$FSTYPES; do
487
			if mount -o \\\$MOUNTOPTION -t \\\$FSTYPE \\\$VOLUME_NAME \\\$MOUNTPOINT &>/dev/null; then
488
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
489
			    echo -n "\\\$VOLUME_NAME "
490
			    MOUNTED=TRUE
491
			    CreateDesktopIconLVM
492
			    break
493
			fi
494
		    done
495
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
496
		done
497
		echo
498
 
499
	    else
500
		echo "No logical volumes found"
501
	    fi
502
	fi
503
fi
504
 
505
# give back ownership to the default user
506
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
507
 
508
EOF_initscript
509
echo ###################################################################
510
echo ## End of livesys script
511
echo ###################################################################
512
 
513
 
514
 
515
echo ###################################################################
516
echo ## Creating the livesys init script - livesys-late
517
echo ###################################################################
518
 
519
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
520
#!/bin/bash
521
#
522
# live: Late init script for live image
523
#
524
# chkconfig: 345 99 01
525
# description: Late init script for live image.
526
 
527
. /etc/init.d/functions
528
. /etc/livesys.conf
529
. /etc/init.d/livesys.functions
530
 
275 beyerleu 531
# exit if not running from LiveCD
532
if ! strstr "\\\`cat /proc/cmdline\\\`" liveimg || [ "\\\$1" != "start" ]; then
269 beyerleu 533
    exit 0
534
fi
535
 
536
touch /.liveimg-late-configured
537
 
538
# read boot parameters out of /proc/cmdline
539
ks=\\\$( cmdline_value ks )
540
xdriver=\\\$( cmdline_value xdriver )
541
kb=\\\$( cmdline_value kb )
542
 
543
# if liveinst or textinst is given, start anaconda
544
if [ "\\\$( cmdline_parameter liveinst )" ]; then
545
   plymouth --quit
546
   /usr/sbin/liveinst \\\$ks
547
fi
548
if [ "\\\$( cmdline_parameter textinst )" ] ; then
549
   plymouth --quit
550
   /usr/sbin/liveinst --text \\\$ks
551
fi
552
 
553
# configure X, allowing user to override xdriver
554
if [ "\\\$xdriver" ]; then
555
    exists system-config-display --noui --reconfig --set-depth=24 --set-driver=\\\$xdriver
556
fi
557
 
558
# configure keyboard
559
if [ "\\\$kb" ]; then
560
    exists system-config-keyboard --noui \\\$kb 
561
fi
562
 
563
EOF_lateinitscript
564
echo ###################################################################
565
echo ## End of livesys-late script
566
echo ###################################################################
567
 
568
 
569
 
570
echo ###################################################################
571
echo ## Configure the LiveCD
572
echo ###################################################################
573
 
574
# workaround avahi segfault (#279301)
575
touch /etc/resolv.conf
576
/sbin/restorecon /etc/resolv.conf
577
 
578
chmod 755 /etc/rc.d/init.d/livesys
579
/sbin/restorecon /etc/rc.d/init.d/livesys
580
/sbin/chkconfig --add livesys
581
 
582
chmod 755 /etc/rc.d/init.d/livesys-late
583
/sbin/restorecon /etc/rc.d/init.d/livesys-late
584
/sbin/chkconfig --add livesys-late
585
 
586
# go ahead and pre-make the man -k cache (#455968)
587
/usr/sbin/makewhatis -w
588
 
589
# save a little bit of space at least...
590
rm -f /var/lib/rpm/__db*
591
rm -f /boot/initrd*
592
rm -f /boot/initramfs*
593
# make sure there aren't core files lying around
594
rm -f /core*
595
 
596
# convince readahead not to collect
597
rm -f /.readahead_collect
598
touch /var/lib/readahead/early.sorted
599
 
600
# workaround clock syncing on shutdown that we don't want (#297421)
601
sed -i -e 's/hwclock/no-such-hwclock/g' /etc/rc.d/init.d/halt
602
 
603
# import RPM GPG keys
604
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
605
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
606
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
607
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
608
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
609
 
610
# evolution is in the gnome launch panel (workaround to start thunderbird instead)
611
[ ! -e /usr/bin/evolution ] && ln -s /usr/bin/thunderbird /usr/bin/evolution
612
 
613
EOF_post
614
 
615
# run post-install script
616
/bin/bash -x /root/post-install 2>&1 | tee /root/post-install.log
617
 
618
%end
619
########################################################################
620
# End of configure LiveCD in chroot
621
########################################################################
622
 
623
 
624
 
625
%post --nochroot
626
########################################################################
627
# Post install in no chroot
628
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
629
########################################################################
630
cat > /root/postnochroot-install << EOF_postnochroot
631
#!/bin/bash
632
 
633
# Copy licensing information
634
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
635
 
636
# add livecd-iso-to-disk utility on the LiveCD
637
# only works on x86, x86_64
638
if [ "\$(uname -i)" = "i386" -o "\$(uname -i)" = "x86_64" ]; then
639
  if [ ! -d \$LIVE_ROOT/LiveOS ]; then mkdir -p \$LIVE_ROOT/LiveOS ; fi
640
  cp /usr/bin/livecd-iso-to-disk \$LIVE_ROOT/LiveOS
641
fi
642
 
643
# customize boot menu entries
644
grep -B4 'menu default'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
645
grep -B3 'xdriver=vesa'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
646
grep -A3 'label check0'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
647
grep -A2 'label memtest' \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
648
grep -A2 'label local'   \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
649
 
650
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
651
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
652
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
653
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
654
 
655
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
656
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
277 beyerleu 657
sed -i "s/liveimg/liveimg liveinst noswap/"                                 \$LIVE_ROOT/isolinux/install.txt
269 beyerleu 658
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
659
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
660
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
661
 
662
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
663
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
277 beyerleu 664
sed -i "s/liveimg/liveimg textinst noswap/"                                 \$LIVE_ROOT/isolinux/textinstall.txt
269 beyerleu 665
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
666
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
667
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
668
 
669
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
670
diff \$LIVE_ROOT/isolinux/isolinux.cfg \$LIVE_ROOT/isolinux/current.txt | sed '/^[0-9][0-9]*/d; s/^. //; /^---$/d' > \$LIVE_ROOT/isolinux/cleaned.txt
671
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
672
rm -f \$LIVE_ROOT/isolinux/*.txt
673
 
674
EOF_postnochroot
675
 
676
# run postnochroot-install script
677
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
678
 
679
%end
680
########################################################################
681
# End of configure LiveCD in nochroot
682
########################################################################