Subversion Repositories livecd

Rev

Rev 311 | 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
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
@remote-desktop-clients
280 beyerleu 65
# packages added to @remote-desktop-clients
66
rdesktop
67
tsclient
278 beyerleu 68
@x11
289 beyerleu 69
@ice-desktop
278 beyerleu 70
 
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
 
310 beyerleu 405
### don't enable the gnome-settings-daemon packagekit plugin
406
gsettings set org.gnome.settings-daemon.plugins.updates active 'false' 
407
 
287 beyerleu 408
### start system-config-firewall with su 
409
#  (bugfix: system-config-firewall does not work when root has no password)
281 beyerleu 410
sed -i "s|^Exec=.*|Exec=su - -c /usr/bin/system-config-firewall|" /usr/share/applications/system-config-firewall.desktop
286 beyerleu 411
sed -i "s|^Terminal=.*|Terminal=true|"                            /usr/share/applications/system-config-firewall.desktop
276 beyerleu 412
 
310 beyerleu 413
### don't use prelink on a running live image
414
sed -i 's/PRELINKING=yes/PRELINKING=no/' /etc/sysconfig/prelink &>/dev/null
287 beyerleu 415
 
310 beyerleu 416
 
287 beyerleu 417
###-----------------------------------------------------------------------
286 beyerleu 418
# detecting disk partitions and logical volumes (disabled by default)
419
# use boot parameter automount to enable it
287 beyerleu 420
###-----------------------------------------------------------------------
278 beyerleu 421
 
269 beyerleu 422
CreateDesktopIconHD()
423
{
424
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
425
[Desktop Entry]
426
Encoding=UTF-8
427
Version=1.0
428
Type=Link
429
Name=Local hard drives
430
Name[en_US]=Local hard drives
431
Name[fr_CA]=Disques durs locaux
432
URL=/mnt/disc
433
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
434
EOF_HDicon
435
 
436
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
437
}
438
 
439
CreateDesktopIconLVM()
440
{
441
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
442
 
443
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
444
[Desktop Entry]
445
Encoding=UTF-8
446
Version=1.0
447
Type=Link
448
Name=Local logical volumes
449
Name[en_US]=Local logical volumes
450
Name[fr_CA]=Volumes logiques locaux
451
URL=/mnt/lvm
452
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
453
EOF_LVMicon
454
 
455
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
456
}
457
 
276 beyerleu 458
# mount disk partitions if 'automount' is given as a boot option
459
if [ "\\\$( cmdline_parameter automount )" ]; then
460
	MOUNTOPTION="rw"
