Subversion Repositories livecd

Rev

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