Subversion Repositories livecd

Rev

Rev 382 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
381 beyerleu 1
 
2
lang en_GB.UTF-8
3
keyboard us
4
timezone Europe/Brussels --isUtc
5
auth --useshadow --enablemd5
6
selinux --enforcing
7
firewall --enabled --service=mdns
8
xconfig --startxonboot
9
part / --size 8192 --fstype ext4
10
services --enabled=NetworkManager --disabled=network,sshd
11
 
12
 
13
# Root password
14
rootpw --iscrypted $6$K2nKf02kVKG68960$OywvoaViphSITuro/liKvCj7Pm/CH/xqzz/lsoXyaKSR1lYf0vHAqSUc483a9MCCBkIwfr/hNMfqwxqVO0OEg1
15
 
16
repo --name=base --baseurl=http://ftp.scientificlinux.org/linux/scientific/7.0/x86_64/os/
17
#repo --name=base --baseurl=http://mirror.switch.ch/ftp/mirror/scientificlinux/7.0/x86_64/os/
18
 
19
%packages
20
@base
21
@core
22
@dial-up
23
@directory-client
24
@fonts
25
@gnome-desktop
26
@guest-agents
27
@guest-desktop-agents
28
@input-methods
29
@internet-browser
30
@java-platform
31
@multimedia
32
@network-file-system-client
33
@print-client
34
@x11
35
@internet-applications
36
@office-suite
37
@remote-desktop-clients
38
@gnome-apps
39
 
40
 
41
#Live install tools
42
anaconda
43
system-config-keyboard
44
firefox
45
 
46
# For UEFI/Secureboot support
47
grub2
48
grub2-efi
49
efibootmgr
50
shim
51
 
52
%end
53
 
54
%post
55
# FIXME: it'd be better to get this installed from a package
56
cat > /etc/rc.d/init.d/livesys << EOF
57
#!/bin/bash
58
#
59
# live: Init script for live image
60
#
61
# chkconfig: 345 00 99
62
# description: Init script for live image.
63
### BEGIN INIT INFO
64
# X-Start-Before: display-manager
65
### END INIT INFO
66
 
67
. /etc/init.d/functions
68
 
69
if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ]; then
70
    exit 0
71
fi
72
 
73
if [ -e /.liveimg-configured ] ; then
74
    configdone=1
75
fi
76
 
77
exists() {
78
    which \$1 >/dev/null 2>&1 || return
79
    \$*
80
}
81
 
82
# Make sure we don't mangle the hardware clock on shutdown
83
ln -sf /dev/null /etc/systemd/system/hwclock-save.service
84
 
