|
| 1 | +# Lorax Composer Live ISO output kickstart template |
| 2 | + |
| 3 | +# |
| 4 | +sshpw --username=root --plaintext randOmStrinGhERE |
| 5 | +# Firewall configuration |
| 6 | +firewall --enabled --service=mdns |
| 7 | + |
| 8 | +# X Window System configuration information |
| 9 | +xconfig --startxonboot |
| 10 | +# Root password |
| 11 | +rootpw --plaintext removethispw |
| 12 | +# Network information |
| 13 | +network --bootproto=dhcp --onboot=on --activate |
| 14 | +# System authorization information |
| 15 | +auth --useshadow --enablemd5 |
| 16 | +# System keyboard |
| 17 | +keyboard --xlayouts=us --vckeymap=us |
| 18 | +# System language |
| 19 | +lang en_US.UTF-8 |
| 20 | +# SELinux configuration |
| 21 | +selinux --enforcing |
| 22 | +# Installation logging level |
| 23 | +logging --level=info |
| 24 | +# Shutdown after installation |
| 25 | +shutdown |
| 26 | +# System services |
| 27 | +services --disabled="network,sshd" --enabled="NetworkManager" |
| 28 | +# System timezone |
| 29 | +timezone US/Eastern |
| 30 | +# System bootloader configuration |
| 31 | +bootloader --location=mbr |
| 32 | +# Clear the Master Boot Record |
| 33 | +zerombr |
| 34 | +# Partition clearing information |
| 35 | +clearpart --all |
| 36 | +# Disk partitioning information |
| 37 | +part biosboot --size=1 |
| 38 | +part / --fstype="ext4" --size=5000 |
| 39 | +part swap --size=1000 |
| 40 | + |
| 41 | +%post |
| 42 | +# FIXME: it'd be better to get this installed from a package |
| 43 | +cat > /etc/rc.d/init.d/livesys << EOF |
| 44 | +#!/bin/bash |
| 45 | +# |
| 46 | +# live: Init script for live image |
| 47 | +# |
| 48 | +# chkconfig: 345 00 99 |
| 49 | +# description: Init script for live image. |
| 50 | +
|
| 51 | +. /etc/init.d/functions |
| 52 | +
|
| 53 | +if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ]; then |
| 54 | + exit 0 |
| 55 | +fi |
| 56 | +
|
| 57 | +if [ -e /.liveimg-configured ] ; then |
| 58 | + configdone=1 |
| 59 | +fi |
| 60 | +
|
| 61 | +exists() { |
| 62 | + which \$1 >/dev/null 2>&1 || return |
| 63 | + \$* |
| 64 | +} |
| 65 | +
|
| 66 | +touch /.liveimg-configured |
| 67 | +
|
| 68 | +# mount live image |
| 69 | +if [ -b \`readlink -f /dev/live\` ]; then |
| 70 | + mkdir -p /mnt/live |
| 71 | + mount -o ro /dev/live /mnt/live 2>/dev/null || mount /dev/live /mnt/live |
| 72 | +fi |
| 73 | +
|
| 74 | +livedir="LiveOS" |
| 75 | +for arg in \`cat /proc/cmdline\` ; do |
| 76 | + if [ "\${arg##live_dir=}" != "\${arg}" ]; then |
| 77 | + livedir=\${arg##live_dir=} |
| 78 | + return |
| 79 | + fi |
| 80 | +done |
| 81 | +
|
| 82 | +# enable swaps unless requested otherwise |
| 83 | +swaps=\`blkid -t TYPE=swap -o device\` |
| 84 | +if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then |
| 85 | + for s in \$swaps ; do |
| 86 | + action "Enabling swap partition \$s" swapon \$s |
| 87 | + done |
| 88 | +fi |
| 89 | +if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /mnt/live/\${livedir}/swap.img ] ; then |
| 90 | + action "Enabling swap file" swapon /mnt/live/\${livedir}/swap.img |
| 91 | +fi |
| 92 | +
|
| 93 | +mountPersistentHome() { |
| 94 | + # support label/uuid |
| 95 | + if [ "\${homedev##LABEL=}" != "\${homedev}" -o "\${homedev##UUID=}" != "\${homedev}" ]; then |
| 96 | + homedev=\`/sbin/blkid -o device -t "\$homedev"\` |
| 97 | + fi |
| 98 | +
|
| 99 | + # if we're given a file rather than a blockdev, loopback it |
| 100 | + if [ "\${homedev##mtd}" != "\${homedev}" ]; then |
| 101 | + # mtd devs don't have a block device but get magic-mounted with -t jffs2 |
| 102 | + mountopts="-t jffs2" |
| 103 | + elif [ ! -b "\$homedev" ]; then |
| 104 | + loopdev=\`losetup -f\` |
| 105 | + if [ "\${homedev##/mnt/live}" != "\${homedev}" ]; then |
| 106 | + action "Remounting live store r/w" mount -o remount,rw /mnt/live |
| 107 | + fi |
| 108 | + losetup \$loopdev \$homedev |
| 109 | + homedev=\$loopdev |
| 110 | + fi |
| 111 | +
|
| 112 | + # if it's encrypted, we need to unlock it |
| 113 | + if [ "\$(/sbin/blkid -s TYPE -o value \$homedev 2>/dev/null)" = "crypto_LUKS" ]; then |
| 114 | + echo |
| 115 | + echo "Setting up encrypted /home device" |
| 116 | + plymouth ask-for-password --command="cryptsetup luksOpen \$homedev EncHome" |
| 117 | + homedev=/dev/mapper/EncHome |
| 118 | + fi |
| 119 | +
|
| 120 | + # and finally do the mount |
| 121 | + mount \$mountopts \$homedev /home |
| 122 | + # if we have /home under what's passed for persistent home, then |
| 123 | + # we should make that the real /home. useful for mtd device on olpc |
| 124 | + if [ -d /home/home ]; then mount --bind /home/home /home ; fi |
| 125 | + [ -x /sbin/restorecon ] && /sbin/restorecon /home |
| 126 | + if [ -d /home/liveuser ]; then USERADDARGS="-M" ; fi |
| 127 | +} |
| 128 | +
|
| 129 | +findPersistentHome() { |
| 130 | + for arg in \`cat /proc/cmdline\` ; do |
| 131 | + if [ "\${arg##persistenthome=}" != "\${arg}" ]; then |
| 132 | + homedev=\${arg##persistenthome=} |
| 133 | + return |
| 134 | + fi |
| 135 | + done |
| 136 | +} |
| 137 | +
|
| 138 | +if strstr "\`cat /proc/cmdline\`" persistenthome= ; then |
| 139 | + findPersistentHome |
| 140 | +elif [ -e /mnt/live/\${livedir}/home.img ]; then |
| 141 | + homedev=/mnt/live/\${livedir}/home.img |
| 142 | +fi |
| 143 | +
|
| 144 | +# if we have a persistent /home, then we want to go ahead and mount it |
| 145 | +if ! strstr "\`cat /proc/cmdline\`" nopersistenthome && [ -n "\$homedev" ] ; then |
| 146 | + action "Mounting persistent /home" mountPersistentHome |
| 147 | +fi |
| 148 | +
|
| 149 | +# make it so that we don't do writing to the overlay for things which |
| 150 | +# are just tmpdirs/caches |
| 151 | +mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum |
| 152 | +mount -t tmpfs tmp /tmp |
| 153 | +mount -t tmpfs vartmp /var/tmp |
| 154 | +[ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /tmp /var/tmp >/dev/null 2>&1 |
| 155 | +
|
| 156 | +if [ -n "\$configdone" ]; then |
| 157 | + exit 0 |
| 158 | +fi |
| 159 | +
|
| 160 | +# add fedora user with no passwd |
| 161 | +action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser |
| 162 | +passwd -d liveuser > /dev/null |
| 163 | +
|
| 164 | +# turn off firstboot for livecd boots |
| 165 | +chkconfig --level 345 firstboot off 2>/dev/null |
| 166 | +# We made firstboot a native systemd service, so it can no longer be turned |
| 167 | +# off with chkconfig. It should be possible to turn it off with systemctl, but |
| 168 | +# that doesn't work right either. For now, this is good enough: the firstboot |
| 169 | +# service will start up, but this tells it not to run firstboot. I suspect the |
| 170 | +# other services 'disabled' below are not actually getting disabled properly, |
| 171 | +# with systemd, but we can look into that later. - AdamW 2010/08 F14Alpha |
| 172 | +echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot |
| 173 | +
|
| 174 | +# don't start yum-updatesd for livecd boots |
| 175 | +chkconfig --level 345 yum-updatesd off 2>/dev/null |
| 176 | +
|
| 177 | +# turn off mdmonitor by default |
| 178 | +chkconfig --level 345 mdmonitor off 2>/dev/null |
| 179 | +
|
| 180 | +# turn off setroubleshoot on the live image to preserve resources |
| 181 | +chkconfig --level 345 setroubleshoot off 2>/dev/null |
| 182 | +
|
| 183 | +# don't do packagekit checking by default |
| 184 | +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 |
| 185 | +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 |
| 186 | +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 |
| 187 | +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 |
| 188 | +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 |
| 189 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_check_firmware false >/dev/null |
| 190 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_check_hardware false >/dev/null |
| 191 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_codec_helper false >/dev/null |
| 192 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-packagekit/enable_font_helper false >/dev/null |
| 193 | +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 |
| 194 | +
|
| 195 | +
|
| 196 | +# don't start cron/at as they tend to spawn things which are |
| 197 | +# disk intensive that are painful on a live image |
| 198 | +chkconfig --level 345 crond off 2>/dev/null |
| 199 | +chkconfig --level 345 atd off 2>/dev/null |
| 200 | +chkconfig --level 345 anacron off 2>/dev/null |
| 201 | +chkconfig --level 345 readahead_early off 2>/dev/null |
| 202 | +chkconfig --level 345 readahead_later off 2>/dev/null |
| 203 | +
|
| 204 | +# Stopgap fix for RH #217966; should be fixed in HAL instead |
| 205 | +touch /media/.hal-mtab |
| 206 | +
|
| 207 | +# workaround clock syncing on shutdown that we don't want (#297421) |
| 208 | +sed -i -e 's/hwclock/no-such-hwclock/g' /etc/rc.d/init.d/halt |
| 209 | +
|
| 210 | +# and hack so that we eject the cd on shutdown if we're using a CD... |
| 211 | +if strstr "\`cat /proc/cmdline\`" CDLABEL= ; then |
| 212 | + cat >> /sbin/halt.local << FOE |
| 213 | +#!/bin/bash |
| 214 | +# XXX: This often gets stuck during shutdown because /etc/init.d/halt |
| 215 | +# (or something else still running) wants to read files from the block\ |
| 216 | +# device that was ejected. Disable for now. Bug #531924 |
| 217 | +# we want to eject the cd on halt, but let's also try to avoid |
| 218 | +# io errors due to not being able to get files... |
| 219 | +#cat /sbin/halt > /dev/null |
| 220 | +#cat /sbin/reboot > /dev/null |
| 221 | +#/usr/sbin/eject -p -m \$(readlink -f /dev/live) >/dev/null 2>&1 |
| 222 | +#echo "Please remove the CD from your drive and press Enter to finish restarting" |
| 223 | +#read -t 30 < /dev/console |
| 224 | +FOE |
| 225 | +chmod +x /sbin/halt.local |
| 226 | +fi |
| 227 | +
|
| 228 | +EOF |
| 229 | +
|
| 230 | +# bah, hal starts way too late |
| 231 | +cat > /etc/rc.d/init.d/livesys-late << EOF |
| 232 | +#!/bin/bash |
| 233 | +# |
| 234 | +# live: Late init script for live image |
| 235 | +# |
| 236 | +# chkconfig: 345 99 01 |
| 237 | +# description: Late init script for live image. |
| 238 | +
|
| 239 | +. /etc/init.d/functions |
| 240 | +
|
| 241 | +if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then |
| 242 | + exit 0 |
| 243 | +fi |
| 244 | +
|
| 245 | +exists() { |
| 246 | + which \$1 >/dev/null 2>&1 || return |
| 247 | + \$* |
| 248 | +} |
| 249 | +
|
| 250 | +touch /.liveimg-late-configured |
| 251 | +
|
| 252 | +# read some variables out of /proc/cmdline |
| 253 | +for o in \`cat /proc/cmdline\` ; do |
| 254 | + case \$o in |
| 255 | + ks=*) |
| 256 | + ks="--kickstart=\${o#ks=}" |
| 257 | + ;; |
| 258 | + xdriver=*) |
| 259 | + xdriver="\${o#xdriver=}" |
| 260 | + ;; |
| 261 | + esac |
| 262 | +done |
| 263 | +
|
| 264 | +# if liveinst or textinst is given, start anaconda |
| 265 | +if strstr "\`cat /proc/cmdline\`" liveinst ; then |
| 266 | + plymouth --quit |
| 267 | + /usr/sbin/liveinst \$ks |
| 268 | +fi |
| 269 | +if strstr "\`cat /proc/cmdline\`" textinst ; then |
| 270 | + plymouth --quit |
| 271 | + /usr/sbin/liveinst --text \$ks |
| 272 | +fi |
| 273 | +
|
| 274 | +# configure X, allowing user to override xdriver |
| 275 | +if [ -n "\$xdriver" ]; then |
| 276 | + cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE |
| 277 | +Section "Device" |
| 278 | + Identifier "Videocard0" |
| 279 | + Driver "\$xdriver" |
| 280 | +EndSection |
| 281 | +FOE |
| 282 | +fi |
| 283 | +
|
| 284 | +EOF |
| 285 | +
|
| 286 | +chmod 755 /etc/rc.d/init.d/livesys |
| 287 | +/sbin/restorecon /etc/rc.d/init.d/livesys |
| 288 | +/sbin/chkconfig --add livesys |
| 289 | +
|
| 290 | +chmod 755 /etc/rc.d/init.d/livesys-late |
| 291 | +/sbin/restorecon /etc/rc.d/init.d/livesys-late |
| 292 | +/sbin/chkconfig --add livesys-late |
| 293 | +
|
| 294 | +# work around for poor key import UI in PackageKit |
| 295 | +rm -f /var/lib/rpm/__db* |
| 296 | +rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora |
| 297 | +echo "Packages within this LiveCD" |
| 298 | +rpm -qa |
| 299 | +
|
| 300 | +# go ahead and pre-make the man -k cache (#455968) |
| 301 | +/usr/bin/mandb |
| 302 | +
|
| 303 | +# make sure there aren't core files lying around |
| 304 | +rm -f /core* |
| 305 | +
|
| 306 | +# convince readahead not to collect |
| 307 | +rm -f /.readahead_collect |
| 308 | +touch /var/lib/readahead/early.sorted |
| 309 | +
|
| 310 | +# Remove random-seed |
| 311 | +rm /var/lib/systemd/random-seed |
| 312 | +%end |
| 313 | + |
| 314 | +%post |
| 315 | +cat >> /etc/rc.d/init.d/livesys << EOF |
| 316 | +# disable screensaver locking |
| 317 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/gnome-screensaver/lock_enabled false >/dev/null |
| 318 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /desktop/gnome/lockdown/disable_lock_screen true >/dev/null |
| 319 | +
|
| 320 | +# set up timed auto-login for after 60 seconds |
| 321 | +cat >> /etc/gdm/custom.conf << FOE |
| 322 | +[daemon] |
| 323 | +AutomaticLoginEnable=True |
| 324 | +AutomaticLogin=liveuser |
| 325 | +FOE |
| 326 | +
|
| 327 | +# Show harddisk install on the desktop |
| 328 | +sed -i -e 's/NoDisplay=true/NoDisplay=false/' /usr/share/applications/liveinst.desktop |
| 329 | +mkdir /home/liveuser/Desktop |
| 330 | +cp /usr/share/applications/liveinst.desktop /home/liveuser/Desktop |
| 331 | +chown -R liveuser.liveuser /home/liveuser/Desktop |
| 332 | +chmod a+x /home/liveuser/Desktop/liveinst.desktop |
| 333 | +
|
| 334 | +# But not trash and home |
| 335 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/nautilus/desktop/trash_icon_visible false >/dev/null |
| 336 | +gconftool-2 --direct --config-source=xml:readwrite:/etc/gconf/gconf.xml.defaults -s -t bool /apps/nautilus/desktop/home_icon_visible false >/dev/null |
| 337 | +
|
| 338 | +# Turn off PackageKit-command-not-found while uninstalled |
| 339 | +sed -i -e 's/^SoftwareSourceSearch=true/SoftwareSourceSearch=false/' /etc/PackageKit/CommandNotFound.conf |
| 340 | +
|
| 341 | +EOF |
| 342 | +
|
| 343 | +# Remove root password |
| 344 | +passwd -d root > /dev/null |
| 345 | +
|
| 346 | +# fstab from the install won't match anything. remove it and let dracut |
| 347 | +# handle mounting. |
| 348 | +cat /dev/null > /etc/fstab |
| 349 | +
|
| 350 | +%end |
| 351 | + |
| 352 | +# NOTE Do NOT add any other sections after %packages |
| 353 | +%packages |
| 354 | +# Packages requires to support this output format go here |
| 355 | +isomd5sum |
| 356 | +kernel |
| 357 | +memtest86+ |
| 358 | +syslinux |
| 359 | +-dracut-config-rescue |
| 360 | + |
| 361 | +# This package is needed to boot the iso on UEFI |
| 362 | +shim |
| 363 | +shim-ia32 |
| 364 | +grub2 |
| 365 | +grub2-efi |
| 366 | +grub2-efi-*-cdboot |
| 367 | +grub2-efi-ia32 |
| 368 | +efibootmgr |
| 369 | + |
| 370 | + |
| 371 | +# NOTE lorax-composer will add the recipe packages below here, including the final %end%packages |
0 commit comments