Subversion Repositories livecd

Rev

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

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