core-vm.spec 23 KB

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