Subversion Repositories livecd

Rev

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

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