core-dom0.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. #
  2. # This is the SPEC file for creating binary RPMs for the Dom0.
  3. #
  4. #
  5. # The Qubes OS Project, http://www.qubes-os.org
  6. #
  7. # Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
  8. # Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
  9. #
  10. # This program is free software; you can redistribute it and/or
  11. # modify it under the terms of the GNU General Public License
  12. # as published by the Free Software Foundation; either version 2
  13. # of the License, or (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program; if not, write to the Free Software
  22. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  23. #
  24. #
  25. #%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(False)")}
  26. %{!?version: %define version %(cat version)}
  27. # debug_package hack should be removed when BuildArch:noarch is enabled below
  28. %define debug_package %{nil}
  29. %define _dracutmoddir /usr/lib/dracut/modules.d
  30. %if %{fedora} < 17
  31. %define _dracutmoddir /usr/share/dracut/modules.d
  32. %endif
  33. Name: qubes-core-dom0
  34. Version: %{version}
  35. Release: 1%{dist}
  36. Summary: The Qubes core files (Dom0-side)
  37. Group: Qubes
  38. Vendor: Invisible Things Lab
  39. License: GPL
  40. URL: http://www.qubes-os.org
  41. # because we have "#!/usr/bin/env python" shebangs, RPM puts
  42. # "Requires: $(which # python)" dependency, which, depending on $PATH order,
  43. # may point to /usr/bin/python or /bin/python (because Fedora has this stupid
  44. # /bin -> usr/bin symlink). python*.rpm provides only /usr/bin/python.
  45. AutoReq: no
  46. # FIXME: Enable this and disable debug_package
  47. #BuildArch: noarch
  48. BuildRequires: ImageMagick
  49. BuildRequires: systemd-units
  50. # for building documentation
  51. BuildRequires: python-sphinx
  52. BuildRequires: libvirt-python
  53. BuildRequires: dbus-python
  54. Requires(post): systemd-units
  55. Requires(preun): systemd-units
  56. Requires(postun): systemd-units
  57. Requires: python, pciutils, python-inotify, python-daemon
  58. Requires: python-setuptools
  59. Requires: qubes-core-dom0-linux >= 3.1.8
  60. Requires: qubes-core-dom0-doc
  61. Requires: qubes-db-dom0
  62. Requires: python-lxml
  63. # TODO: R: qubes-gui-dom0 >= 2.1.11
  64. Conflicts: qubes-gui-dom0 < 1.1.13
  65. Requires: libvirt-python
  66. %if x%{?backend_vmm} == xxen
  67. Requires: xen-runtime
  68. Requires: xen-hvm
  69. Requires: libvirt-daemon-xen >= 1.2.20-6
  70. %endif
  71. Requires: createrepo
  72. Requires: gnome-packagekit
  73. Requires: cronie
  74. Requires: bsdtar
  75. # for qubes-hcl-report
  76. Requires: dmidecode
  77. Requires: PyQt4
  78. # for property's docstrings
  79. Requires: python-docutils
  80. # for lvm support
  81. Requires: lvm2-python-libs
  82. # Prevent preupgrade from installation (it pretend to provide distribution upgrade)
  83. Obsoletes: preupgrade < 2.0
  84. Provides: preupgrade = 2.0
  85. %define _builddir %(pwd)
  86. %description
  87. The Qubes core files for installation on Dom0.
  88. %prep
  89. # we operate on the current directory, so no need to unpack anything
  90. # symlink is to generate useful debuginfo packages
  91. rm -f %{name}-%{version}
  92. ln -sf . %{name}-%{version}
  93. %setup -T -D
  94. %build
  95. make all
  96. %install
  97. make install \
  98. DESTDIR=$RPM_BUILD_ROOT \
  99. UNITDIR=%{_unitdir} \
  100. PYTHON_SITEPATH=%{python_sitelib} \
  101. SYSCONFDIR=%{_sysconfdir}
  102. %post
  103. # Create NetworkManager configuration if we do not have it
  104. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  105. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  106. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  107. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  108. fi
  109. sed '/^autoballoon=/d;/^lockfile=/d' -i /etc/xen/xl.conf
  110. echo 'autoballoon=0' >> /etc/xen/xl.conf
  111. echo 'lockfile="/var/run/qubes/xl-lock"' >> /etc/xen/xl.conf
  112. sed 's/^PRELINKING\s*=.*/PRELINKING=no/' -i /etc/sysconfig/prelink
  113. systemctl --no-reload enable qubes-core.service >/dev/null 2>&1
  114. systemctl --no-reload enable qubes-netvm.service >/dev/null 2>&1
  115. systemctl --no-reload enable qubes-setupdvm.service >/dev/null 2>&1
  116. # Conflicts with libxl stack, so disable it
  117. systemctl --no-reload disable xend.service >/dev/null 2>&1
  118. systemctl --no-reload disable xendomains.service >/dev/null 2>&1
  119. systemctl daemon-reload >/dev/null 2>&1 || :
  120. HAD_SYSCONFIG_NETWORK=yes
  121. if ! [ -e /etc/sysconfig/network ]; then
  122. HAD_SYSCONFIG_NETWORK=no
  123. # supplant empty one so NetworkManager init script does not complain
  124. touch /etc/sysconfig/network
  125. fi
  126. # Load evtchn module - xenstored needs it
  127. modprobe evtchn 2> /dev/null || modprobe xen-evtchn
  128. service xenstored start
  129. if ! [ -e /var/lib/qubes/qubes.xml ]; then
  130. # echo "Initializing Qubes DB..."
  131. umask 007; sg qubes -c qvm-init-storage
  132. qubes-prefs -s default-kernel `ls /var/lib/qubes/vm-kernels|head -n 1` 2> /dev/null
  133. fi
  134. # Because we now have an installer
  135. # this script is always executed during upgrade
  136. # and we decided not to restart core during upgrade
  137. #service qubes_core start
  138. if [ "x"$HAD_SYSCONFIG_NETWORK = "xno" ]; then
  139. rm -f /etc/sysconfig/network
  140. fi
  141. %clean
  142. rm -rf $RPM_BUILD_ROOT
  143. rm -f %{name}-%{version}
  144. %pre
  145. if ! grep -q ^qubes: /etc/group ; then
  146. groupadd qubes
  147. fi
  148. %triggerin -- xen-runtime
  149. /usr/lib/qubes/fix-dir-perms.sh
  150. %preun
  151. if [ "$1" = 0 ] ; then
  152. # no more packages left
  153. service qubes_netvm stop
  154. service qubes_core stop
  155. fi
  156. %postun
  157. if [ "$1" = 0 ] ; then
  158. # no more packages left
  159. chgrp root /etc/xen
  160. chmod 700 /etc/xen
  161. groupdel qubes
  162. fi
  163. %files
  164. %defattr(-,root,root,-)
  165. %config(noreplace) %attr(0664,root,qubes) %{_sysconfdir}/qubes/qmemman.conf
  166. /usr/bin/qvm-*
  167. /usr/bin/qubes-*
  168. /usr/bin/qmemmand
  169. %dir %{python_sitelib}/qubes-*.egg-info
  170. %{python_sitelib}/qubes-*.egg-info/*
  171. %dir %{python_sitelib}/qubes
  172. %{python_sitelib}/qubes/__init__.py*
  173. %{python_sitelib}/qubes/app.py*
  174. %{python_sitelib}/qubes/backup.py*
  175. %{python_sitelib}/qubes/config.py*
  176. %{python_sitelib}/qubes/core2migration.py*
  177. %{python_sitelib}/qubes/devices.py*
  178. %{python_sitelib}/qubes/dochelpers.py*
  179. %{python_sitelib}/qubes/events.py*
  180. %{python_sitelib}/qubes/exc.py*
  181. %{python_sitelib}/qubes/log.py*
  182. %{python_sitelib}/qubes/rngdoc.py*
  183. %{python_sitelib}/qubes/utils.py*
  184. %dir %{python_sitelib}/qubes/vm
  185. %{python_sitelib}/qubes/vm/__init__.py*
  186. %{python_sitelib}/qubes/vm/adminvm.py*
  187. %{python_sitelib}/qubes/vm/appvm.py*
  188. %{python_sitelib}/qubes/vm/dispvm.py*
  189. %{python_sitelib}/qubes/vm/qubesvm.py*
  190. %{python_sitelib}/qubes/vm/standalonevm.py*
  191. %{python_sitelib}/qubes/vm/templatevm.py*
  192. %dir %{python_sitelib}/qubes/vm/mix
  193. %{python_sitelib}/qubes/vm/mix/__init__.py*
  194. %{python_sitelib}/qubes/vm/mix/net.py*
  195. %dir %{python_sitelib}/qubes/storage
  196. %{python_sitelib}/qubes/storage/__init__.py*
  197. %{python_sitelib}/qubes/storage/file.py*
  198. %{python_sitelib}/qubes/storage/domain.py*
  199. %{python_sitelib}/qubes/storage/kernels.py*
  200. %{python_sitelib}/qubes/storage/lvm.py*
  201. %dir %{python_sitelib}/qubes/tools
  202. %{python_sitelib}/qubes/tools/__init__.py*
  203. %{python_sitelib}/qubes/tools/qmemmand.py*
  204. %{python_sitelib}/qubes/tools/qubes_create.py*
  205. %{python_sitelib}/qubes/tools/qubes_monitor_layout_notify.py*
  206. %{python_sitelib}/qubes/tools/qubes_prefs.py*
  207. %{python_sitelib}/qubes/tools/qvm_block.py*
  208. %{python_sitelib}/qubes/tools/qubes_lvm.py*
  209. %{python_sitelib}/qubes/tools/qvm_create.py*
  210. %{python_sitelib}/qubes/tools/qvm_features.py*
  211. %{python_sitelib}/qubes/tools/qvm_check.py*
  212. %{python_sitelib}/qubes/tools/qvm_clone.py*
  213. %{python_sitelib}/qubes/tools/qvm_kill.py*
  214. %{python_sitelib}/qubes/tools/qvm_ls.py*
  215. %{python_sitelib}/qubes/tools/qvm_pause.py*
  216. %{python_sitelib}/qubes/tools/qvm_pool.py*
  217. %{python_sitelib}/qubes/tools/qvm_prefs.py*
  218. %{python_sitelib}/qubes/tools/qvm_remove.py*
  219. %{python_sitelib}/qubes/tools/qvm_run.py*
  220. %{python_sitelib}/qubes/tools/qvm_shutdown.py*
  221. %{python_sitelib}/qubes/tools/qvm_start.py*
  222. %{python_sitelib}/qubes/tools/qvm_unpause.py*
  223. %dir %{python_sitelib}/qubes/ext
  224. %{python_sitelib}/qubes/ext/__init__.py*
  225. %{python_sitelib}/qubes/ext/gui.py*
  226. %{python_sitelib}/qubes/ext/qubesmanager.py*
  227. %{python_sitelib}/qubes/ext/r3compatibility.py*
  228. %dir %{python_sitelib}/qubes/tests
  229. %{python_sitelib}/qubes/tests/__init__.py*
  230. %{python_sitelib}/qubes/tests/run.py*
  231. %{python_sitelib}/qubes/tests/extra.py*
  232. %{python_sitelib}/qubes/tests/app.py*
  233. %{python_sitelib}/qubes/tests/devices.py*
  234. %{python_sitelib}/qubes/tests/events.py*
  235. %{python_sitelib}/qubes/tests/init.py*
  236. %{python_sitelib}/qubes/tests/storage.py*
  237. %{python_sitelib}/qubes/tests/storage_file.py*
  238. %{python_sitelib}/qubes/tests/storage_lvm.py*
  239. %dir %{python_sitelib}/qubes/tests/vm
  240. %{python_sitelib}/qubes/tests/vm/__init__.py*
  241. %{python_sitelib}/qubes/tests/vm/init.py*
  242. %{python_sitelib}/qubes/tests/vm/adminvm.py*
  243. %{python_sitelib}/qubes/tests/vm/qubesvm.py*
  244. %dir %{python_sitelib}/qubes/tests/vm/mix
  245. %{python_sitelib}/qubes/tests/vm/mix/__init__.py*
  246. %{python_sitelib}/qubes/tests/vm/mix/net.py*
  247. %dir %{python_sitelib}/qubes/tests/tools
  248. %{python_sitelib}/qubes/tests/tools/__init__.py*
  249. %{python_sitelib}/qubes/tests/tools/init.py*
  250. %{python_sitelib}/qubes/tests/tools/qvm_ls.py*
  251. %dir %{python_sitelib}/qubes/tests/int
  252. %{python_sitelib}/qubes/tests/int/__init__.py*
  253. %{python_sitelib}/qubes/tests/int/backup.py*
  254. %{python_sitelib}/qubes/tests/int/backupcompatibility.py*
  255. %{python_sitelib}/qubes/tests/int/basic.py*
  256. %{python_sitelib}/qubes/tests/int/dom0_update.py*
  257. %{python_sitelib}/qubes/tests/int/network.py*
  258. %dir %{python_sitelib}/qubes/tests/int/tools
  259. %{python_sitelib}/qubes/tests/int/tools/__init__.py*
  260. %{python_sitelib}/qubes/tests/int/tools/qubes_create.py*
  261. %{python_sitelib}/qubes/tests/int/tools/qvm_prefs.py*
  262. %{python_sitelib}/qubes/tests/int/tools/qvm_run.py*
  263. %dir %{python_sitelib}/qubes/qmemman
  264. %{python_sitelib}/qubes/qmemman/__init__.py*
  265. %{python_sitelib}/qubes/qmemman/algo.py*
  266. %{python_sitelib}/qubes/qmemman/client.py*
  267. /usr/lib/qubes/unbind-pci-device.sh
  268. /usr/lib/qubes/cleanup-dispvms
  269. /usr/lib/qubes/qfile-daemon-dvm*
  270. /usr/lib/qubes/block-cleaner-daemon.py*
  271. /usr/lib/qubes/vusb-ctl.py*
  272. /usr/lib/qubes/xl-qvm-usb-attach.py*
  273. /usr/lib/qubes/xl-qvm-usb-detach.py*
  274. /usr/lib/qubes/fix-dir-perms.sh
  275. /usr/lib/qubes/startup-dvm.sh
  276. /usr/lib/qubes/startup-misc.sh
  277. /usr/lib/qubes/prepare-volatile-img.sh
  278. /usr/libexec/qubes/qubes-notify-tools
  279. /usr/libexec/qubes/qubes-notify-updates
  280. %{_unitdir}/qubes-block-cleaner.service
  281. %{_unitdir}/qubes-core.service
  282. %{_unitdir}/qubes-setupdvm.service
  283. %{_unitdir}/qubes-netvm.service
  284. %{_unitdir}/qubes-qmemman.service
  285. %{_unitdir}/qubes-vm@.service
  286. %{_unitdir}/qubes-reload-firewall@.service
  287. %{_unitdir}/qubes-reload-firewall@.timer
  288. %attr(2770,root,qubes) %dir /var/lib/qubes
  289. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-templates
  290. %attr(2770,root,qubes) %dir /var/lib/qubes/appvms
  291. %attr(2770,root,qubes) %dir /var/lib/qubes/servicevms
  292. %attr(2770,root,qubes) %dir /var/lib/qubes/backup
  293. %attr(2770,root,qubes) %dir /var/lib/qubes/dvmdata
  294. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-kernels
  295. /usr/share/qubes/templates/libvirt/xen.xml
  296. /usr/share/qubes/templates/libvirt/devices/pci.xml
  297. /usr/share/qubes/templates/libvirt/devices/net.xml
  298. /usr/lib/tmpfiles.d/qubes.conf
  299. /usr/lib/qubes/qubes-prepare-saved-domain.sh
  300. /usr/lib/qubes/qubes-update-dispvm-savefile-with-progress.sh
  301. /etc/xen/scripts/block.qubes
  302. /etc/xen/scripts/block-snapshot
  303. /etc/xen/scripts/block-origin
  304. /etc/xen/scripts/vif-route-qubes
  305. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.FeaturesRequest
  306. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.Filecopy
  307. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.GetImageRGBA
  308. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.GetRandomizedTime
  309. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyTools
  310. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyUpdates
  311. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.OpenInVM
  312. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.OpenURL
  313. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.VMShell
  314. /etc/qubes-rpc/qubes.FeaturesRequest
  315. /etc/qubes-rpc/qubes.GetRandomizedTime
  316. /etc/qubes-rpc/qubes.NotifyTools
  317. /etc/qubes-rpc/qubes.NotifyUpdates
  318. %attr(2770,root,qubes) %dir /var/log/qubes
  319. %attr(0770,root,qubes) %dir /var/run/qubes
  320. /etc/xdg/autostart/qubes-guid.desktop
  321. /usr/share/doc/qubes/relaxng/*.rng