Subversion Repositories livecd

Rev

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