Subversion Repositories livecd

Rev

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

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