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