Guest User

include

a guest
Jul 3rd, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.54 KB | None | 0 0
  1. # fedora-live-base.ks
  2. #
  3. # Defines the basics for all kickstarts in the fedora-live branch
  4. # Does not include package selection (other then mandatory)
  5. # Does not include localization packages or configuration
  6. #
  7. # Does includes "default" language configuration (kickstarts including
  8. # this template can override these settings)
  9.  
  10. lang hu_HU.UTF-8
  11. keyboard --vckeymap=hu --xlayouts hu,us --switch=grp:lalt_lshift_toggle
  12. timezone Europe/Budapest
  13. auth --useshadow --enablemd5
  14. selinux --enforcing
  15. firewall --enabled --service=mdns
  16. xconfig --startxonboot
  17. part / --size 8096 --fstype ext4
  18. services --enabled=NetworkManager --disabled=network,sshd
  19.  
  20. #repo --name=rawhide --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=rawhide&arch=$basearch
  21. repo --name=fedora --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
  22. repo --name=updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
  23. # repo --name=updates-testing --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-testing-f$releasever&arch=$basearch
  24.  
  25. %packages
  26. @base-x
  27. # @guest-desktop-agents
  28. @standard
  29. @core
  30. @fonts
  31. # @input-methods
  32. @dial-up
  33. @multimedia
  34. @hardware-support
  35. @printing
  36.  
  37. # Explicitly specified here:
  38. # <notting> walters: because otherwise dependency loops cause yum issues.
  39. kernel-PAE
  40.  
  41. # This was added a while ago, I think it falls into the category of
  42. # "Diagnosis/recovery tool useful from a Live OS image". Leaving this untouched
  43. # for now.
  44. memtest86+
  45.  
  46. # The point of a live image is to install
  47. # anaconda
  48. # @anaconda-tools
  49.  
  50. # Make live images easy to shutdown and the like in libvirt
  51. # qemu-guest-agent
  52.  
  53. %end
  54.  
  55. %post
  56. # FIXME: it'd be better to get this installed from a package
  57. cat > /etc/rc.d/init.d/livesys << EOF
  58. #!/bin/bash
  59. #
  60. # live: Init script for live image
  61. #
  62. # chkconfig: 345 00 99
  63. # description: Init script for live image.
  64. ### BEGIN INIT INFO
  65. # X-Start-Before: display-manager
  66. ### END INIT INFO
  67.  
  68. . /etc/init.d/functions
  69.  
  70. if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ]; then
  71. exit 0
  72. fi
  73.  
  74. if [ -e /.liveimg-configured ] ; then
  75. configdone=1
  76. fi
  77.  
  78. exists() {
  79. which \$1 >/dev/null 2>&1 || return
  80. \$*
  81. }
  82.  
  83. touch /.liveimg-configured
  84.  
  85. # Make sure we don't mangle the hardware clock on shutdown
  86. ln -sf /dev/null /etc/systemd/system/hwclock-save.service
  87.  
  88. livedir="LiveOS"
  89. for arg in \`cat /proc/cmdline\` ; do
  90. if [ "\${arg##rd.live.dir=}" != "\${arg}" ]; then
  91. livedir=\${arg##rd.live.dir=}
  92. return
  93. fi
  94. if [ "\${arg##live_dir=}" != "\${arg}" ]; then
  95. livedir=\${arg##live_dir=}
  96. return
  97. fi
  98. done
  99.  
  100. # enable swaps unless requested otherwise
  101. swaps=\`blkid -t TYPE=swap -o device\`
  102. if ! strstr "\`cat /proc/cmdline\`" noswap && [ -n "\$swaps" ] ; then
  103. for s in \$swaps ; do
  104. action "Enabling swap partition \$s" swapon \$s
  105. done
  106. fi
  107. if ! strstr "\`cat /proc/cmdline\`" noswap && [ -f /run/initramfs/live/\${livedir}/swap.img ] ; then
  108. action "Enabling swap file" swapon /run/initramfs/live/\${livedir}/swap.img
  109. fi
  110.  
  111. mountPersistentHome() {
  112. # support label/uuid
  113. if [ "\${homedev##LABEL=}" != "\${homedev}" -o "\${homedev##UUID=}" != "\${homedev}" ]; then
  114. homedev=\`/sbin/blkid -o device -t "\$homedev"\`
  115. fi
  116.  
  117. # if we're given a file rather than a blockdev, loopback it
  118. if [ "\${homedev##mtd}" != "\${homedev}" ]; then
  119. # mtd devs don't have a block device but get magic-mounted with -t jffs2
  120. mountopts="-t jffs2"
  121. elif [ ! -b "\$homedev" ]; then
  122. loopdev=\`losetup -f\`
  123. if [ "\${homedev##/run/initramfs/live}" != "\${homedev}" ]; then
  124. action "Remounting live store r/w" mount -o remount,rw /run/initramfs/live
  125. fi
  126. losetup \$loopdev \$homedev
  127. homedev=\$loopdev
  128. fi
  129.  
  130. # if it's encrypted, we need to unlock it
  131. if [ "\$(/sbin/blkid -s TYPE -o value \$homedev 2>/dev/null)" = "crypto_LUKS" ]; then
  132. echo
  133. echo "Setting up encrypted /home device"
  134. plymouth ask-for-password --command="cryptsetup luksOpen \$homedev EncHome"
  135. homedev=/dev/mapper/EncHome
  136. fi
  137.  
  138. # and finally do the mount
  139. mount \$mountopts \$homedev /home
  140. # if we have /home under what's passed for persistent home, then
  141. # we should make that the real /home. useful for mtd device on olpc
  142. if [ -d /home/home ]; then mount --bind /home/home /home ; fi
  143. [ -x /sbin/restorecon ] && /sbin/restorecon /home
  144. if [ -d /home/liveuser ]; then USERADDARGS="-M" ; fi
  145. }
  146.  
  147. findPersistentHome() {
  148. for arg in \`cat /proc/cmdline\` ; do
  149. if [ "\${arg##persistenthome=}" != "\${arg}" ]; then
  150. homedev=\${arg##persistenthome=}
  151. return
  152. fi
  153. done
  154. }
  155.  
  156. if strstr "\`cat /proc/cmdline\`" persistenthome= ; then
  157. findPersistentHome
  158. elif [ -e /run/initramfs/live/\${livedir}/home.img ]; then
  159. homedev=/run/initramfs/live/\${livedir}/home.img
  160. fi
  161.  
  162. # if we have a persistent /home, then we want to go ahead and mount it
  163. if ! strstr "\`cat /proc/cmdline\`" nopersistenthome && [ -n "\$homedev" ] ; then
  164. action "Mounting persistent /home" mountPersistentHome
  165. fi
  166.  
  167. # make it so that we don't do writing to the overlay for things which
  168. # are just tmpdirs/caches
  169. mount -t tmpfs -o mode=0755 varcacheyum /var/cache/yum
  170. mount -t tmpfs vartmp /var/tmp
  171. [ -x /sbin/restorecon ] && /sbin/restorecon /var/cache/yum /var/tmp >/dev/null 2>&1
  172.  
  173. if [ -n "\$configdone" ]; then
  174. exit 0
  175. fi
  176.  
  177. ## add fedora user with no passwd
  178. # action "Adding live user" useradd \$USERADDARGS -c "Live System User" liveuser
  179. # passwd -d liveuser > /dev/null
  180. # usermod -aG wheel liveuser > /dev/null
  181.  
  182. # don't use prelink on a running live image
  183. sed -i 's/PRELINKING=yes/PRELINKING=no/' /etc/sysconfig/prelink &>/dev/null || :
  184.  
  185. # turn off mdmonitor by default
  186. systemctl --no-reload disable mdmonitor.service 2> /dev/null || :
  187. systemctl --no-reload disable mdmonitor-takeover.service 2> /dev/null || :
  188. systemctl stop mdmonitor.service 2> /dev/null || :
  189. systemctl stop mdmonitor-takeover.service 2> /dev/null || :
  190.  
  191. # don't enable the gnome-settings-daemon packagekit plugin
  192. gsettings set org.gnome.settings-daemon.plugins.updates active 'false' || :
  193.  
  194. # don't start cron/at as they tend to spawn things which are
  195. # disk intensive that are painful on a live image
  196. systemctl --no-reload disable crond.service 2> /dev/null || :
  197. systemctl --no-reload disable atd.service 2> /dev/null || :
  198. systemctl stop crond.service 2> /dev/null || :
  199. systemctl stop atd.service 2> /dev/null || :
  200.  
  201. # and hack so that we eject the cd on shutdown if we're using a CD...
  202. if strstr "\`cat /proc/cmdline\`" CDLABEL= ; then
  203. cat >> /sbin/halt.local << FOE
  204. #!/bin/bash
  205. # XXX: This often gets stuck during shutdown because /etc/init.d/halt
  206. # (or something else still running) wants to read files from the block\
  207. # device that was ejected. Disable for now. Bug #531924
  208. # we want to eject the cd on halt, but let's also try to avoid
  209. # io errors due to not being able to get files...
  210. #cat /sbin/halt > /dev/null
  211. #cat /sbin/reboot > /dev/null
  212. #/usr/sbin/eject -p -m \$(readlink -f /run/initramfs/livedev) >/dev/null 2>&1
  213. #echo "Please remove the CD from your drive and press Enter to finish restarting"
  214. #read -t 30 < /dev/console
  215. FOE
  216. chmod +x /sbin/halt.local
  217. fi
  218.  
  219. EOF
  220.  
  221. # bah, hal starts way too late
  222. cat > /etc/rc.d/init.d/livesys-late << EOF
  223. #!/bin/bash
  224. #
  225. # live: Late init script for live image
  226. #
  227. # chkconfig: 345 99 01
  228. # description: Late init script for live image.
  229.  
  230. . /etc/init.d/functions
  231.  
  232. if ! strstr "\`cat /proc/cmdline\`" rd.live.image || [ "\$1" != "start" ] || [ -e /.liveimg-late-configured ] ; then
  233. exit 0
  234. fi
  235.  
  236. exists() {
  237. which \$1 >/dev/null 2>&1 || return
  238. \$*
  239. }
  240.  
  241. touch /.liveimg-late-configured
  242.  
  243. # read some variables out of /proc/cmdline
  244. for o in \`cat /proc/cmdline\` ; do
  245. case \$o in
  246. ks=*)
  247. ks="--kickstart=\${o#ks=}"
  248. ;;
  249. xdriver=*)
  250. xdriver="\${o#xdriver=}"
  251. ;;
  252. esac
  253. done
  254.  
  255. # if liveinst or textinst is given, start anaconda
  256. if strstr "\`cat /proc/cmdline\`" liveinst ; then
  257. plymouth --quit
  258. /usr/sbin/liveinst \$ks
  259. fi
  260. if strstr "\`cat /proc/cmdline\`" textinst ; then
  261. plymouth --quit
  262. /usr/sbin/liveinst --text \$ks
  263. fi
  264.  
  265. # configure X, allowing user to override xdriver
  266. if [ -n "\$xdriver" ]; then
  267. cat > /etc/X11/xorg.conf.d/00-xdriver.conf <<FOE
  268. Section "Device"
  269. Identifier "Videocard0"
  270. Driver "\$xdriver"
  271. EndSection
  272. FOE
  273. fi
  274.  
  275. EOF
  276.  
  277. chmod 755 /etc/rc.d/init.d/livesys
  278. /sbin/restorecon /etc/rc.d/init.d/livesys
  279. /sbin/chkconfig --add livesys
  280.  
  281. chmod 755 /etc/rc.d/init.d/livesys-late
  282. /sbin/restorecon /etc/rc.d/init.d/livesys-late
  283. /sbin/chkconfig --add livesys-late
  284.  
  285. # enable tmpfs for /tmp
  286. systemctl enable tmp.mount
  287.  
  288. # work around for poor key import UI in PackageKit
  289. rm -f /var/lib/rpm/__db*
  290. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
  291. echo "Packages within this LiveCD"
  292. rpm -qa
  293. # Note that running rpm recreates the rpm db files which aren't needed or wanted
  294. rm -f /var/lib/rpm/__db*
  295.  
  296. # go ahead and pre-make the man -k cache (#455968)
  297. /usr/bin/mandb
  298.  
  299. # save a little bit of space at least...
  300. rm -f /boot/initramfs*
  301. # make sure there aren't core files lying around
  302. rm -f /core*
  303.  
  304. # convince readahead not to collect
  305. # FIXME: for systemd
  306.  
  307. %end
  308.  
  309.  
  310. %post --nochroot
  311. cp $INSTALL_ROOT/usr/share/doc/*-release-*/GPL $LIVE_ROOT/GPL
  312.  
  313. # only works on x86, x86_64
  314. if [ "$(uname -i)" = "i386" -o "$(uname -i)" = "x86_64" ]; then
  315. if [ ! -d $LIVE_ROOT/LiveOS ]; then mkdir -p $LIVE_ROOT/LiveOS ; fi
  316. cp /usr/bin/livecd-iso-to-disk $LIVE_ROOT/LiveOS
  317. fi
  318. %end
Advertisement
Add Comment
Please, Sign In to add comment