core-vm.spec 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. #
  2. # The Qubes OS Project, http://www.qubes-os.org
  3. #
  4. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  5. # Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. #
  21. #
  22. %{!?version: %define version %(cat version)}
  23. %{!?backend_vmm: %define backend_vmm %(echo $BACKEND_VMM)}
  24. Name: qubes-core-vm
  25. Version: %{version}
  26. Release: 1%{dist}
  27. Summary: The Qubes core files for VM
  28. Group: Qubes
  29. Vendor: Invisible Things Lab
  30. License: GPL
  31. URL: http://www.qubes-os.org
  32. Requires: fedora-release
  33. Requires: yum-plugin-post-transaction-actions
  34. Requires: NetworkManager >= 0.8.1-1
  35. %if %{fedora} >= 18
  36. # Fedora >= 18 defaults to firewalld, which isn't supported nor needed by Qubes
  37. Conflicts: firewalld
  38. %endif
  39. Requires: /usr/bin/mimeopen
  40. Requires: ethtool
  41. Requires: tinyproxy
  42. Requires: ntpdate
  43. Requires: net-tools
  44. Requires: nautilus-python
  45. Requires: qubes-core-vm-kernel-placeholder
  46. Requires: qubes-utils
  47. Requires: initscripts
  48. # for qubes-desktop-run
  49. Requires: pygobject3-base
  50. # for qubes-desktop-file-install
  51. Requires: pyxdg
  52. %if %{fedora} >= 20
  53. # gpk-update-viewer required by qubes-manager
  54. Requires: gnome-packagekit-updater
  55. %endif
  56. Requires: ImageMagick
  57. Requires: fakeroot
  58. Requires: desktop-notification-daemon
  59. Requires: pygtk2
  60. Requires: zenity
  61. Requires: qubes-libvchan
  62. Requires: qubes-db-vm
  63. Provides: qubes-core-vm
  64. Obsoletes: qubes-core-commonvm
  65. Obsoletes: qubes-core-appvm
  66. Obsoletes: qubes-core-netvm
  67. Obsoletes: qubes-core-proxyvm
  68. Obsoletes: qubes-upgrade-vm < 3.0
  69. BuildRequires: xen-devel
  70. BuildRequires: libX11-devel
  71. BuildRequires: qubes-utils-devel >= 3.0.1
  72. BuildRequires: qubes-libvchan-%{backend_vmm}-devel
  73. %define _builddir %(pwd)
  74. %define kde_service_dir /usr/share/kde4/services
  75. %description
  76. The Qubes core files for installation inside a Qubes VM.
  77. %prep
  78. # we operate on the current directory, so no need to unpack anything
  79. # symlink is to generate useful debuginfo packages
  80. rm -f %{name}-%{version}
  81. ln -sf . %{name}-%{version}
  82. %setup -T -D
  83. %build
  84. for dir in qubes-rpc qrexec misc; do
  85. (cd $dir; make)
  86. done
  87. %pre
  88. # Make sure there is a qubes group
  89. groupadd --force --system --gid 98 qubes
  90. id -u 'user' >/dev/null 2>&1 || {
  91. useradd --user-group --create-home --shell /bin/bash user
  92. }
  93. usermod -a --groups qubes user
  94. if [ "$1" != 1 ] ; then
  95. # do this whole %pre thing only when updating for the first time...
  96. exit 0
  97. fi
  98. mkdir -p /var/lib/qubes
  99. if [ -e /etc/fstab ] ; then
  100. mv /etc/fstab /var/lib/qubes/fstab.orig
  101. fi
  102. usermod -p '' root
  103. usermod -L user
  104. %install
  105. (cd qrexec; make install DESTDIR=$RPM_BUILD_ROOT)
  106. make install-vm DESTDIR=$RPM_BUILD_ROOT
  107. %triggerin -- initscripts
  108. if [ -e /etc/init/serial.conf ]; then
  109. cp /usr/share/qubes/serial.conf /etc/init/serial.conf
  110. fi
  111. %triggerin -- pulseaudio-module-x11
  112. /usr/bin/qubes-desktop-file-install --force --dir /var/lib/qubes/xdg/autostart --remove-show-in --add-not-show-in X-QUBES /etc/xdg/autostart/pulseaudio.desktop
  113. %post
  114. # disable some Upstart services
  115. for F in plymouth-shutdown prefdm splash-manager start-ttys tty ; do
  116. if [ -e /etc/init/$F.conf ]; then
  117. mv -f /etc/init/$F.conf /etc/init/$F.conf.disabled
  118. fi
  119. done
  120. # Update all autostart xdg desktop configuration files (modified copies are
  121. # placed in /var/lib/qubes/xdg/autostart)
  122. /usr/lib/qubes/qubes-trigger-desktop-file-install clean
  123. # Create NetworkManager configuration if we do not have it
  124. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  125. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  126. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  127. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  128. fi
  129. /usr/lib/qubes/qubes-fix-nm-conf.sh
  130. # Remove ip_forward setting from sysctl, so NM will not reset it
  131. sed 's/^net.ipv4.ip_forward.*/#\0/' -i /etc/sysctl.conf
  132. # Remove old firmware updates link
  133. if [ -L /lib/firmware/updates ]; then
  134. rm -f /lib/firmware/updates
  135. fi
  136. if ! grep -q '/etc/yum\.conf\.d/qubes-proxy\.conf' /etc/yum.conf; then
  137. echo >> /etc/yum.conf
  138. echo '# Yum does not support inclusion of config dir...' >> /etc/yum.conf
  139. echo 'include=file:///etc/yum.conf.d/qubes-proxy.conf' >> /etc/yum.conf
  140. fi
  141. # Revert 'Prevent unnecessary updates in VMs':
  142. sed -i -e '/^exclude = kernel/d' /etc/yum.conf
  143. # Location of files which contains list of protected files
  144. mkdir -p /etc/qubes/protected-files.d
  145. PROTECTED_FILE_LIST='/etc/qubes/protected-files.d'
  146. # qubes-core-vm has been broken for some time - it overrides /etc/hosts; restore original content
  147. if ! grep -rq "^/etc/hosts$" "${PROTECTED_FILE_LIST}" 2>/dev/null; then
  148. if ! grep -q localhost /etc/hosts; then
  149. cat <<EOF > /etc/hosts
  150. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 `hostname`
  151. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  152. EOF
  153. fi
  154. fi
  155. # ensure that hostname resolves to 127.0.0.1 resp. ::1 and that /etc/hosts is
  156. # in the form expected by qubes-sysinit.sh
  157. if ! grep -rq "^/etc/hostname$" "${PROTECTED_FILE_LIST}" 2>/dev/null; then
  158. for ip in '127\.0\.0\.1' '::1'; do
  159. if grep -q "^${ip}\(\s\|$\)" /etc/hosts; then
  160. sed -i "/^${ip}\s/,+0s/\(\s`hostname`\)\+\(\s\|$\)/\2/g" /etc/hosts
  161. sed -i "s/^${ip}\(\s\|$\).*$/\0 `hostname`/" /etc/hosts
  162. else
  163. echo "${ip} `hostname`" >> /etc/hosts
  164. fi
  165. done
  166. fi
  167. %if %{fedora} >= 20
  168. # Make sure there is a default locale set so gnome-terminal will start
  169. if [ ! -e /etc/locale.conf ] || ! grep -q LANG /etc/locale.conf; then
  170. touch /etc/locale.conf
  171. echo "LANG=en_US.UTF-8" >> /etc/locale.conf
  172. fi
  173. # ... and make sure it is really generated
  174. current_locale=`grep LANG /etc/locale.conf|cut -f 2 -d = | tr -d '"'`
  175. if [ -n "$current_locale" ] && ! locale -a | grep -q "$current_locale"; then
  176. base=`echo "$current_locale" | cut -f 1 -d .`
  177. charmap=`echo "$current_locale.UTF-8" | cut -f 2 -d .`
  178. [ -n "$charmap" ] && charmap="-f $charmap"
  179. localedef -i $base $charmap $current_locale
  180. fi
  181. %endif
  182. if [ "$1" != 1 ] ; then
  183. # do the rest of %post thing only when updating for the first time...
  184. exit 0
  185. fi
  186. if [ -e /etc/init/serial.conf ] && ! [ -f /var/lib/qubes/serial.orig ] ; then
  187. cp /etc/init/serial.conf /var/lib/qubes/serial.orig
  188. fi
  189. # Remove most of the udev scripts to speed up the VM boot time
  190. # Just leave the xen* scripts, that are needed if this VM was
  191. # ever used as a net backend (e.g. as a VPN domain in the future)
  192. #echo "--> Removing unnecessary udev scripts..."
  193. mkdir -p /var/lib/qubes/removed-udev-scripts
  194. for f in /etc/udev/rules.d/*
  195. do
  196. if [ $(basename $f) == "xen-backend.rules" ] ; then
  197. continue
  198. fi
  199. if [ $(basename $f) == "50-qubes-misc.rules" ] ; then
  200. continue
  201. fi
  202. if echo $f | grep -q qubes; then
  203. continue
  204. fi
  205. mv $f /var/lib/qubes/removed-udev-scripts/
  206. done
  207. mkdir -p /rw
  208. #rm -f /etc/mtab
  209. #echo "--> Removing HWADDR setting from /etc/sysconfig/network-scripts/ifcfg-eth0"
  210. #mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.orig
  211. #grep -v HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0
  212. %triggerin -- notification-daemon
  213. # Enable autostart of notification-daemon when installed
  214. if [ ! -e /etc/xdg/autostart/notification-daemon.desktop ]; then
  215. ln -s /usr/share/applications/notification-daemon.desktop /etc/xdg/autostart/
  216. fi
  217. exit 0
  218. %triggerin -- selinux-policy
  219. #echo "--> Disabling SELinux..."
  220. sed -e s/^SELINUX=.*$/SELINUX=disabled/ </etc/selinux/config >/etc/selinux/config.processed
  221. mv /etc/selinux/config.processed /etc/selinux/config
  222. setenforce 0 2>/dev/null
  223. exit 0
  224. %preun
  225. if [ "$1" = 0 ] ; then
  226. # no more packages left
  227. if [ -e /var/lib/qubes/fstab.orig ] ; then
  228. mv /var/lib/qubes/fstab.orig /etc/fstab
  229. fi
  230. mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
  231. if [ -e /var/lib/qubes/serial.orig ] ; then
  232. mv /var/lib/qubes/serial.orig /etc/init/serial.conf
  233. fi
  234. fi
  235. %postun
  236. if [ $1 -eq 0 ] ; then
  237. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  238. if [ -L /lib/firmware/updates ]; then
  239. rm /lib/firmware/updates
  240. fi
  241. rm -rf /var/lib/qubes/xdg
  242. fi
  243. %posttrans
  244. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  245. %clean
  246. rm -rf $RPM_BUILD_ROOT
  247. rm -f %{name}-%{version}
  248. %files
  249. %defattr(-,root,root,-)
  250. %dir /var/lib/qubes
  251. %dir /var/run/qubes
  252. %dir %attr(0775,user,user) /var/lib/qubes/dom0-updates
  253. %{kde_service_dir}/qvm-copy.desktop
  254. %{kde_service_dir}/qvm-move.desktop
  255. %{kde_service_dir}/qvm-dvm.desktop
  256. /etc/NetworkManager/dispatcher.d/30-qubes-external-ip
  257. /etc/NetworkManager/dispatcher.d/qubes-nmhook
  258. %config(noreplace) /etc/X11/xorg-preload-apps.conf
  259. /etc/dispvm-dotfiles.tbz
  260. /etc/dhclient.d/qubes-setup-dnat-to-ns.sh
  261. /etc/fstab
  262. /etc/pki/rpm-gpg/RPM-GPG-KEY-qubes*
  263. %config(noreplace) /etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla
  264. %config(noreplace) /etc/polkit-1/rules.d/00-qubes-allow-all.rules
  265. %dir /etc/qubes-rpc
  266. %config(noreplace) /etc/qubes-rpc/qubes.Filecopy
  267. %config(noreplace) /etc/qubes-rpc/qubes.OpenInVM
  268. %config(noreplace) /etc/qubes-rpc/qubes.GetAppmenus
  269. %config(noreplace) /etc/qubes-rpc/qubes.VMShell
  270. %config(noreplace) /etc/qubes-rpc/qubes.SyncNtpClock
  271. %config(noreplace) /etc/qubes-rpc/qubes.SuspendPre
  272. %config(noreplace) /etc/qubes-rpc/qubes.SuspendPost
  273. %config(noreplace) /etc/qubes-rpc/qubes.WaitForSession
  274. %config(noreplace) /etc/qubes-rpc/qubes.DetachPciDevice
  275. %config(noreplace) /etc/qubes-rpc/qubes.Backup
  276. %config(noreplace) /etc/qubes-rpc/qubes.Restore
  277. %config(noreplace) /etc/qubes-rpc/qubes.SelectFile
  278. %config(noreplace) /etc/qubes-rpc/qubes.SelectDirectory
  279. %config(noreplace) /etc/qubes-rpc/qubes.GetImageRGBA
  280. %config(noreplace) /etc/qubes-rpc/qubes.SetDateTime
  281. %config(noreplace) /etc/sudoers.d/qubes
  282. %config(noreplace) /etc/qubes/iptables.rules
  283. %config(noreplace) /etc/qubes/ip6tables.rules
  284. %config(noreplace) /etc/tinyproxy/filter-updates
  285. %config(noreplace) /etc/tinyproxy/tinyproxy-updates.conf
  286. %config(noreplace) /etc/udev/rules.d/50-qubes-misc.rules
  287. %config(noreplace) /etc/udev/rules.d/99-qubes-network.rules
  288. /etc/xdg/autostart/00-qubes-show-hide-nm-applet.desktop
  289. /etc/xen/scripts/vif-route-qubes
  290. %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf
  291. %config(noreplace) /etc/yum.repos.d/qubes-r3.repo
  292. /etc/yum/pluginconf.d/yum-qubes-hooks.conf
  293. /etc/yum/post-actions/qubes-trigger-sync-appmenus.action
  294. /etc/yum/post-actions/qubes-trigger-desktop-file-install.action
  295. /usr/lib/systemd/system/user@.service.d/90-session-stop-timeout.conf
  296. /usr/sbin/qubes-serial-login
  297. /usr/bin/qvm-copy-to-vm
  298. /usr/bin/qvm-move-to-vm
  299. /usr/bin/qvm-open-in-dvm
  300. /usr/bin/qvm-open-in-vm
  301. /usr/bin/qvm-run
  302. /usr/bin/qvm-mru-entry
  303. /usr/bin/xenstore-watch-qubes
  304. /usr/bin/qubes-desktop-run
  305. /usr/bin/qrexec-fork-server
  306. /usr/bin/qrexec-client-vm
  307. /usr/bin/qubes-desktop-file-install
  308. %dir /usr/lib/qubes
  309. /usr/lib/qubes/vusb-ctl.py*
  310. /usr/lib/qubes/dispvm-prerun.sh
  311. /usr/lib/qubes/sync-ntp-clock
  312. /usr/lib/qubes/prepare-suspend
  313. /usr/lib/qubes/network-manager-prepare-conf-dir
  314. /usr/lib/qubes/show-hide-nm-applet.sh
  315. /usr/lib/qubes/qrexec-agent
  316. /usr/lib/qubes/qrexec-client-vm
  317. /usr/lib/qubes/qrexec_client_vm
  318. /usr/lib/qubes/qubes-rpc-multiplexer
  319. /usr/lib/qubes/qfile-agent
  320. %attr(4755,root,root) /usr/lib/qubes/qfile-unpacker
  321. /usr/lib/qubes/qopen-in-vm
  322. /usr/lib/qubes/qrun-in-vm
  323. /usr/lib/qubes/qubes-download-dom0-updates.sh
  324. /usr/lib/qubes/qubes-fix-nm-conf.sh
  325. /usr/lib/qubes/qubes-setup-dnat-to-ns
  326. /usr/lib/qubes/qubes-trigger-sync-appmenus.sh
  327. /usr/lib/qubes/qvm-copy-to-vm.gnome
  328. /usr/lib/qubes/qvm-copy-to-vm.kde
  329. /usr/lib/qubes/qvm-move-to-vm.gnome
  330. /usr/lib/qubes/qvm-move-to-vm.kde
  331. /usr/lib/qubes/setup-ip
  332. /usr/lib/qubes/tar2qfile
  333. /usr/lib/qubes/vm-file-editor
  334. /usr/lib/qubes/wrap-in-html-if-url.sh
  335. /usr/lib/qubes/iptables-updates-proxy
  336. /usr/lib/qubes/close-window
  337. /usr/lib/qubes/qubes-trigger-desktop-file-install
  338. /usr/lib/yum-plugins/yum-qubes-hooks.py*
  339. /usr/sbin/qubes-firewall
  340. /usr/sbin/qubes-netwatcher
  341. /usr/share/qubes/serial.conf
  342. /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override
  343. /usr/share/glib-2.0/schemas/org.gnome.nautilus.gschema.override
  344. /usr/share/glib-2.0/schemas/org.mate.NotificationDaemon.gschema.override
  345. /usr/share/nautilus-python/extensions/qvm_copy_nautilus.py*
  346. /usr/share/nautilus-python/extensions/qvm_move_nautilus.py*
  347. /usr/share/nautilus-python/extensions/qvm_dvm_nautilus.py*
  348. %dir /var/lib/qubes
  349. /usr/share/qubes/mime-override/globs
  350. %dir /home_volatile
  351. %attr(700,user,user) /home_volatile/user
  352. %dir /mnt/removable
  353. %dir /rw
  354. %package sysvinit
  355. Summary: Qubes unit files for SysV init style or upstart
  356. License: GPL v2 only
  357. Group: Qubes
  358. Requires: upstart
  359. Requires: qubes-core-vm
  360. Provides: qubes-core-vm-init-scripts
  361. Conflicts: qubes-core-vm-systemd
  362. %description sysvinit
  363. The Qubes core startup configuration for SysV init (or upstart).
  364. %files sysvinit
  365. /etc/init.d/qubes-core
  366. /etc/init.d/qubes-core-appvm
  367. /etc/init.d/qubes-core-netvm
  368. /etc/init.d/qubes-firewall
  369. /etc/init.d/qubes-netwatcher
  370. /etc/init.d/qubes-iptables
  371. /etc/init.d/qubes-updates-proxy
  372. /etc/init.d/qubes-qrexec-agent
  373. /etc/sysconfig/modules/qubes-core.modules
  374. /etc/sysconfig/modules/qubes-misc.modules
  375. %post sysvinit
  376. #echo "--> Turning off unnecessary services..."
  377. # FIXME: perhaps there is more elegant way to do this?
  378. for f in /etc/init.d/*
  379. do
  380. srv=`basename $f`
  381. [ $srv = 'functions' ] && continue
  382. [ $srv = 'killall' ] && continue
  383. [ $srv = 'halt' ] && continue
  384. [ $srv = 'single' ] && continue
  385. [ $srv = 'reboot' ] && continue
  386. [ $srv = 'qubes-gui' ] && continue
  387. chkconfig $srv off
  388. done
  389. #echo "--> Enabling essential services..."
  390. chkconfig rsyslog on
  391. chkconfig haldaemon on
  392. chkconfig messagebus on
  393. chkconfig --add qubes-core || echo "WARNING: Cannot add service qubes-core!"
  394. chkconfig qubes-core on || echo "WARNING: Cannot enable service qubes-core!"
  395. chkconfig --add qubes-core-netvm || echo "WARNING: Cannot add service qubes-core-netvm!"
  396. chkconfig qubes-core-netvm on || echo "WARNING: Cannot enable service qubes-core-netvm!"
  397. chkconfig --add qubes-core-appvm || echo "WARNING: Cannot add service qubes-core-appvm!"
  398. chkconfig qubes-core-appvm on || echo "WARNING: Cannot enable service qubes-core-appvm!"
  399. chkconfig --add qubes-firewall || echo "WARNING: Cannot add service qubes-firewall!"
  400. chkconfig qubes-firewall on || echo "WARNING: Cannot enable service qubes-firewall!"
  401. chkconfig --add qubes-netwatcher || echo "WARNING: Cannot add service qubes-netwatcher!"
  402. chkconfig qubes-netwatcher on || echo "WARNING: Cannot enable service qubes-netwatcher!"
  403. chkconfig --add qubes-iptables || echo "WARNING: Cannot add service qubes-iptables!"
  404. chkconfig qubes-iptables on || echo "WARNING: Cannot enable service qubes-iptables!"
  405. chkconfig --add qubes-updates-proxy || echo "WARNING: Cannot add service qubes-updates-proxy!"
  406. chkconfig qubes-updates-proxy on || echo "WARNING: Cannot enable service qubes-updates-proxy!"
  407. chkconfig --add qubes-qrexec-agent || echo "WARNING: Cannot add service qubes-qrexec-agent!"
  408. chkconfig qubes-qrexec-agent on || echo "WARNING: Cannot enable service qubes-qrexec-agent!"
  409. # TODO: make this not display the silly message about security context...
  410. sed -i s/^id:.:initdefault:/id:3:initdefault:/ /etc/inittab
  411. %preun sysvinit
  412. if [ "$1" = 0 ] ; then
  413. # no more packages left
  414. chkconfig qubes-core off
  415. chkconfig qubes-core-netvm off
  416. chkconfig qubes-core-appvm off
  417. chkconfig qubes-firewall off
  418. chkconfig qubes-netwatcher off
  419. chkconfig qubes-updates-proxy off
  420. chkconfig qubes-qrexec-agent off
  421. fi
  422. %package systemd
  423. Summary: Qubes unit files for SystemD init style
  424. License: GPL v2 only
  425. Group: Qubes
  426. Requires: systemd
  427. Requires(post): systemd-units
  428. Requires(preun): systemd-units
  429. Requires(postun): systemd-units
  430. Requires: qubes-core-vm
  431. Provides: qubes-core-vm-init-scripts
  432. Conflicts: qubes-core-vm-sysvinit
  433. %description systemd
  434. The Qubes core startup configuration for SystemD init.
  435. %files systemd
  436. %defattr(-,root,root,-)
  437. /lib/systemd/system/qubes-dvm.service
  438. /lib/systemd/system/qubes-misc-post.service
  439. /lib/systemd/system/qubes-firewall.service
  440. /lib/systemd/system/qubes-mount-home.service
  441. /lib/systemd/system/qubes-netwatcher.service
  442. /lib/systemd/system/qubes-network.service
  443. /lib/systemd/system/qubes-iptables.service
  444. /lib/systemd/system/qubes-sysinit.service
  445. /lib/systemd/system/qubes-update-check.service
  446. /lib/systemd/system/qubes-update-check.timer
  447. /lib/systemd/system/qubes-updates-proxy.service
  448. /lib/systemd/system/qubes-qrexec-agent.service
  449. /lib/systemd/system-preset/75-qubes-vm.preset
  450. /lib/modules-load.d/qubes-core.conf
  451. /lib/modules-load.d/qubes-misc.conf
  452. %dir /usr/lib/qubes/init
  453. /usr/lib/qubes/init/prepare-dvm.sh
  454. /usr/lib/qubes/init/network-proxy-setup.sh
  455. /usr/lib/qubes/init/qubes-iptables
  456. /usr/lib/qubes/init/misc-post.sh
  457. /usr/lib/qubes/init/misc-post-stop.sh
  458. /usr/lib/qubes/init/mount-home.sh
  459. /usr/lib/qubes/init/qubes-sysinit.sh
  460. /lib/systemd/system/chronyd.service.d/30_qubes.conf
  461. /lib/systemd/system/crond.service.d/30_qubes.conf
  462. /lib/systemd/system/cups.service.d/30_qubes.conf
  463. /lib/systemd/system/cups.socket.d/30_qubes.conf
  464. /lib/systemd/system/cups.path.d/30_qubes.conf
  465. /lib/systemd/system/getty@tty.service.d/30_qubes.conf
  466. /lib/systemd/system/ModemManager.service.d/30_qubes.conf
  467. /lib/systemd/system/NetworkManager.service.d/30_qubes.conf
  468. /lib/systemd/system/NetworkManager-wait-online.service.d/30_qubes.conf
  469. /lib/systemd/system/ntpd.service.d/30_qubes.conf
  470. %post systemd
  471. PRESET_FAILED=0
  472. if [ $1 -eq 1 ]; then
  473. /bin/systemctl --no-reload preset-all > /dev/null 2>&1 && PRESET_FAILED=0 || PRESET_FAILED=1
  474. else
  475. services="qubes-dvm qubes-misc-post qubes-firewall qubes-mount-home"
  476. services="$services qubes-netwatcher qubes-network qubes-sysinit"
  477. services="$services qubes-iptables qubes-updates-proxy qubes-qrexec-agent"
  478. for srv in $services; do
  479. /bin/systemctl --no-reload preset $srv.service
  480. done
  481. /bin/systemctl --no-reload preset qubes-update-check.timer
  482. # Upgrade path - now qubes-iptables is used instead
  483. /bin/systemctl --no-reload preset iptables.service
  484. /bin/systemctl --no-reload preset ip6tables.service
  485. fi
  486. # Set default "runlevel"
  487. rm -f /etc/systemd/system/default.target
  488. ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
  489. grep '^[[:space:]]*[^#;]' /lib/systemd/system-preset/75-qubes-vm.preset | while read action unit_name; do
  490. case "$action" in
  491. (disable)
  492. if [ -f /lib/systemd/system/$unit_name ]; then
  493. if ! fgrep -q '[Install]' /lib/systemd/system/$unit_name; then
  494. # forcibly disable
  495. ln -sf /dev/null /etc/systemd/system/$unit_name
  496. fi
  497. fi
  498. ;;
  499. *)
  500. # preset-all is not available in fc20; so preset each unit file listed in 75-qubes-vm.preset
  501. if [ $1 -eq 1 -a "${PRESET_FAILED}" -eq 1 ]; then
  502. systemctl --no-reload preset "${unit_name}" > /dev/null 2>&1 || true
  503. fi
  504. ;;
  505. esac
  506. done
  507. /bin/systemctl daemon-reload
  508. exit 0
  509. %postun systemd
  510. #Do not run this part on upgrades
  511. if [ "$1" != 0 ] ; then
  512. exit 0
  513. fi
  514. for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-mount-home qubes-netwatcher qubes-network qubes-qrexec-agent; do
  515. /bin/systemctl disable $srv.service
  516. do