Subversion Repositories livecd

Rev

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