Subversion Repositories livecd

Rev

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

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