Subversion Repositories livecd

Rev

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