Subversion Repositories livecd

Rev

Rev 295 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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