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