Subversion Repositories livecd

Rev

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