269 beyerleu 461
	HARD_DISKS=\\\`egrep "[sh]d.\\\$" /proc/partitions | tr -s ' ' | sed 's/^  *//' | cut -d' ' -f4\\\`
462
 
463
	echo "Mounting hard disk partitions... "
464
	for DISK in \\\$HARD_DISKS; do
465
	    # Get the device and system info from fdisk (but only for fat and linux partitions).
466
	    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-\\\`
467
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
468
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
469
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
470
		mkdir -p \\\$MOUNTPOINT
471
		MOUNTED=FALSE
472
 
473
		# get the partition type
474
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
475
		*fat*) 
476
		    FSTYPES="vfat"
477
		    EXTRAOPTIONS=",uid=500";;
478
		*)
479
		    FSTYPES="ext4 ext3 ext2"
480
		    EXTRAOPTIONS="";;
481
		esac
482
 
483
		# try to mount the partition
484
		for FSTYPE in \\\$FSTYPES; do
485
		    if mount -o "\\\${MOUNTOPTION}\\\${EXTRAOPTIONS}" -t \\\$FSTYPE \\\$PARTITION \\\$MOUNTPOINT &>/dev/null; then
486
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
487
			echo -n "\\\$PARTITION "
488
			MOUNTED=TRUE
489
			CreateDesktopIconHD
490
		    fi
491
		done
492
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
493
	    done
494
	done
495
	echo
496
fi
497
 
276 beyerleu 498
# mount logical volumes if 'automount' is given as a boot option
499
if [ "\\\$( cmdline_parameter automount )" ]; then
500
        MOUNTOPTION="rw"
269 beyerleu 501
	FSTYPES="ext4 ext3 ext2"
502
	echo "Scanning for logical volumes..."
503
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
504
	    echo "Activating logical volumes ..."
505
	    modprobe dm_mod >/dev/null
506
	    lvm vgchange -ay
507
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
508
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
509
		echo "Making device nodes ..."
510
		lvm vgmknodes
511
		echo -n "Mounting logical volumes ... "
512
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
513
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
514
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
515
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
516
		    mkdir -p \\\$MOUNTPOINT
517
 
518
		    MOUNTED=FALSE
519
		    for FSTYPE in \\\$FSTYPES; do
520
			if mount -o \\\$MOUNTOPTION -t \\\$FSTYPE \\\$VOLUME_NAME \\\$MOUNTPOINT &>/dev/null; then
521
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
522
			    echo -n "\\\$VOLUME_NAME "
523
			    MOUNTED=TRUE
524
			    CreateDesktopIconLVM
525
			    break
526
			fi
527
		    done
528
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
529
		done
530
		echo
531
 
532
	    else
533
		echo "No logical volumes found"
534
	    fi
535
	fi
536
fi
537
 
287 beyerleu 538
### give back ownership to the default user
269 beyerleu 539
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
540
 
541
EOF_initscript
286 beyerleu 542
#***********************************************************************
543
# End of livesys script
544
#***********************************************************************
269 beyerleu 545
 
546
 
286 beyerleu 547
#***********************************************************************
548
# Create the livesys init script - /etc/rc.d/init.d/livesys-late
549
#***********************************************************************
269 beyerleu 550
 
286 beyerleu 551
echo "Creating the livesys init script - livesys-late"
269 beyerleu 552
 
553
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
554
#!/bin/bash
555
#
556
# live: Late init script for live image
557
#
558
# chkconfig: 345 99 01
559
# description: Late init script for live image.
560
 
561
. /etc/init.d/functions
562
. /etc/livesys.conf
563
. /etc/init.d/livesys.functions
564
 
275 beyerleu 565
# exit if not running from LiveCD
310 beyerleu 566
if [ ! "\\\$( cmdline_parameter liveimg )" ] || [ "\\\$1" != "start" ]; then
269 beyerleu 567
    exit 0
568
fi
569
 
570
touch /.liveimg-late-configured
571
 
572
# read boot parameters out of /proc/cmdline
573
ks=\\\$( cmdline_value ks )
574
xdriver=\\\$( cmdline_value xdriver )
575
kb=\\\$( cmdline_value kb )
576
 
577
# if liveinst or textinst is given, start anaconda
578
if [ "\\\$( cmdline_parameter liveinst )" ]; then
579
   plymouth --quit
580
   /usr/sbin/liveinst \\\$ks
291 beyerleu 581
   /sbin/reboot
269 beyerleu 582
fi
583
if [ "\\\$( cmdline_parameter textinst )" ] ; then
584
   plymouth --quit
585
   /usr/sbin/liveinst --text \\\$ks
291 beyerleu 586
   /sbin/reboot
269 beyerleu 587
fi
588
 
589
# configure X, allowing user to override xdriver
310 beyerleu 590
if [ -n "\$xdriver" ]; then
591
   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
592
Section "Device"
593
        Identifier      "Videocard0"
594
        Driver  "\$xdriver"
595
EndSection
596
FOE
269 beyerleu 597
fi
598
 
599
# configure keyboard
600
if [ "\\\$kb" ]; then
601
    exists system-config-keyboard --noui \\\$kb 
602
fi
603
 
310 beyerleu 604
 
269 beyerleu 605
EOF_lateinitscript
286 beyerleu 606
#***********************************************************************
607
# End of livesys-late script
608
#***********************************************************************
269 beyerleu 609
 
610
 
286 beyerleu 611
#***********************************************************************
612
# Configure the LiveCD
292 beyerleu 613
# Everything configured here will survive LiveCD install to harddisk !
286 beyerleu 614
#***********************************************************************
269 beyerleu 615
 
286 beyerleu 616
echo "Configure the LiveCD"
269 beyerleu 617
 
618
chmod 755 /etc/rc.d/init.d/livesys
619
/sbin/restorecon /etc/rc.d/init.d/livesys
620
/sbin/chkconfig --add livesys
621
 
622
chmod 755 /etc/rc.d/init.d/livesys-late
623
/sbin/restorecon /etc/rc.d/init.d/livesys-late
624
/sbin/chkconfig --add livesys-late
625
 
626
# go ahead and pre-make the man -k cache (#455968)
627
/usr/sbin/makewhatis -w
628
 
629
# save a little bit of space at least...
630
rm -f /var/lib/rpm/__db*
631
rm -f /boot/initrd*
632
rm -f /boot/initramfs*
633
# make sure there aren't core files lying around
634
rm -f /core*
635
 
636
# convince readahead not to collect
637
rm -f /.readahead_collect
638
touch /var/lib/readahead/early.sorted
639
 
640
# workaround clock syncing on shutdown that we don't want (#297421)
641
sed -i -e 's/hwclock/no-such-hwclock/g' /etc/rc.d/init.d/halt
642
 
643
# import RPM GPG keys
644
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
645
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
646
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
647
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
648
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
295 beyerleu 649
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
650
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms
651
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
652
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
653
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
654
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-fabian
269 beyerleu 655
 
280 beyerleu 656
# evolution is in the gnome launch panel (bad workaround to start thunderbird instead)
269 beyerleu 657
[ ! -e /usr/bin/evolution ] && ln -s /usr/bin/thunderbird /usr/bin/evolution
658
 
292 beyerleu 659
# clean up yum
660
yum clean all
661
 
662
# workaround avahi segfault (#279301)
663
touch /etc/resolv.conf
664
/sbin/restorecon /etc/resolv.conf
665
 
295 beyerleu 666
# create locate db
667
/etc/cron.daily/mlocate.cron
668
 
269 beyerleu 669
EOF_post
670
 
671
# run post-install script
672
/bin/bash -x /root/post-install 2>&1 | tee /root/post-install.log
673
 
674
%end
675
 
676
 
286 beyerleu 677
########################################################################
678
#
679
#  LiveCD post no chroot install 
680
#
681
########################################################################
682
%post --nochroot
285 beyerleu 683
 
286 beyerleu 684
#***********************************************************************
685
# Create /root/postnochroot-install
285 beyerleu 686
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
286 beyerleu 687
#***********************************************************************
688
 
269 beyerleu 689
cat > /root/postnochroot-install << EOF_postnochroot
690
#!/bin/bash
691
 
692
# Copy licensing information
693
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
694
 
695
# customize boot menu entries
311 beyerleu 696
grep -B4 'menu default'            \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
697
grep -B3 'xdriver=vesa nomodeset'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
698
grep -A3 'label check0'            \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
699
grep -A2 'label memtest'           \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
700
grep -A2 'label local'             \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
269 beyerleu 701
 
702
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
703
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
704
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
705
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
706
 
707
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
708
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
276 beyerleu 709
sed -i "s/liveimg/liveimg liveinst noswap/"                                 \$LIVE_ROOT/isolinux/install.txt
269 beyerleu 710
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
711
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
712
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
713
 
714
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
715
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
276 beyerleu 716
sed -i "s/liveimg/liveimg textinst noswap/"                                 \$LIVE_ROOT/isolinux/textinstall.txt
269 beyerleu 717
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
718
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
719
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
720
 
721
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
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
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
724
rm -f \$LIVE_ROOT/isolinux/*.txt
725
 
301 beyerleu 726
# SL6 comes with dracut = 004. Replace new dracut >= 008 options 
727
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/isolinux/isolinux.cfg
728
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/boot.conf
729
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/bootia32.conf
730
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/grub.conf
731
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/isolinux.cfg
732
 
733
sed -i "s|rd.luks=0|rd_NO_LUKS|" \$LIVE_ROOT/isolinux/isolinux.cfg
734
sed -i "s|rd.md=0|rd_NO_MD|"     \$LIVE_ROOT/isolinux/isolinux.cfg
735
sed -i "s|rd.dm=0|rd_NO_DM|"     \$LIVE_ROOT/isolinux/isolinux.cfg
736
 
737
sed -i "s|rd.luks=0|rd_NO_LUKS|" \$LIVE_ROOT/EFI/boot/isolinux.cfg
738
sed -i "s|rd.md=0|rd_NO_MD|"     \$LIVE_ROOT/EFI/boot/isolinux.cfg
739
sed -i "s|rd.dm=0|rd_NO_DM|"     \$LIVE_ROOT/EFI/boot/isolinux.cfg
740
 
269 beyerleu 741
EOF_postnochroot
742
 
743
# run postnochroot-install script
744
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
745
 
746
%end
298 beyerleu 747