Subversion Repositories livecd

Rev

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

Rev 312 Rev 313
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
@remote-desktop-clients
-
 
65
# packages added to @remote-desktop-clients
-
 
66
rdesktop
-
 
67
tsclient
-
 
68
@x11
64
@x11
69
@ice-desktop
65
@ice-desktop
70
 
66
 
-
 
67
# remote-desktop-clients
-
 
68
rdesktop
-
 
69
tsclient
-
 
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
### don't enable the gnome-settings-daemon packagekit plugin
-
 
406
gsettings set org.gnome.settings-daemon.plugins.updates active 'false' 
-
 
407
 
-
 
408
### start system-config-firewall with su 
405
### start system-config-firewall with su 
409
#  (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)
410
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
411
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
412
 
409
 
413
### don't use prelink on a running live image
410
### don't use prelink on a running live image
414
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
415
 
412
 
416
 
413
 
417
###-----------------------------------------------------------------------
414
###-----------------------------------------------------------------------
418
# detecting disk partitions and logical volumes (disabled by default)
415
# detecting disk partitions and logical volumes (disabled by default)
419
# use boot parameter automount to enable it
416
# use boot parameter automount to enable it
420
###-----------------------------------------------------------------------
417
###-----------------------------------------------------------------------
421
 
418
 
422
CreateDesktopIconHD()
419
CreateDesktopIconHD()
423
{
420
{
424
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
421
cat > /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop << EOF_HDicon
425
[Desktop Entry]
422
[Desktop Entry]
426
Encoding=UTF-8
423
Encoding=UTF-8
427
Version=1.0
424
Version=1.0
428
Type=Link
425
Type=Link
429
Name=Local hard drives
426
Name=Local hard drives
430
Name[en_US]=Local hard drives
427
Name[en_US]=Local hard drives
431
Name[fr_CA]=Disques durs locaux
428
Name[fr_CA]=Disques durs locaux
432
URL=/mnt/disc
429
URL=/mnt/disc
433
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
430
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
434
EOF_HDicon
431
EOF_HDicon
435
 
432
 
436
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
433
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ hard\ drives.desktop
437
}
434
}
438
 
435
 
439
CreateDesktopIconLVM()
436
CreateDesktopIconLVM()
440
{
437
{
441
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
438
mkdir -p /home/\\\$LIVECD_USER/Desktop >/dev/null
442
 
439
 
443
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
440
cat > /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop << EOF_LVMicon
444
[Desktop Entry]
441
[Desktop Entry]
445
Encoding=UTF-8
442
Encoding=UTF-8
446
Version=1.0
443
Version=1.0
447
Type=Link
444
Type=Link
448
Name=Local logical volumes
445
Name=Local logical volumes
449
Name[en_US]=Local logical volumes
446
Name[en_US]=Local logical volumes
450
Name[fr_CA]=Volumes logiques locaux
447
Name[fr_CA]=Volumes logiques locaux
451
URL=/mnt/lvm
448
URL=/mnt/lvm
452
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
449
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-harddisk.png
453
EOF_LVMicon
450
EOF_LVMicon
454
 
451
 
455
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
452
chmod 755 /home/\\\$LIVECD_USER/Desktop/Local\ logical\ volumes.desktop
456
}
453
}
457
 
454
 
458
# mount disk partitions if 'automount' is given as a boot option
455
# mount disk partitions if 'automount' is given as a boot option
459
if [ "\\\$( cmdline_parameter automount )" ]; then
456
if [ "\\\$( cmdline_parameter automount )" ]; then
460
	MOUNTOPTION="rw"
457
	MOUNTOPTION="rw"
