Subversion Repositories livecd

Rev

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

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