Subversion Repositories livecd

Rev

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

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