core-vm.spec 20 KB

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