461
	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\\\`
462
 
459
 
463
	echo "Mounting hard disk partitions... "
460
	echo "Mounting hard disk partitions... "
464
	for DISK in \\\$HARD_DISKS; do
461
	for DISK in \\\$HARD_DISKS; do
465
	    # 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).
466
	    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-\\\`
467
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
464
	    for FDISK_ENTRY in \\\$FDISK_INFO; do
468
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
465
		PARTITION=\\\`echo \\\$FDISK_ENTRY | cut -d':' -f1\\\`
469
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
466
		MOUNTPOINT="/mnt/disc/\\\${PARTITION##/dev/}"
470
		mkdir -p \\\$MOUNTPOINT
467
		mkdir -p \\\$MOUNTPOINT
471
		MOUNTED=FALSE
468
		MOUNTED=FALSE
472
 
469
 
473
		# get the partition type
470
		# get the partition type
474
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
471
		case \\\`echo \\\$FDISK_ENTRY | cut -d':' -f2-\\\` in
475
		*fat*) 
472
		*fat*) 
476
		    FSTYPES="vfat"
473
		    FSTYPES="vfat"
477
		    EXTRAOPTIONS=",uid=500";;
474
		    EXTRAOPTIONS=",uid=500";;
478
		*)
475
		*)
479
		    FSTYPES="ext4 ext3 ext2"
476
		    FSTYPES="ext4 ext3 ext2"
480
		    EXTRAOPTIONS="";;
477
		    EXTRAOPTIONS="";;
481
		esac
478
		esac
482
 
479
 
483
		# try to mount the partition
480
		# try to mount the partition
484
		for FSTYPE in \\\$FSTYPES; do
481
		for FSTYPE in \\\$FSTYPES; do
485
		    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
486
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
483
			echo "\\\$PARTITION \\\$MOUNTPOINT \\\$FSTYPE noauto,\\\${MOUNTOPTION}\\\${EXTRAOPTIONS} 0 0" >> /etc/fstab
487
			echo -n "\\\$PARTITION "
484
			echo -n "\\\$PARTITION "
488
			MOUNTED=TRUE
485
			MOUNTED=TRUE
489
			CreateDesktopIconHD
486
			CreateDesktopIconHD
490
		    fi
487
		    fi
491
		done
488
		done
492
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
489
		[ \\\$MOUNTED = "FALSE" ] && rmdir \\\$MOUNTPOINT
493
	    done
490
	    done
494
	done
491
	done
495
	echo
492
	echo
496
fi
493
fi
497
 
494
 
498
# mount logical volumes if 'automount' is given as a boot option
495
# mount logical volumes if 'automount' is given as a boot option
499
if [ "\\\$( cmdline_parameter automount )" ]; then
496
if [ "\\\$( cmdline_parameter automount )" ]; then
500
        MOUNTOPTION="rw"
497
        MOUNTOPTION="rw"
501
	FSTYPES="ext4 ext3 ext2"
498
	FSTYPES="ext4 ext3 ext2"
502
	echo "Scanning for logical volumes..."
499
	echo "Scanning for logical volumes..."
503
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
500
	if ! lvm vgscan 2>&1 | grep "No volume groups"; then
504
	    echo "Activating logical volumes ..."
501
	    echo "Activating logical volumes ..."
505
	    modprobe dm_mod >/dev/null
502
	    modprobe dm_mod >/dev/null
506
	    lvm vgchange -ay
503
	    lvm vgchange -ay
507
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
504
	    LOGICAL_VOLUMES=\\\`lvm lvdisplay -c | sed "s/^  *//" | cut -d: -f1\\\`
508
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
505
	    if [ ! -z "\\\$LOGICAL_VOLUMES" ]; then
509
		echo "Making device nodes ..."
506
		echo "Making device nodes ..."
510
		lvm vgmknodes
507
		lvm vgmknodes
511
		echo -n "Mounting logical volumes ... "
508
		echo -n "Mounting logical volumes ... "
512
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
509
		for VOLUME_NAME in \\\$LOGICAL_VOLUMES; do
513
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
510
		    VG_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f3\\\`
514
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
511
		    LV_NAME=\\\`echo \\\$VOLUME_NAME | cut -d/ -f4\\\`
515
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
512
		    MOUNTPOINT="/mnt/lvm/\\\${VG_NAME}-\\\${LV_NAME}"
516
		    mkdir -p \\\$MOUNTPOINT
513
		    mkdir -p \\\$MOUNTPOINT
517
 
514
 
518
		    MOUNTED=FALSE
515
		    MOUNTED=FALSE
519
		    for FSTYPE in \\\$FSTYPES; do
516
		    for FSTYPE in \\\$FSTYPES; do
520
			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
521
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
518
			    echo "\\\$VOLUME_NAME \\\$MOUNTPOINT \\\$FSTYPE defaults,\\\${MOUNTOPTION} 0 0" >> /etc/fstab
522
			    echo -n "\\\$VOLUME_NAME "
519
			    echo -n "\\\$VOLUME_NAME "
523
			    MOUNTED=TRUE
520
			    MOUNTED=TRUE
524
			    CreateDesktopIconLVM
521
			    CreateDesktopIconLVM
525
			    break
522
			    break
526
			fi
523
			fi
527
		    done
524
		    done
528
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
525
		    [ \\\$MOUNTED = FALSE ] && rmdir \\\$MOUNTPOINT
529
		done
526
		done
530
		echo
527
		echo
531
 
528
 
532
	    else
529
	    else
533
		echo "No logical volumes found"
530
		echo "No logical volumes found"
534
	    fi
531
	    fi
535
	fi
532
	fi
536
fi
533
fi
537
 
534
 
538
### give back ownership to the default user
535
### give back ownership to the default user
539
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
536
chown -R \\\$LIVECD_USER:\\\$LIVECD_USER /home/\\\$LIVECD_USER
540
 
537
 
541
EOF_initscript
538
EOF_initscript
542
#***********************************************************************
539
#***********************************************************************
543
# End of livesys script
540
# End of livesys script
544
#***********************************************************************
541
#***********************************************************************
545
 
542
 
546
 
543
 
547
#***********************************************************************
544
#***********************************************************************
548
# 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
549
#***********************************************************************
546
#***********************************************************************
550
 
547
 
551
echo "Creating the livesys init script - livesys-late"
548
echo "Creating the livesys init script - livesys-late"
552
 
549
 
553
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
550
cat > /etc/rc.d/init.d/livesys-late << EOF_lateinitscript
554
#!/bin/bash
551
#!/bin/bash
555
#
552
#
556
# live: Late init script for live image
553
# live: Late init script for live image
557
#
554
#
558
# chkconfig: 345 99 01
555
# chkconfig: 345 99 01
559
# description: Late init script for live image.
556
# description: Late init script for live image.
560
 
557
 
561
. /etc/init.d/functions
558
. /etc/init.d/functions
562
. /etc/livesys.conf
559
. /etc/livesys.conf
563
. /etc/init.d/livesys.functions
560
. /etc/init.d/livesys.functions
564
 
561
 
565
# exit if not running from LiveCD
562
# exit if not running from LiveCD
566
if [ ! "\\\$( cmdline_parameter liveimg )" ] || [ "\\\$1" != "start" ]; then
563
if [ ! "\\\$( cmdline_parameter liveimg )" ] || [ "\\\$1" != "start" ]; then
567
    exit 0
564
    exit 0
568
fi
565
fi
569
 
566
 
570
touch /.liveimg-late-configured
567
touch /.liveimg-late-configured
571
 
568
 
572
# read boot parameters out of /proc/cmdline
569
# read boot parameters out of /proc/cmdline
573
ks=\\\$( cmdline_value ks )
570
ks=\\\$( cmdline_value ks )
574
xdriver=\\\$( cmdline_value xdriver )
571
xdriver=\\\$( cmdline_value xdriver )
575
kb=\\\$( cmdline_value kb )
572
kb=\\\$( cmdline_value kb )
576
 
573
 
577
# if liveinst or textinst is given, start anaconda
574
# if liveinst or textinst is given, start anaconda
578
if [ "\\\$( cmdline_parameter liveinst )" ]; then
575
if [ "\\\$( cmdline_parameter liveinst )" ]; then
579
   plymouth --quit
576
   plymouth --quit
580
   /usr/sbin/liveinst \\\$ks
577
   /usr/sbin/liveinst \\\$ks
581
   /sbin/reboot
578
   /sbin/reboot
582
fi
579
fi
583
if [ "\\\$( cmdline_parameter textinst )" ] ; then
580
if [ "\\\$( cmdline_parameter textinst )" ] ; then
584
   plymouth --quit
581
   plymouth --quit
585
   /usr/sbin/liveinst --text \\\$ks
582
   /usr/sbin/liveinst --text \\\$ks
586
   /sbin/reboot
583
   /sbin/reboot
587
fi
584
fi
588
 
585
 
589
# configure X, allowing user to override xdriver
586
# configure X, allowing user to override xdriver
590
if [ -n "\$xdriver" ]; then
587
if [ -n "\$xdriver" ]; then
591
   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
588
   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
592
Section "Device"
589
Section "Device"
593
        Identifier      "Videocard0"
590
        Identifier      "Videocard0"
594
        Driver  "\$xdriver"
591
        Driver  "\$xdriver"
595
EndSection
592
EndSection
596
FOE
593
FOE
597
fi
594
fi
598
 
595
 
599
# configure keyboard
596
# configure keyboard
600
if [ "\\\$kb" ]; then
597
if [ "\\\$kb" ]; then
601
    exists system-config-keyboard --noui \\\$kb 
598
    exists system-config-keyboard --noui \\\$kb 
602
fi
599
fi
603
 
600
 
604
 
601
 
605
EOF_lateinitscript
602
EOF_lateinitscript
606
#***********************************************************************
603
#***********************************************************************
607
# End of livesys-late script
604
# End of livesys-late script
608
#***********************************************************************
605
#***********************************************************************
609
 
606
 
610
 
607
 
611
#***********************************************************************
608
#***********************************************************************
612
# Configure the LiveCD
609
# Configure the LiveCD
613
# Everything configured here will survive LiveCD install to harddisk !
610
# Everything configured here will survive LiveCD install to harddisk !
614
#***********************************************************************
611
#***********************************************************************
615
 
612
 
616
echo "Configure the LiveCD"
613
echo "Configure the LiveCD"
617
 
614
 
618
chmod 755 /etc/rc.d/init.d/livesys
615
chmod 755 /etc/rc.d/init.d/livesys
619
/sbin/restorecon /etc/rc.d/init.d/livesys
616
/sbin/restorecon /etc/rc.d/init.d/livesys
620
/sbin/chkconfig --add livesys
617
/sbin/chkconfig --add livesys
621
 
618
 
622
chmod 755 /etc/rc.d/init.d/livesys-late
619
chmod 755 /etc/rc.d/init.d/livesys-late
623
/sbin/restorecon /etc/rc.d/init.d/livesys-late
620
/sbin/restorecon /etc/rc.d/init.d/livesys-late
624
/sbin/chkconfig --add livesys-late
621
/sbin/chkconfig --add livesys-late
625
 
622
 
626
# go ahead and pre-make the man -k cache (#455968)
623
# go ahead and pre-make the man -k cache (#455968)
627
/usr/sbin/makewhatis -w
624
/usr/sbin/makewhatis -w
628
 
625
 
629
# save a little bit of space at least...
626
# save a little bit of space at least...
630
rm -f /var/lib/rpm/__db*
627
rm -f /var/lib/rpm/__db*
631
rm -f /boot/initrd*
628
rm -f /boot/initrd*
632
rm -f /boot/initramfs*
629
rm -f /boot/initramfs*
633
# make sure there aren't core files lying around
630
# make sure there aren't core files lying around
634
rm -f /core*
631
rm -f /core*
635
 
632
 
636
# convince readahead not to collect
633
# convince readahead not to collect
637
rm -f /.readahead_collect
634
rm -f /.readahead_collect
638
touch /var/lib/readahead/early.sorted
635
touch /var/lib/readahead/early.sorted
639
 
636
 
640
# workaround clock syncing on shutdown that we don't want (#297421)
637
# workaround clock syncing on shutdown that we don't want (#297421)
641
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
642
 
639
 
643
# import RPM GPG keys
640
# import RPM GPG keys
644
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
641
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
645
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
642
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
646
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
643
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl6
647
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
644
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-dawson
648
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
645
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-sl
649
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
646
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
650
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms
647
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms
651
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
648
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
652
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
649
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
653
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
650
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
654
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-fabian
651
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-fabian
655
 
652
 
656
# 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)
657
[ ! -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
658
 
655
 
659
# clean up yum
656
# clean up yum
660
yum clean all
657
yum clean all
661
 
658
 
662
# workaround avahi segfault (#279301)
659
# workaround avahi segfault (#279301)
663
touch /etc/resolv.conf
660
touch /etc/resolv.conf
664
/sbin/restorecon /etc/resolv.conf
661
/sbin/restorecon /etc/resolv.conf
665
 
662
 
666
# create locate db
663
# create locate db
667
/etc/cron.daily/mlocate.cron
664
/etc/cron.daily/mlocate.cron
668
 
665
 
669
EOF_post
666
EOF_post
670
 
667
 
671
# run post-install script
668
# run post-install script
672
/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
673
 
670
 
674
%end
671
%end
675
 
672
 
676
 
673
 
677
########################################################################
674
########################################################################
678
#
675
#
679
#  LiveCD post no chroot install 
676
#  LiveCD post no chroot install 
680
#
677
#
681
########################################################################
678
########################################################################
682
%post --nochroot
679
%post --nochroot
683
 
680
 
684
#***********************************************************************
681
#***********************************************************************
685
# Create /root/postnochroot-install
682
# Create /root/postnochroot-install
686
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
683
# Must change "$" to "\$" and "`" to "\`" to avoid shell quoting
687
#***********************************************************************
684
#***********************************************************************
688
 
685
 
689
cat > /root/postnochroot-install << EOF_postnochroot
686
cat > /root/postnochroot-install << EOF_postnochroot
690
#!/bin/bash
687
#!/bin/bash
691
 
688
 
692
# Copy licensing information
689
# Copy licensing information
693
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
690
cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
694
 
691
 
-
 
692
cp -a \$LIVE_ROOT/isolinux/isolinux.cfg \$LIVE_ROOT/isolinux/isolinux.cfg.ori
-
 
693
 
695
# customize boot menu entries
694
# customize boot menu entries
696
grep -B4 'menu default'            \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
695
grep -B4 'menu default'            \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/default.txt
697
grep -B3 'xdriver=vesa nomodeset'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
696
grep -B3 'xdriver=vesa nomodeset'  \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/basicvideo.txt
698
grep -A3 'label check0'            \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
697
grep -A3 'label check0'            \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/check.txt
699
grep -A2 'label memtest'           \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
698
grep -A2 'label memtest'           \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/memtest.txt
700
grep -A2 'label local'             \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
699
grep -A2 'label local'             \$LIVE_ROOT/isolinux/isolinux.cfg > \$LIVE_ROOT/isolinux/localboot.txt
701
 
700
 
702
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
701
sed "s/label linux0/label linuxtext0/"   \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textboot.txt
703
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
702
sed -i "s/Boot/Boot (Text Mode)/"                                           \$LIVE_ROOT/isolinux/textboot.txt
704
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
703
sed -i "s/liveimg/liveimg 3/"                                               \$LIVE_ROOT/isolinux/textboot.txt
705
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
704
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textboot.txt
706
 
705
 
707
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
706
sed "s/label linux0/label install0/"     \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/install.txt
708
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
707
sed -i "s/Boot/Install/"                                                    \$LIVE_ROOT/isolinux/install.txt
709
sed -i "s/liveimg/liveimg liveinst noswap/"                                 \$LIVE_ROOT/isolinux/install.txt
708
sed -i "s/liveimg/liveimg liveinst noswap/"                                 \$LIVE_ROOT/isolinux/install.txt
710
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
709
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/install.txt
711
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
710
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/install.txt
712
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
711
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/install.txt
713
 
712
 
714
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
713
sed "s/label linux0/label textinstall0/" \$LIVE_ROOT/isolinux/default.txt > \$LIVE_ROOT/isolinux/textinstall.txt
715
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
714
sed -i "s/Boot/Install (Text Mode)/"                                        \$LIVE_ROOT/isolinux/textinstall.txt
716
sed -i "s/liveimg/liveimg textinst noswap/"                                 \$LIVE_ROOT/isolinux/textinstall.txt
715
sed -i "s/liveimg/liveimg textinst noswap/"                                 \$LIVE_ROOT/isolinux/textinstall.txt
717
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
716
sed -i "s/ quiet / /"                                                       \$LIVE_ROOT/isolinux/textinstall.txt
718
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
717
sed -i "s/ rhgb / /"                                                        \$LIVE_ROOT/isolinux/textinstall.txt
719
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
718
sed -i "/menu default/d"                                                    \$LIVE_ROOT/isolinux/textinstall.txt
720
 
719
 
721
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
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
-
 
721
 
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
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
723
cat \$LIVE_ROOT/isolinux/cleaned.txt \$LIVE_ROOT/isolinux/default.txt \$LIVE_ROOT/isolinux/textboot.txt \$LIVE_ROOT/isolinux/basicvideo.txt \$LIVE_ROOT/isolinux/install.txt \$LIVE_ROOT/isolinux/textinstall.txt \$LIVE_ROOT/isolinux/memtest.txt \$LIVE_ROOT/isolinux/localboot.txt > \$LIVE_ROOT/isolinux/isolinux.cfg
-
 
724
rm -f \$LIVE_ROOT/isolinux/*.txt
-
 
725
 
723
 
726
# SL6 comes with dracut = 004. Replace new dracut >= 008 options 
724
cat \$LIVE_ROOT/isolinux/cleaned.txt      \
727
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/isolinux/isolinux.cfg
725
    \$LIVE_ROOT/isolinux/default.txt      \
728
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/boot.conf
726
    \$LIVE_ROOT/isolinux/textboot.txt     \
729
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/bootia32.conf
727
    \$LIVE_ROOT/isolinux/basicvideo.txt   \
730
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/grub.conf
-
 
731
sed -i "s|rd.live.check|check|"  \$LIVE_ROOT/EFI/boot/isolinux.cfg
728
    \$LIVE_ROOT/isolinux/check.txt        \
732
 
-
 
733
sed -i "s|rd.luks=0|rd_NO_LUKS|" \$LIVE_ROOT/isolinux/isolinux.cfg
729
    \$LIVE_ROOT/isolinux/install.txt      \
734
sed -i "s|rd.md=0|rd_NO_MD|"     \$LIVE_ROOT/isolinux/isolinux.cfg
730
    \$LIVE_ROOT/isolinux/textinstall.txt  \
735
sed -i "s|rd.dm=0|rd_NO_DM|"     \$LIVE_ROOT/isolinux/isolinux.cfg
731
    \$LIVE_ROOT/isolinux/memtest.txt      \
736
 
-
 
737
sed -i "s|rd.luks=0|rd_NO_LUKS|" \$LIVE_ROOT/EFI/boot/isolinux.cfg
732
    \$LIVE_ROOT/isolinux/localboot.txt > \$LIVE_ROOT/isolinux/isolinux.cfg
738
sed -i "s|rd.md=0|rd_NO_MD|"     \$LIVE_ROOT/EFI/boot/isolinux.cfg
-
 
739
sed -i "s|rd.dm=0|rd_NO_DM|"     \$LIVE_ROOT/EFI/boot/isolinux.cfg
733
# rm -f \$LIVE_ROOT/isolinux/*.txt
740
 
734
 
741
EOF_postnochroot
735
EOF_postnochroot
742
 
736
 
743
# run postnochroot-install script
737
# run postnochroot-install script
744
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
738
/bin/bash -x /root/postnochroot-install 2>&1 | tee /root/postnochroot-install.log
745
 
739
 
746
%end
740
%end
747
 
741