Subversion Repositories livecd

Rev

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