core-vm.spec 19 KB

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