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