Subversion Repositories livecd

Rev

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