Subversion Repositories livecd

Rev

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