Subversion Repositories livecd

Rev

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