Subversion Repositories livecd

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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