85
livedir="LiveOS"
86
for arg in \`cat /proc/cmdline\` ; do
87
  if [ "\${arg##rd.live.dir=}" != "\${arg}" ]; then
88
    livedir=\${arg##rd.live.dir=}
89
    return
90
  fi
91
  if [ "\${arg##live_dir=}" != "\${arg}" ]; then
92
    livedir=\${arg##live_dir=}
93
    return
94
  fi
95
done
96
 
97
# enable swaps unless requested otherwise
98
swaps=\`blkid -t TYPE=swap -o device\`
99
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
100
  for s in \$swaps ; do
101
    action "Enabling swap partition \$s" swapon \$s
102
  done
103
fi
104
if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /run/initramfs/live/\${livedir}/swap.img ] ; then
105
  action "Enabling swap file" swapon /run/initramfs/live/\${livedir}/swap.img
106
fi
107
 
108
mountPersistentHome() {
109
  # support label/uuid
110
  if [ "\${homedev##LABEL=}" != "\${homedev}" -o "\${homedev##UUID=}" != "\${homedev}" ]; then
111
    homedev=\`/sbin/blkid -o device -t "\$homedev"\`
112
  fi
113
 
114
  # if we're given a file rather than a blockdev, loopback it
115
  if [ "\${homedev##mtd}" != "\${homedev}" ]; then
116
    # mtd devs don't have a block device but get magic-mounted with -t jffs2
117
    mountopts="-t jffs2"
118
  elif [ ! -b "\$homedev" ]; then
119
    loopdev=\`losetup -f\`
120
    if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then
121
      action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
122
    fi
123
    losetup \$loopdev \$homedev
124
    homedev=\$loopdev
125
  fi
126
 
127
  # if it's encrypted, we need to unlock it
128
  if [ "\$(/sbin/blkid -s TYPE -o value \$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
129
    echo
130
    echo "Setting up encrypted /home device"
131
    plymouth ask-for-password --command="cryptsetup luksOpen \$homedev EncHome"
132
    homedev=/dev/mapper/EncHome
133
  fi
134
 
135
  # and finally do the mount
136
  mount \$mountopts \$homedev /home
137
  # if we have /home under what's passed for persistent home, then
138
  # we should make that the real /home.  useful for mtd device on olpc
139
  if [ -d /home/home ]; then mount --bind /home/home /home ; fi
140
  [ -x /sbin/restorecon ] && /sbin/restorecon /home
141
  if [ -d /home/liveuser ]; then USERADDARGS="-M" ; fi
142
}
143
 
144
findPersistentHome() {
145
  for arg in \`cat /proc/cmdline\` ; do
146
    if [ "\${arg##persistenthome=}" != "\${arg}" ]; then
147
      homedev=\${arg##persistenthome=}
148
      return
149
    fi
150
  done
151
}
152
 
153
if strstr "\`cat /proc/cmdline\`" persistenthome= ; then
154
  findPersistentHome
155
elif [ -e /run/initramfs/live/\${livedir}/home.img ]; then
156
  homedev=/run/initramfs/live/\${livedir}/home.img
157
fi
158
 
159
# if we have a persistent /home, then we want to go ahead and mount it
160
if ! strstr "\`cat /proc/cmdline\`" nopersistenthome && [ -n "\$homedev" ] ; then
161
  action "Mounting persistent /home" mountPersistentHome
162
fi
163
 
164
# make it so that we don't do writing to the overlay for things which
165
# are just tmpdirs/caches
166
mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
167
mount -t tmpfs vartmp /var/tmp
168
[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /var/tmp >/dev/null 2>&1
169
 
170
if [ -n "\$configdone" ]; then
171
  exit 0
172
fi
173
 
174
# add live user with no passwd
175
action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser
176
passwd -d liveuser > /dev/null
177
usermod -aG wheel liveuser > /dev/null
178
 
179
# Remove root password lock
180
passwd -d root > /dev/null
181
 
182
# turn off firstboot for livecd boots
183
systemctl --no-reload disable firstboot-text.service 2> /dev/null || :
184
systemctl --no-reload disable firstboot-graphical.service 2> /dev/null || :
185
systemctl stop firstboot-text.service 2> /dev/null || :
186
systemctl stop firstboot-graphical.service 2> /dev/null || :
187
 
188
# don't use prelink on a running live image
189
sed -i 's/PRELINKING=yes/PRELINKING=no/' /etc/sysconfig/prelink &>/dev/null || :
190
 
191
# turn off mdmonitor by default
192
systemctl --no-reload disable mdmonitor.service 2> /dev/null || :
193
systemctl --no-reload disable mdmonitor-takeover.service 2> /dev/null || :
194
systemctl stop mdmonitor.service 2> /dev/null || :
195
systemctl stop mdmonitor-takeover.service 2> /dev/null || :
196
 
197
# don't enable the gnome-settings-daemon packagekit plugin
198
gsettings set org.gnome.settings-daemon.plugins.updates active 'false' || :
199
 
200
# don't start cron/at as they tend to spawn things which are
201
# disk intensive that are painful on a live image
202
systemctl --no-reload disable crond.service 2> /dev/null || :
203
systemctl --no-reload disable atd.service 2> /dev/null || :
204
systemctl stop crond.service 2> /dev/null || :
205
systemctl stop atd.service 2> /dev/null || :
206
 
207
# Mark things as configured
208
touch /.liveimg-configured
209
 
210
# add static hostname to work around xauth bug
211
# https://bugzilla.redhat.com/show_bug.cgi?id=679486
212
echo "localhost" > /etc/hostname
213
 
214
# Fixing the lang install issue when other lang than English is selected . See http://bugs.centos.org/view.php?id=7217
215
/usr/bin/cp /usr/lib/python2.7/site-packages/blivet/size.py /usr/lib/python2.7/site-packages/blivet/size.py.orig
216
/usr/bin/sed -i "s#return self.humanReadable()#return self.humanReadable().encode('utf-8')#g" /usr/lib/python2.7/site-packages/blivet/size.py
217
 
218
EOF
219
 
220
# bah, hal starts way too late
221
cat > /etc/rc.d/init.d/livesys-late << EOF
222
#!/bin/bash
223
#
224
# live: Late init script for live image
225
#
226
# chkconfig: 345 99 01
227
# description: Late init script for live image.
228
 
229
. /etc/init.d/functions
230
 
231
if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
232
    exit 0
233
fi
234
 
235
exists() {
236
    which \$1 >/dev/null 2>&1 || return
237
    \$*
238
}
239
 
240
touch /.liveimg-late-configured
241
 
242
# read some variables out of /proc/cmdline
243
for o in \`cat /proc/cmdline\` ; do
244
    case \$o in
245
    ks=*)
246
        ks="--kickstart=\${o#ks=}"
247
        ;;
248
    xdriver=*)
249
        xdriver="\${o#xdriver=}"
250
        ;;
251
    esac
252
done
253
 
254
# if liveinst or textinst is given, start anaconda
255
if strstr "\`cat /proc/cmdline\`" liveinst ; then
256
   plymouth --quit
257
   /usr/sbin/liveinst \$ks
258
fi
259
if strstr "\`cat /proc/cmdline\`" textinst ; then
260
   plymouth --quit
261
   /usr/sbin/liveinst --text \$ks
262
fi
263
 
264
# configure X, allowing user to override xdriver
265
if [ -n "\$xdriver" ]; then
266
   cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
267
Section "Device"
268
	Identifier	"Videocard0"
269
	Driver	"\$xdriver"
270
EndSection
271
FOE
272
fi
273
 
274
EOF
275
 
276
chmod 755 /etc/rc.d/init.d/livesys
277
/sbin/restorecon /etc/rc.d/init.d/livesys
278
/sbin/chkconfig --add livesys
279
 
280
chmod 755 /etc/rc.d/init.d/livesys-late
281
/sbin/restorecon /etc/rc.d/init.d/livesys-late
282
/sbin/chkconfig --add livesys-late
283
 
284
# enable tmpfs for /tmp
285
systemctl enable tmp.mount
286
 
287
# work around for poor key import UI in PackageKit
288
rm -f /var/lib/rpm/__db*
289
releasever=$(rpm -q --qf '%{version}\n' --whatprovides system-release)
290
basearch=$(uname -i)
291
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
292
echo "Packages within this LiveCD"
293
rpm -qa
294
# Note that running rpm recreates the rpm db files which aren't needed or wanted
295
rm -f /var/lib/rpm/__db*
296
 
297
# go ahead and pre-make the man -k cache (#455968)
298
/usr/bin/mandb
299
 
300
# save a little bit of space at least...
301
rm -f /boot/initramfs*
302
# make sure there aren't core files lying around
303
rm -f /core*
304
 
305
# convince readahead not to collect
306
# FIXME: for systemd
307
 
308
cat >> /etc/rc.d/init.d/livesys << EOF
309
 
310
 
311
# disable updates plugin
312
cat >> /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override << FOE
313
[org.gnome.settings-daemon.plugins.updates]
314
active=false
315
FOE
316
 
317
# Show the system-config-keyboard tool on the desktop
318
mkdir /home/liveuser/Desktop -p >/dev/null
319
cat /usr/share/applications/system-config-keyboard.desktop | sed '/NotShowIn/d' |sed 's/Terminal=false/Terminal=true/' > /home/liveuser/Desktop/system-config-keyboard.desktop
320
cat /usr/share/applications/liveinst.desktop | sed '/NoDisplay/d' > /home/liveuser/Desktop/liveinst.desktop 
321
chmod +x /home/liveuser/Desktop/*.desktop
322
chown -R liveuser:liveuser /home/liveuser
323
 
324
# Liveuser face
325
if [ -e /usr/share/icons/hicolor/96x96/apps/fedora-logo-icon.png ] ; then
326
    cp /usr/share/icons/hicolor/96x96/apps/fedora-logo-icon.png /home/liveuser/.face
327
    chown liveuser:liveuser /home/liveuser/.face
328
fi
329
 
330
# make the installer show up
331
if [ -f /usr/share/applications/liveinst.desktop ]; then
332
  # Show harddisk install in shell dash
333
  sed -i -e 's/NoDisplay=true/NoDisplay=false/' /usr/share/applications/liveinst.desktop 
334
  # need to move it to anaconda.desktop to make shell happy
335
  #cp /usr/share/applications/liveinst.desktop /usr/share/applications/anaconda.desktop
336
fi
337
  cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE
338
[org.gnome.shell]
339
favorite-apps=['liveinst.desktop','firefox.desktop', 'evolution.desktop', 'empathy.desktop', 'rhythmbox.desktop', 'shotwell.desktop', 'libreoffice-writer.desktop', 'nautilus.desktop', 'gnome-documents.desktop', 'anaconda.desktop']
340
FOE
341
 
342
 
343
# set up auto-login
344
cat > /etc/gdm/custom.conf << FOE
345
[daemon]
346
AutomaticLoginEnable=True
347
AutomaticLogin=liveuser
348
FOE
349
 
350
# Turn off PackageKit-command-not-found while uninstalled
351
if [ -f /etc/PackageKit/CommandNotFound.conf ]; then
352
  sed -i -e 's/^SoftwareSourceSearch=true/SoftwareSourceSearch=false/' /etc/PackageKit/CommandNotFound.conf
353
fi
354
 
355
# make sure to set the right permissions and selinux contexts
356
chown -R liveuser:liveuser /home/liveuser/
357
restorecon -R /home/liveuser/
358
 
359
# Fixing default locale to us
360
localectl set-keymap us
361
localectl set-x11-keymap us
362
EOF
363
 
364
# rebuild schema cache with any overrides we installed
365
glib-compile-schemas /usr/share/glib-2.0/schemas
366
 
367
 
368
%end