Subversion Repositories livecd

Rev

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