core-dom0.spec 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
  26. %{!?version: %define version %(cat version)}
  27. %define _dracutmoddir /usr/lib/dracut/modules.d
  28. %if %{fedora} < 17
  29. %define _dracutmoddir /usr/share/dracut/modules.d
  30. %endif
  31. Name: qubes-core-dom0
  32. Version: %{version}
  33. Release: 1%{dist}
  34. Summary: The Qubes core files (Dom0-side)
  35. Group: Qubes
  36. Vendor: Invisible Things Lab
  37. License: GPL
  38. URL: http://www.qubes-os.org
  39. BuildRequires: ImageMagick
  40. BuildRequires: systemd-units
  41. Requires(post): systemd-units
  42. Requires(preun): systemd-units
  43. Requires(postun): systemd-units
  44. Requires: python, pciutils, python-inotify, python-daemon
  45. Requires: qubes-core-dom0-linux >= 2.0.24
  46. Requires: qubes-db-dom0
  47. Requires: python-lxml
  48. Requires: python-psutil
  49. # TODO: R: qubes-gui-dom0 >= 2.1.11
  50. Conflicts: qubes-gui-dom0 < 1.1.13
  51. Requires: libvirt-python
  52. %if x%{?backend_vmm} == xxen
  53. Requires: xen-runtime
  54. Requires: xen-hvm
  55. Requires: libvirt-daemon-xen >= 1.2.12-3
  56. %endif
  57. Requires: createrepo
  58. Requires: gnome-packagekit
  59. Requires: cronie
  60. Requires: bsdtar
  61. # for qubes-hcl-report
  62. Requires: dmidecode
  63. Requires: PyQt4
  64. # Prevent preupgrade from installation (it pretend to provide distribution upgrade)
  65. Obsoletes: preupgrade < 2.0
  66. Provides: preupgrade = 2.0
  67. %define _builddir %(pwd)
  68. %description
  69. The Qubes core files for installation on Dom0.
  70. %prep
  71. # we operate on the current directory, so no need to unpack anything
  72. # symlink is to generate useful debuginfo packages
  73. rm -f %{name}-%{version}
  74. ln -sf . %{name}-%{version}
  75. %setup -T -D
  76. %build
  77. make all
  78. %install
  79. make install \
  80. DESTDIR=$RPM_BUILD_ROOT \
  81. UNITDIR=%{_unitdir} \
  82. PYTHON_SITEPATH=%{python_sitearch} \
  83. SYSCONFDIR=%{_sysconfdir}
  84. %post
  85. # Create NetworkManager configuration if we do not have it
  86. if ! [ -e /etc/NetworkManager/NetworkManager.conf ]; then
  87. echo '[main]' > /etc/NetworkManager/NetworkManager.conf
  88. echo 'plugins = keyfile' >> /etc/NetworkManager/NetworkManager.conf
  89. echo '[keyfile]' >> /etc/NetworkManager/NetworkManager.conf
  90. fi
  91. sed '/^autoballoon=/d;/^lockfile=/d' -i /etc/xen/xl.conf
  92. echo 'autoballoon=0' >> /etc/xen/xl.conf
  93. echo 'lockfile="/var/run/qubes/xl-lock"' >> /etc/xen/xl.conf
  94. sed 's/^PRELINKING\s*=.*/PRELINKING=no/' -i /etc/sysconfig/prelink
  95. systemctl --no-reload enable qubes-core.service >/dev/null 2>&1
  96. systemctl --no-reload enable qubes-netvm.service >/dev/null 2>&1
  97. systemctl --no-reload enable qubes-setupdvm.service >/dev/null 2>&1
  98. # Conflicts with libxl stack, so disable it
  99. systemctl --no-reload disable xend.service >/dev/null 2>&1
  100. systemctl --no-reload disable xendomains.service >/dev/null 2>&1
  101. systemctl daemon-reload >/dev/null 2>&1 || :
  102. HAD_SYSCONFIG_NETWORK=yes
  103. if ! [ -e /etc/sysconfig/network ]; then
  104. HAD_SYSCONFIG_NETWORK=no
  105. # supplant empty one so NetworkManager init script does not complain
  106. touch /etc/sysconfig/network
  107. fi
  108. # Load evtchn module - xenstored needs it
  109. modprobe evtchn 2> /dev/null || modprobe xen-evtchn
  110. service xenstored start
  111. if ! [ -e /var/lib/qubes/qubes.xml ]; then
  112. # echo "Initializing Qubes DB..."
  113. umask 007; sg qubes -c qvm-init-storage
  114. qubes-prefs -s default-kernel `ls /var/lib/qubes/vm-kernels|head -n 1` 2> /dev/null
  115. fi
  116. # Because we now have an installer
  117. # this script is always executed during upgrade
  118. # and we decided not to restart core during upgrade
  119. #service qubes_core start
  120. if [ "x"$HAD_SYSCONFIG_NETWORK = "xno" ]; then
  121. rm -f /etc/sysconfig/network
  122. fi
  123. %clean
  124. rm -rf $RPM_BUILD_ROOT
  125. rm -f %{name}-%{version}
  126. %pre
  127. if ! grep -q ^qubes: /etc/group ; then
  128. groupadd qubes
  129. fi
  130. %triggerin -- xen-runtime
  131. sed -i 's/\/block /\/block.qubes /' /etc/udev/rules.d/xen-backend.rules
  132. /usr/lib/qubes/fix-dir-perms.sh
  133. %preun
  134. if [ "$1" = 0 ] ; then
  135. # no more packages left
  136. service qubes_netvm stop
  137. service qubes_core stop
  138. fi
  139. %postun
  140. if [ "$1" = 0 ] ; then
  141. # no more packages left
  142. chgrp root /etc/xen
  143. chmod 700 /etc/xen
  144. groupdel qubes
  145. sed -i 's/\/block.qubes /\/block /' /etc/udev/rules.d/xen-backend.rules
  146. fi
  147. %files
  148. %defattr(-,root,root,-)
  149. %config(noreplace) %attr(0664,root,qubes) %{_sysconfdir}/qubes/qmemman.conf
  150. /usr/bin/qvm-*
  151. /usr/bin/qubes-*
  152. %dir %{python_sitearch}/qubes
  153. %{python_sitearch}/qubes/qubes.py
  154. %{python_sitearch}/qubes/qubes.pyc
  155. %{python_sitearch}/qubes/qubes.pyo
  156. %{python_sitearch}/qubes/qubesutils.py
  157. %{python_sitearch}/qubes/qubesutils.pyc
  158. %{python_sitearch}/qubes/qubesutils.pyo
  159. %{python_sitearch}/qubes/guihelpers.py
  160. %{python_sitearch}/qubes/guihelpers.pyc
  161. %{python_sitearch}/qubes/guihelpers.pyo
  162. %{python_sitearch}/qubes/notify.py
  163. %{python_sitearch}/qubes/notify.pyc
  164. %{python_sitearch}/qubes/notify.pyo
  165. %{python_sitearch}/qubes/backup.py
  166. %{python_sitearch}/qubes/backup.pyc
  167. %{python_sitearch}/qubes/backup.pyo
  168. %{python_sitearch}/qubes/storage/*.py
  169. %{python_sitearch}/qubes/storage/*.pyc
  170. %{python_sitearch}/qubes/storage/*.pyo
  171. %{python_sitearch}/qubes/settings.py
  172. %{python_sitearch}/qubes/settings.pyc
  173. %{python_sitearch}/qubes/settings.pyo
  174. %{python_sitearch}/qubes/qmemman*.py*
  175. %{python_sitearch}/qubes/modules/0*.py*
  176. %{python_sitearch}/qubes/modules/__init__.py*
  177. %{python_sitearch}/qubes/tests
  178. /usr/lib/qubes/unbind-pci-device.sh
  179. /usr/lib/qubes/cleanup-dispvms
  180. /usr/lib/qubes/qmemman_daemon.py*
  181. /usr/lib/qubes/qfile-daemon-dvm*
  182. /usr/lib/qubes/block-cleaner-daemon.py*
  183. /usr/lib/qubes/vusb-ctl.py*
  184. /usr/lib/qubes/xl-qvm-usb-attach.py*
  185. /usr/lib/qubes/xl-qvm-usb-detach.py*
  186. /usr/lib/qubes/fix-dir-perms.sh
  187. /usr/lib/qubes/startup-dvm.sh
  188. /usr/lib/qubes/startup-misc.sh
  189. /usr/lib/qubes/prepare-volatile-img.sh
  190. /usr/libexec/qubes/qubes-notify-tools
  191. /usr/libexec/qubes/qubes-notify-updates
  192. %{_unitdir}/qubes-block-cleaner.service
  193. %{_unitdir}/qubes-core.service
  194. %{_unitdir}/qubes-setupdvm.service
  195. %{_unitdir}/qubes-netvm.service
  196. %{_unitdir}/qubes-qmemman.service
  197. %{_unitdir}/qubes-vm@.service
  198. %{_unitdir}/qubes-reload-firewall@.service
  199. %{_unitdir}/qubes-reload-firewall@.timer
  200. %attr(2770,root,qubes) %dir /var/lib/qubes
  201. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-templates
  202. %attr(2770,root,qubes) %dir /var/lib/qubes/appvms
  203. %attr(2770,root,qubes) %dir /var/lib/qubes/servicevms
  204. %attr(2770,root,qubes) %dir /var/lib/qubes/backup
  205. %attr(2770,root,qubes) %dir /var/lib/qubes/dvmdata
  206. %attr(2770,root,qubes) %dir /var/lib/qubes/vm-kernels
  207. /usr/share/qubes/vm-template.xml
  208. /usr/share/qubes/vm-template-hvm.xml
  209. /usr/lib/tmpfiles.d/qubes.conf
  210. /usr/lib/qubes/qubes-prepare-saved-domain.sh
  211. /usr/lib/qubes/qubes-update-dispvm-savefile-with-progress.sh
  212. /etc/xen/scripts/block.qubes
  213. /etc/xen/scripts/block-snapshot
  214. /etc/xen/scripts/block-origin
  215. /etc/xen/scripts/vif-route-qubes
  216. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.Filecopy
  217. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.GetImageRGBA
  218. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.OpenInVM
  219. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyTools
  220. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.NotifyUpdates
  221. %attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.VMShell
  222. /etc/qubes-rpc/qubes.NotifyTools
  223. /etc/qubes-rpc/qubes.NotifyUpdates
  224. %attr(2770,root,qubes) %dir /var/log/qubes
  225. %attr(0770,root,qubes) %dir /var/run/qubes
  226. /etc/xdg/autostart/qubes-guid.desktop