core-vm.spec 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. Name: qubes-core-vm
  24. Version: %{version}
  25. Release: 1%{dist}
  26. Summary: The Qubes core files for VM
  27. Group: Qubes
  28. Vendor: Invisible Things Lab
  29. License: GPL
  30. URL: http://www.qubes-os.org
  31. Requires: /usr/bin/xenstore-read
  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. Requires: iptables-services
  38. Conflicts: firewalld
  39. %endif
  40. Requires: /usr/bin/mimeopen
  41. Requires: ethtool
  42. Requires: tinyproxy
  43. Requires: ntpdate
  44. Requires: net-tools
  45. Requires: nautilus-actions
  46. Requires: qubes-core-vm-kernel-placeholder
  47. Requires: qubes-utils
  48. Requires: initscripts
  49. %if %{fedora} >= 20
  50. # gpk-update-viewer required by qubes-manager
  51. Requires: gnome-packagekit-updater
  52. %endif
  53. Requires: ImageMagick
  54. Requires: fakeroot
  55. Requires: desktop-notification-daemon
  56. Provides: qubes-core-vm
  57. Obsoletes: qubes-core-commonvm
  58. Obsoletes: qubes-core-appvm
  59. Obsoletes: qubes-core-netvm
  60. Obsoletes: qubes-core-proxyvm
  61. Obsoletes: qubes-upgrade-vm < 2.0
  62. BuildRequires: xen-devel
  63. BuildRequires: qubes-utils-devel >= 2.0.5
  64. %define _builddir %(pwd)
  65. %define kde_service_dir /usr/share/kde4/services
  66. %description
  67. The Qubes core files for installation inside a Qubes VM.
  68. %prep
  69. # we operate on the current directory, so no need to unpack anything
  70. # symlink is to generate useful debuginfo packages
  71. rm -f %{name}-%{version}
  72. ln -sf . %{name}-%{version}
  73. %setup -T -D
  74. %build
  75. for dir in qubes-rpc qrexec misc; do
  76. (cd $dir; make)
  77. done
  78. %pre
  79. if [ "$1" != 1 ] ; then
  80. # do this whole %pre thing only when updating for the first time...
  81. exit 0
  82. fi
  83. mkdir -p /var/lib/qubes
  84. if [ -e /etc/fstab ] ; then
  85. mv /etc/fstab /var/lib/qubes/fstab.orig
  86. fi
  87. adduser --create-home user
  88. usermod -p '' root
  89. usermod -L user
  90. %install
  91. (cd qrexec; make install DESTDIR=$RPM_BUILD_ROOT)
  92. make install-vm DESTDIR=$RPM_BUILD_ROOT
  93. # Create ghost files to silent rpmbuild warnings, those files will NOT be
  94. # included in package
  95. mkdir -p $RPM_BUILD_ROOT/etc/systemd/system
  96. for f in ModemManager.service NetworkManager.service \
  97. NetworkManager-wait-online.service cups.service cups.socket cups.path; do
  98. cp $RPM_BUILD_ROOT/usr/lib/qubes/init/$f $RPM_BUILD_ROOT/etc/systemd/system/
  99. done
  100. %triggerin -- initscripts
  101. if [ -e /etc/init/serial.conf ]; then
  102. cp /usr/share/qubes/serial.conf /etc/init/serial.conf
  103. fi
  104. %triggerin -- pulseaudio-module-x11
  105. sed -i '/^\(Not\|Only\)ShowIn/d' /etc/xdg/autostart/pulseaudio.desktop
  106. echo 'NotShowIn=QUBES;' >> /etc/xdg/autostart/pulseaudio.desktop
  107. %post
  108. # disable some Upstart services
  109. for F in plymouth-shutdown prefdm splash-manager start-ttys tty ; do
  110. if [ -e /etc/init/$F.conf ]; then
  111. mv -f /etc/init/$F.conf /etc/init/$F.conf.disabled
  112. fi
  113. done
  114. remove_ShowIn () {
  115. if [ -e /etc/xdg/autostart/$1.desktop ]; then
  116. sed -i '/^\(Not\|Only\)ShowIn/d' /etc/xdg/autostart/$1.desktop
  117. fi
  118. }
  119. # reenable abrt-aplet if disable by some earlier version of package
  120. remove_ShowIn abrt-applet.desktop
  121. # don't want it at all
  122. for F in deja-dup-monitor imsettings-start krb5-auth-dialog pulseaudio restorecond sealertauto gnome-power-manager gnome-sound-applet gnome-screensaver orca-autostart; do
  123. if [ -e /etc/xdg/autostart/$F.desktop ]; then
  124. remove_ShowIn $F
  125. echo 'NotShowIn=QUBES;' >> /etc/xdg/autostart/$F.desktop
  126. fi
  127. done
  128. # don't want it in DisposableVM
  129. for F in gcm-apply ; do
  130. if [ -e /etc/xdg/autostart/$F.desktop ]; then
  131. remove_ShowIn $F
  132. echo 'NotShowIn=DisposableVM;' >> /etc/xdg/autostart/$F.desktop
  133. fi
  134. done
  135. # want it in AppVM only
  136. for F in gnome-keyring-gpg gnome-keyring-pkcs11 gnome-keyring-secrets gnome-keyring-ssh gnome-settings-daemon user-dirs-update-gtk gsettings-data-convert ; do
  137. if [ -e /etc/xdg/autostart/$F.desktop ]; then
  138. remove_ShowIn $F
  139. echo 'OnlyShowIn=GNOME;AppVM;' >> /etc/xdg/autostart/$F.desktop
  140. fi
  141. done
  142. # remove existing rule to add own later
  143. for F in gpk-update-icon nm-applet ; do
  144. remove_ShowIn $F
  145. done
  146. echo 'OnlyShowIn=GNOME;UpdateableVM;' >> /etc/xdg/autostart/gpk-update-icon.desktop || :
  147. %if %{fedora} >= 20
  148. echo 'OnlyShowIn=GNOME;QUBES;' >> /etc/xdg/autostart/nm-applet.desktop || :
  149. %else
  150. echo 'OnlyShowIn=GNOME;NetVM;' >> /etc/xdg/autostart/nm-applet.desktop || :
  151. %endif
  152. # Create NetworkManager configuration if we do not have it
  153. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  154. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  155. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  156. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  157. fi
  158. /usr/lib/qubes/qubes-fix-nm-conf.sh
  159. # Remove ip_forward setting from sysctl, so NM will not reset it
  160. sed 's/^net.ipv4.ip_forward.*/#\0/' -i /etc/sysctl.conf
  161. # Remove old firmware updates link
  162. if [ -L /lib/firmware/updates ]; then
  163. rm -f /lib/firmware/updates
  164. fi
  165. if ! grep -q '/etc/yum\.conf\.d/qubes-proxy\.conf' /etc/yum.conf; then
  166. echo >> /etc/yum.conf
  167. echo '# Yum does not support inclusion of config dir...' >> /etc/yum.conf
  168. echo 'include=file:///etc/yum.conf.d/qubes-proxy.conf' >> /etc/yum.conf
  169. fi
  170. # Revert 'Prevent unnecessary updates in VMs':
  171. sed -i -e '/^exclude = kernel/d' /etc/yum.conf
  172. # qubes-core-vm has been broken for some time - it overrides /etc/hosts; restore original content
  173. if ! grep -q localhost /etc/hosts; then
  174. cat <<EOF > /etc/hosts
  175. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 `hostname`
  176. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  177. EOF
  178. fi
  179. if [ "$1" != 1 ] ; then
  180. # do the rest of %post thing only when updating for the first time...
  181. exit 0
  182. fi
  183. if [ -e /etc/init/serial.conf ] && ! [ -f /var/lib/qubes/serial.orig ] ; then
  184. cp /etc/init/serial.conf /var/lib/qubes/serial.orig
  185. fi
  186. # Remove most of the udev scripts to speed up the VM boot time
  187. # Just leave the xen* scripts, that are needed if this VM was
  188. # ever used as a net backend (e.g. as a VPN domain in the future)
  189. #echo "--> Removing unnecessary udev scripts..."
  190. mkdir -p /var/lib/qubes/removed-udev-scripts
  191. for f in /etc/udev/rules.d/*
  192. do
  193. if [ $(basename $f) == "xen-backend.rules" ] ; then
  194. continue
  195. fi
  196. if [ $(basename $f) == "50-qubes-misc.rules" ] ; then
  197. continue
  198. fi
  199. if echo $f | grep -q qubes; then
  200. continue
  201. fi
  202. mv $f /var/lib/qubes/removed-udev-scripts/
  203. done
  204. mkdir -p /rw
  205. #rm -f /etc/mtab
  206. #echo "--> Removing HWADDR setting from /etc/sysconfig/network-scripts/ifcfg-eth0"
  207. #mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.orig
  208. #grep -v HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0
  209. %triggerin -- notification-daemon
  210. # Enable autostart of notification-daemon when installed
  211. if [ ! -e /etc/xdg/autostart/notification-daemon.desktop ]; then
  212. ln -s /usr/share/applications/notification-daemon.desktop /etc/xdg/autostart/
  213. fi
  214. exit 0
  215. %triggerin -- selinux-policy
  216. #echo "--> Disabling SELinux..."
  217. sed -e s/^SELINUX=.*$/SELINUX=disabled/ </etc/selinux/config >/etc/selinux/config.processed
  218. mv /etc/selinux/config.processed /etc/selinux/config
  219. setenforce 0 2>/dev/null
  220. exit 0
  221. %preun
  222. if [ "$1" = 0 ] ; then
  223. # no more packages left
  224. if [ -e /var/lib/qubes/fstab.orig ] ; then
  225. mv /var/lib/qubes/fstab.orig /etc/fstab
  226. fi
  227. mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
  228. if [ -e /var/lib/qubes/serial.orig ] ; then
  229. mv /var/lib/qubes/serial.orig /etc/init/serial.conf
  230. fi
  231. fi
  232. %postun
  233. if [ $1 -eq 0 ] ; then
  234. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  235. if [ -l /lib/firmware/updates ]; then
  236. rm /lib/firmware/updates
  237. fi
  238. fi
  239. %posttrans
  240. /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
  241. %clean
  242. rm -rf $RPM_BUILD_ROOT
  243. rm -f %{name}-%{version}
  244. %files
  245. %defattr(-,root,root,-)
  246. %dir /var/lib/qubes
  247. %dir /var/run/qubes
  248. %dir %attr(0775,user,user) /var/lib/qubes/dom0-updates
  249. %{kde_service_dir}/qvm-copy.desktop
  250. %{kde_service_dir}/qvm-move.desktop
  251. %{kde_service_dir}/qvm-dvm.desktop
  252. /etc/NetworkManager/dispatcher.d/30-qubes-external-ip
  253. /etc/NetworkManager/dispatcher.d/qubes-nmhook
  254. %config(noreplace) /etc/X11/xorg-preload-apps.conf
  255. /etc/dispvm-dotfiles.tbz
  256. /etc/dhclient.d/qubes-setup-dnat-to-ns.sh
  257. /etc/fstab
  258. /etc/pki/rpm-gpg/RPM-GPG-KEY-qubes*
  259. %config(noreplace) /etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla
  260. %config(noreplace) /etc/polkit-1/rules.d/00-qubes-allow-all.rules
  261. %dir /etc/qubes-rpc
  262. /etc/qubes-rpc/qubes.Filecopy
  263. /etc/qubes-rpc/qubes.OpenInVM
  264. /etc/qubes-rpc/qubes.GetAppmenus
  265. /etc/qubes-rpc/qubes.VMShell
  266. /etc/qubes-rpc/qubes.SyncNtpClock
  267. /etc/qubes-rpc/qubes.SuspendPre
  268. /etc/qubes-rpc/qubes.SuspendPost
  269. /etc/qubes-rpc/qubes.WaitForSession
  270. /etc/qubes-rpc/qubes.DetachPciDevice
  271. /etc/qubes-rpc/qubes.Backup
  272. /etc/qubes-rpc/qubes.Restore
  273. /etc/qubes-rpc/qubes.SelectFile
  274. /etc/qubes-rpc/qubes.SelectDirectory
  275. /etc/qubes-rpc/qubes.GetImageRGBA
  276. /etc/qubes-rpc/qubes.SetDateTime
  277. %config(noreplace) /etc/sudoers.d/qubes
  278. %config(noreplace) /etc/sysconfig/iptables
  279. %config(noreplace) /etc/sysconfig/ip6tables
  280. %config(noreplace) /etc/tinyproxy/filter-updates
  281. %config(noreplace) /etc/tinyproxy/tinyproxy-updates.conf
  282. %config(noreplace) /etc/udev/rules.d/50-qubes-misc.rules
  283. %config(noreplace) /etc/udev/rules.d/99-qubes-network.rules
  284. /etc/xdg/autostart/00-qubes-show-hide-nm-applet.desktop
  285. /etc/xdg/nautilus-actions/nautilus-actions.conf
  286. /etc/xen/scripts/vif-route-qubes
  287. %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf
  288. %config(noreplace) /etc/yum.repos.d/qubes-r2.repo
  289. /etc/yum/pluginconf.d/yum-qubes-hooks.conf
  290. /etc/yum/post-actions/qubes-trigger-sync-appmenus.action
  291. /usr/lib/systemd/system/user@.service.d/90-session-stop-timeout.conf
  292. /usr/sbin/qubes-serial-login
  293. /usr/bin/qvm-copy-to-vm
  294. /usr/bin/qvm-move-to-vm
  295. /usr/bin/qvm-open-in-dvm
  296. /usr/bin/qvm-open-in-vm
  297. /usr/bin/qvm-run
  298. /usr/bin/qvm-mru-entry
  299. /usr/bin/xenstore-watch-qubes
  300. %dir /usr/lib/qubes
  301. /usr/lib/qubes/vusb-ctl.py*
  302. /usr/lib/qubes/dispvm-prerun.sh
  303. /usr/lib/qubes/sync-ntp-clock
  304. /usr/lib/qubes/prepare-suspend
  305. /usr/lib/qubes/network-manager-prepare-conf-dir
  306. /usr/lib/qubes/show-hide-nm-applet.sh
  307. /usr/lib/qubes/qrexec-agent
  308. /usr/lib/qubes/qrexec-client-vm
  309. /usr/lib/qubes/qrexec_client_vm
  310. /usr/lib/qubes/qubes-rpc-multiplexer
  311. /usr/lib/qubes/qfile-agent
  312. %attr(4755,root,root) /usr/lib/qubes/qfile-unpacker
  313. /usr/lib/qubes/qopen-in-vm
  314. /usr/lib/qubes/qrun-in-vm
  315. /usr/lib/qubes/qubes-download-dom0-updates.sh
  316. /usr/lib/qubes/qubes-fix-nm-conf.sh
  317. /usr/lib/qubes/qubes-setup-dnat-to-ns
  318. /usr/lib/qubes/qubes-trigger-sync-appmenus.sh
  319. /usr/lib/qubes/qvm-copy-to-vm.gnome
  320. /usr/lib/qubes/qvm-copy-to-vm.kde
  321. /usr/lib/qubes/qvm-move-to-vm.gnome
  322. /usr/lib/qubes/qvm-move-to-vm.kde
  323. /usr/lib/qubes/setup-ip
  324. /usr/lib/qubes/tar2qfile
  325. /usr/lib/qubes/vm-file-editor
  326. /usr/lib/qubes/wrap-in-html-if-url.sh
  327. /usr/lib/qubes/iptables-updates-proxy
  328. /usr/lib/qubes/close-window
  329. /usr/lib/yum-plugins/yum-qubes-hooks.py*
  330. /usr/sbin/qubes-firewall
  331. /usr/sbin/qubes-netwatcher
  332. /usr/share/qubes/serial.conf
  333. /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.override
  334. /usr/share/glib-2.0/schemas/org.gnome.nautilus.gschema.override
  335. /usr/share/file-manager/actions/qvm-copy-gnome.desktop
  336. /usr/share/file-manager/actions/qvm-move-gnome.desktop
  337. /usr/share/file-manager/actions/qvm-dvm-gnome.desktop
  338. %dir /usr/share/qubes
  339. /usr/share/qubes/mime-override/globs
  340. %dir /home_volatile
  341. %attr(700,user,user) /home_volatile/user
  342. %dir /mnt/removable
  343. %package sysvinit
  344. Summary: Qubes unit files for SysV init style or upstart
  345. License: GPL v2 only
  346. Group: Qubes
  347. Requires: upstart
  348. Requires: qubes-core-vm
  349. Provides: qubes-core-vm-init-scripts
  350. Conflicts: qubes-core-vm-systemd
  351. %description sysvinit
  352. The Qubes core startup configuration for SysV init (or upstart).
  353. %files sysvinit
  354. /etc/init.d/qubes-core
  355. /etc/init.d/qubes-core-appvm
  356. /etc/init.d/qubes-core-netvm
  357. /etc/init.d/qubes-firewall
  358. /etc/init.d/qubes-netwatcher
  359. /etc/init.d/qubes-updates-proxy
  360. /etc/init.d/qubes-qrexec-agent
  361. /etc/sysconfig/modules/qubes-core.modules
  362. /etc/sysconfig/modules/qubes-misc.modules
  363. %post sysvinit
  364. #echo "--> Turning off unnecessary services..."
  365. # FIXME: perhaps there is more elegant way to do this?
  366. for f in /etc/init.d/*
  367. do
  368. srv=`basename $f`
  369. [ $srv = 'functions' ] && continue
  370. [ $srv = 'killall' ] && continue
  371. [ $srv = 'halt' ] && continue
  372. [ $srv = 'single' ] && continue
  373. [ $srv = 'reboot' ] && continue
  374. [ $srv = 'qubes-gui' ] && continue
  375. chkconfig $srv off
  376. done
  377. #echo "--> Enabling essential services..."
  378. chkconfig rsyslog on
  379. chkconfig haldaemon on
  380. chkconfig messagebus on
  381. chkconfig iptables on
  382. chkconfig ip6tables on
  383. chkconfig --add qubes-core || echo "WARNING: Cannot add service qubes-core!"
  384. chkconfig qubes-core on || echo "WARNING: Cannot enable service qubes-core!"
  385. chkconfig --add qubes-core-netvm || echo "WARNING: Cannot add service qubes-core-netvm!"
  386. chkconfig qubes-core-netvm on || echo "WARNING: Cannot enable service qubes-core-netvm!"
  387. chkconfig --add qubes-core-appvm || echo "WARNING: Cannot add service qubes-core-appvm!"
  388. chkconfig qubes-core-appvm on || echo "WARNING: Cannot enable service qubes-core-appvm!"
  389. chkconfig --add qubes-firewall || echo "WARNING: Cannot add service qubes-firewall!"
  390. chkconfig qubes-firewall on || echo "WARNING: Cannot enable service qubes-firewall!"
  391. chkconfig --add qubes-netwatcher || echo "WARNING: Cannot add service qubes-netwatcher!"
  392. chkconfig qubes-netwatcher on || echo "WARNING: Cannot enable service qubes-netwatcher!"
  393. chkconfig --add qubes-updates-proxy || echo "WARNING: Cannot add service qubes-updates-proxy!"
  394. chkconfig qubes-updates-proxy on || echo "WARNING: Cannot enable service qubes-updates-proxy!"
  395. chkconfig --add qubes-qrexec-agent || echo "WARNING: Cannot add service qubes-qrexec-agent!"
  396. chkconfig qubes-qrexec-agent on || echo "WARNING: Cannot enable service qubes-qrexec-agent!"
  397. # TODO: make this not display the silly message about security context...
  398. sed -i s/^id:.:initdefault:/id:3:initdefault:/ /etc/inittab
  399. %preun sysvinit
  400. if [ "$1" = 0 ] ; then
  401. # no more packages left
  402. chkconfig qubes-core off
  403. chkconfig qubes-core-netvm off
  404. chkconfig qubes-core-appvm off
  405. chkconfig qubes-firewall off
  406. chkconfig qubes-netwatcher off
  407. chkconfig qubes-updates-proxy off
  408. chkconfig qubes-qrexec-agent off
  409. fi
  410. %package systemd
  411. Summary: Qubes unit files for SystemD init style
  412. License: GPL v2 only
  413. Group: Qubes
  414. Requires: systemd
  415. Requires(post): systemd-units
  416. Requires(preun): systemd-units
  417. Requires(postun): systemd-units
  418. Requires: qubes-core-vm
  419. Provides: qubes-core-vm-init-scripts
  420. Conflicts: qubes-core-vm-sysvinit
  421. %description systemd
  422. The Qubes core startup configuration for SystemD init.
  423. %files systemd
  424. %defattr(-,root,root,-)
  425. /lib/systemd/system/qubes-dvm.service
  426. /lib/systemd/system/qubes-misc-post.service
  427. /lib/systemd/system/qubes-firewall.service
  428. /lib/systemd/system/qubes-netwatcher.service
  429. /lib/systemd/system/qubes-network.service
  430. /lib/systemd/system/qubes-sysinit.service
  431. /lib/systemd/system/qubes-update-check.service
  432. /lib/systemd/system/qubes-update-check.timer
  433. /lib/systemd/system/qubes-updates-proxy.service
  434. /lib/systemd/system/qubes-qrexec-agent.service
  435. /lib/modules-load.d/qubes-core.conf
  436. /lib/modules-load.d/qubes-misc.conf
  437. %dir /usr/lib/qubes/init
  438. /usr/lib/qubes/init/prepare-dvm.sh
  439. /usr/lib/qubes/init/network-proxy-setup.sh
  440. /usr/lib/qubes/init/misc-post.sh
  441. /usr/lib/qubes/init/misc-post-stop.sh
  442. /usr/lib/qubes/init/qubes-sysinit.sh
  443. /usr/lib/qubes/init/ModemManager.service
  444. /usr/lib/qubes/init/NetworkManager.service
  445. /usr/lib/qubes/init/NetworkManager-wait-online.service
  446. /usr/lib/qubes/init/cups.service
  447. /usr/lib/qubes/init/cups.socket
  448. /usr/lib/qubes/init/cups.path
  449. /usr/lib/qubes/init/ntpd.service
  450. /usr/lib/qubes/init/chronyd.service
  451. %ghost %attr(0644,root,root) /etc/systemd/system/ModemManager.service
  452. %ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager.service
  453. %ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager-wait-online.service
  454. %ghost %attr(0644,root,root) /etc/systemd/system/cups.service
  455. %ghost %attr(0644,root,root) /etc/systemd/system/cups.socket
  456. %ghost %attr(0644,root,root) /etc/systemd/system/cups.path
  457. %post systemd
  458. for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-updates-proxy qubes-qrexec-agent; do
  459. /bin/systemctl enable $srv.service 2> /dev/null
  460. done
  461. /bin/systemctl enable qubes-update-check.timer 2> /dev/null
  462. UNITDIR=/lib/systemd/system
  463. OVERRIDEDIR=/usr/lib/qubes/init
  464. # Install overriden services only when original exists
  465. for srv in cups ModemManager NetworkManager NetworkManager-wait-online ntpd chronyd; do
  466. if [ -f $UNITDIR/$srv.service ]; then
  467. cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
  468. fi
  469. if [ -f $UNITDIR/$srv.socket -a -f $OVERRIDEDIR/$srv.socket ]; then
  470. cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/
  471. fi
  472. if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then
  473. cp $OVERRIDEDIR/$srv.path /etc/systemd/system/
  474. fi
  475. done
  476. # Set default "runlevel"
  477. rm -f /etc/systemd/system/default.target
  478. ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
  479. DISABLE_SERVICES="alsa-store alsa-restore auditd avahi avahi-daemon backuppc cpuspeed crond"
  480. DISABLE_SERVICES="$DISABLE_SERVICES fedora-autorelabel fedora-autorelabel-mark ipmi hwclock-load hwclock-save"
  481. DISABLE_SERVICES="$DISABLE_SERVICES mdmonitor multipathd openct rpcbind mcelog fedora-storage-init fedora-storage-init-late"
  482. DISABLE_SERVICES="$DISABLE_SERVICES plymouth-start plymouth-read-write plymouth-quit plymouth-quit-wait"
  483. DISABLE_SERVICES="$DISABLE_SERVICES sshd tcsd sm-client sendmail mdmonitor-takeover"
  484. DISABLE_SERVICES="$DISABLE_SERVICES rngd smartd upower irqbalance colord"
  485. for srv in $DISABLE_SERVICES; do
  486. if [ -f /lib/systemd/system/$srv.service ]; then
  487. if fgrep -q '[Install]' /lib/systemd/system/$srv.service; then
  488. /bin/systemctl disable $srv.service 2> /dev/null
  489. else
  490. # forcibly disable
  491. ln -sf /dev/null /etc/systemd/system/$srv.service
  492. fi
  493. fi
  494. done
  495. rm -f /etc/systemd/system/getty.target.wants/getty@tty*.service
  496. # Enable some services
  497. /bin/systemctl enable iptables.service 2> /dev/null
  498. /bin/systemctl enable ip6tables.service 2> /dev/null
  499. /bin/systemctl enable rsyslog.service 2> /dev/null
  500. /bin/systemctl enable ntpd.service 2> /dev/null
  501. # Enable cups only when it is real SystemD service
  502. [ -e /lib/systemd/system/cups.service ] && /bin/systemctl enable cups.service 2> /dev/null
  503. exit 0
  504. %triggerin systemd -- NetworkManager
  505. UNITDIR=/lib/systemd/system
  506. OVERRIDEDIR=/usr/lib/qubes/init
  507. # Install overriden services only when original exists
  508. for srv in ModemManager NetworkManager NetworkManager-wait-online; do
  509. if [ -f $UNITDIR/$srv.service ]; then
  510. cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
  511. fi
  512. if [ -f $UNITDIR/$srv.socket -a -f $OVERRIDEDIR/$srv.socket ]; then
  513. cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/
  514. fi
  515. if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then
  516. cp $OVERRIDEDIR/$srv.path /etc/systemd/system/
  517. fi
  518. done
  519. # Disable original service to enable overriden one
  520. /bin/systemctl disable ModemManager.service 2> /dev/null
  521. /bin/systemctl disable NetworkManager.service 2> /dev/null
  522. # Disable D-BUS activation of NetworkManager - in AppVm it causes problems (eg PackageKit timeouts)
  523. /bin/systemctl mask dbus-org.freedesktop.NetworkManager.service 2> /dev/null
  524. /bin/systemctl enable ModemManager.service 2> /dev/null
  525. /bin/systemctl enable NetworkManager.service 2> /dev/null
  526. # Fix for https://bugzilla.redhat.com/show_bug.cgi?id=974811
  527. /bin/systemctl enable NetworkManager-dispatcher.service 2> /dev/null
  528. exit 0
  529. %triggerin systemd -- cups
  530. UNITDIR=/lib/systemd/system
  531. OVERRIDEDIR=/usr/lib/qubes/init
  532. # Install overriden services only when original exists
  533. for srv in cups; do
  534. if [ -f $UNITDIR/$srv.service ]; then
  535. cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
  536. fi
  537. if [ -f $UNITDIR/$srv.socket -a -f $OVERRIDEDIR/$srv.socket ]; then
  538. cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/
  539. fi
  540. if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then
  541. cp $OVERRIDEDIR/$srv.path /etc/systemd/system/
  542. fi
  543. done
  544. # Enable cups only when it is real SystemD service
  545. [ -e /lib/systemd/system/cups.service ] && /bin/systemctl enable cups.service 2> /dev/null
  546. exit 0
  547. %triggerin systemd -- haveged
  548. /bin/systemctl enable haveged.service 2> /dev/null
  549. exit 0
  550. %postun systemd
  551. #Do not run this part on upgrades
  552. if [ "$1" != 0 ] ; then
  553. exit 0
  554. fi
  555. for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-qrexec-agent; do
  556. /bin/systemctl disable $srv.service
  557. do