Subversion Repositories livecd

Rev

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

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