Makefile 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. RPMS_DIR=rpm/
  2. VERSION := $(shell cat version)
  3. DIST ?= fc18
  4. KDESERVICEDIR ?= /usr/share/kde4/services
  5. SBINDIR ?= /usr/sbin
  6. BINDIR ?= /usr/bin
  7. LIBDIR ?= /usr/lib
  8. SYSLIBDIR ?= /lib
  9. PYTHON = /usr/bin/python2
  10. PYTHON_SITEARCH = `python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)'`
  11. PYTHON2_SITELIB = `python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()'`
  12. PYTHON3_SITELIB = `python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())'`
  13. # This makefile uses some bash-isms, make uses /bin/sh by default.
  14. SHELL = /bin/bash
  15. help:
  16. @echo "make rpms -- generate binary rpm packages"
  17. @echo "make rpms-vm -- generate binary rpm packages for VM"
  18. @echo "make clean -- cleanup"
  19. @echo "make install-vm -- install VM related files"
  20. rpms: rpms-vm
  21. rpms-vm:
  22. rpmbuild --define "_rpmdir $(RPMS_DIR)" -bb rpm_spec/core-vm.spec
  23. rpmbuild --define "_rpmdir $(RPMS_DIR)" -bb rpm_spec/core-vm-doc.spec
  24. rpm --addsign \
  25. $(RPMS_DIR)/x86_64/qubes-core-vm-*$(VERSION)*.rpm \
  26. $(RPMS_DIR)/x86_64/qubes-core-vm-doc-*$(VERSION)*.rpm
  27. rpms-dom0:
  28. @true
  29. clean:
  30. make -C misc clean
  31. make -C qrexec clean
  32. make -C qubes-rpc clean
  33. all:
  34. make -C misc
  35. make -C qrexec
  36. make -C qubes-rpc
  37. # Dropin Directory
  38. DROPIN_DIR ?= "lib/systemd"
  39. SYSTEM_DROPINS := chronyd.service crond.service cups.service cups.path cups.socket ModemManager.service
  40. SYSTEM_DROPINS += NetworkManager.service NetworkManager-wait-online.service ntpd.service getty@tty.service
  41. SYSTEM_DROPINS += tinyproxy.service
  42. SYSTEM_DROPINS += tmp.mount
  43. SYSTEM_DROPINS += org.cups.cupsd.service org.cups.cupsd.path org.cups.cupsd.socket
  44. SYSTEM_DROPINS += systemd-random-seed.service
  45. SYSTEM_DROPINS += tor.service tor@default.service
  46. USER_DROPINS := pulseaudio.service pulseaudio.socket
  47. # Debian Dropins
  48. ifeq ($(shell lsb_release -is), Debian)
  49. # Don't have 'ntpd' in Debian
  50. SYSTEM_DROPINS := $(filter-out ntpd.service, $(SYSTEM_DROPINS))
  51. # 'crond.service' is named 'cron.service in Debian
  52. SYSTEM_DROPINS := $(strip $(patsubst crond.service, cron.service, $(SYSTEM_DROPINS)))
  53. # Wheezy System Dropins
  54. # Disable sysinit 'network-manager.service' since systemd 'NetworkManager.service' is already installed
  55. SYSTEM_DROPINS += $(strip $(if $(filter wheezy, $(shell lsb_release -cs)), network-manager.service,))
  56. # handled by qubes-iptables service now
  57. SYSTEM_DROPINS += netfilter-persistent.service
  58. endif
  59. install-systemd-dropins:
  60. # Install system dropins
  61. @for dropin in $(SYSTEM_DROPINS); do \
  62. install -d $(DESTDIR)/$(DROPIN_DIR)/system/$${dropin}.d ;\
  63. install -m 0644 vm-systemd/$${dropin}.d/*.conf $(DESTDIR)/$(DROPIN_DIR)/system/$${dropin}.d/ ;\
  64. done
  65. # Install user dropins
  66. @for dropin in $(USER_DROPINS); do \
  67. install -d $(DESTDIR)/$(DROPIN_DIR)/user/$${dropin}.d ;\
  68. install -m 0644 vm-systemd/user/$${dropin}.d/*.conf $(DESTDIR)/$(DROPIN_DIR)/user/$${dropin}.d/ ;\
  69. done
  70. install-systemd:
  71. install -d $(DESTDIR)$(SYSLIBDIR)/systemd/system{,-preset} $(DESTDIR)$(LIBDIR)/qubes/init $(DESTDIR)$(SYSLIBDIR)/modules-load.d
  72. install -m 0755 vm-systemd/*.sh $(DESTDIR)$(LIBDIR)/qubes/init/
  73. install -m 0644 vm-systemd/qubes-*.service $(DESTDIR)$(SYSLIBDIR)/systemd/system/
  74. install -m 0644 vm-systemd/qubes-*.timer $(DESTDIR)$(SYSLIBDIR)/systemd/system/
  75. install -m 0644 vm-systemd/75-qubes-vm.preset $(DESTDIR)$(SYSLIBDIR)/systemd/system-preset/
  76. install -m 0644 vm-systemd/qubes-core.conf $(DESTDIR)$(SYSLIBDIR)/modules-load.d/
  77. install -m 0644 vm-systemd/qubes-misc.conf $(DESTDIR)$(SYSLIBDIR)/modules-load.d/
  78. install -m 0755 network/qubes-iptables $(DESTDIR)$(LIBDIR)/qubes/init/
  79. install -D -m 0644 vm-systemd/qubes-core-agent-linux.tmpfiles \
  80. $(DESTDIR)/usr/lib/tmpfiles.d/qubes-core-agent-linux.conf
  81. install-sysvinit:
  82. install -d $(DESTDIR)/etc/init.d
  83. install vm-init.d/qubes-core $(DESTDIR)/etc/init.d/
  84. install vm-init.d/qubes-core-appvm $(DESTDIR)/etc/init.d/
  85. install vm-init.d/qubes-core-netvm $(DESTDIR)/etc/init.d/
  86. install vm-init.d/qubes-firewall $(DESTDIR)/etc/init.d/
  87. install vm-init.d/qubes-qrexec-agent $(DESTDIR)/etc/init.d/
  88. install vm-init.d/qubes-updates-proxy $(DESTDIR)/etc/init.d/
  89. install -D vm-init.d/qubes-core.modules $(DESTDIR)/etc/sysconfig/modules/qubes-core.modules
  90. install -D vm-init.d/qubes-misc.modules $(DESTDIR)/etc/sysconfig/modules/qubes-misc.modules
  91. install network/qubes-iptables $(DESTDIR)/etc/init.d/
  92. install-rh: install-systemd install-systemd-dropins install-sysvinit
  93. install -D -m 0644 misc/qubes-r3.repo $(DESTDIR)/etc/yum.repos.d/qubes-r3.repo
  94. install -d $(DESTDIR)/usr/share/glib-2.0/schemas/
  95. install -m 0644 misc/org.gnome.settings-daemon.plugins.updates.gschema.override $(DESTDIR)/usr/share/glib-2.0/schemas/
  96. install -m 0644 misc/org.gnome.nautilus.gschema.override $(DESTDIR)/usr/share/glib-2.0/schemas/
  97. install -m 0644 misc/org.mate.NotificationDaemon.gschema.override $(DESTDIR)/usr/share/glib-2.0/schemas/
  98. install -d $(DESTDIR)$(LIBDIR)/yum-plugins/
  99. install -m 0644 misc/yum-qubes-hooks.py* $(DESTDIR)$(LIBDIR)/yum-plugins/
  100. install -D -m 0644 misc/yum-qubes-hooks.conf $(DESTDIR)/etc/yum/pluginconf.d/yum-qubes-hooks.conf
  101. install -d -m 755 $(DESTDIR)/etc/pki/rpm-gpg
  102. install -m 644 misc/RPM-GPG-KEY-qubes* $(DESTDIR)/etc/pki/rpm-gpg/
  103. install -D -m 644 misc/session-stop-timeout.conf $(DESTDIR)$(LIBDIR)/systemd/system/user@.service.d/90-session-stop-timeout.conf
  104. install -d $(DESTDIR)/etc/yum.conf.d
  105. touch $(DESTDIR)/etc/yum.conf.d/qubes-proxy.conf
  106. install -D -m 0644 misc/qubes-trigger-sync-appmenus.action $(DESTDIR)/etc/yum/post-actions/qubes-trigger-sync-appmenus.action
  107. install -D -m 0644 misc/serial.conf $(DESTDIR)/usr/share/qubes/serial.conf
  108. install -D misc/qubes-serial-login $(DESTDIR)/$(SBINDIR)/qubes-serial-login
  109. install -D -m 0644 misc/dracut-qubes.conf \
  110. $(DESTDIR)/usr/lib/dracut/dracut.conf.d/30-qubes.conf
  111. install -D -m 0644 misc/dnf-qubes-hooks.py \
  112. $(DESTDIR)$(PYTHON2_SITELIB)/dnf-plugins/qubes-hooks.py
  113. install -D -m 0644 misc/dnf-qubes-hooks.py \
  114. $(DESTDIR)$(PYTHON3_SITELIB)/dnf-plugins/qubes-hooks.py
  115. install -D -m 0644 misc/dnf-qubes-hooks.conf $(DESTDIR)/etc/dnf/plugins/qubes-hooks.conf
  116. install-common:
  117. $(MAKE) -C autostart-dropins install
  118. install -m 0644 -D misc/fstab $(DESTDIR)/etc/fstab
  119. # force /usr/bin before /bin to have /usr/bin/python instead of /bin/python
  120. PATH="/usr/bin:$(PATH)" python3 setup.py install -O1 --root $(DESTDIR)
  121. mkdir -p $(DESTDIR)$(SBINDIR)
  122. mv $(DESTDIR)/usr/bin/qubes-firewall $(DESTDIR)$(SBINDIR)/qubes-firewall
  123. install -D -m 0440 misc/qubes.sudoers $(DESTDIR)/etc/sudoers.d/qubes
  124. install -D -m 0440 misc/sudoers.d_qt_x11_no_mitshm $(DESTDIR)/etc/sudoers.d/qt_x11_no_mitshm
  125. install -D -m 0644 misc/20_tcp_timestamps.conf $(DESTDIR)/etc/sysctl.d/20_tcp_timestamps.conf
  126. install -d $(DESTDIR)/var/lib/qubes
  127. install -D misc/xenstore-watch $(DESTDIR)$(BINDIR)/xenstore-watch-qubes
  128. install -d $(DESTDIR)/etc/udev/rules.d
  129. install -m 0644 misc/udev-qubes-misc.rules $(DESTDIR)/etc/udev/rules.d/50-qubes-misc.rules
  130. install -d $(DESTDIR)$(LIBDIR)/qubes/
  131. install misc/vusb-ctl.py $(DESTDIR)$(LIBDIR)/qubes/
  132. install misc/qubes-trigger-sync-appmenus.sh $(DESTDIR)$(LIBDIR)/qubes/
  133. install -D -m 0644 misc/polkit-1-qubes-allow-all.pkla $(DESTDIR)/etc/polkit-1/localauthority/50-local.d/qubes-allow-all.pkla
  134. install -D -m 0644 misc/polkit-1-qubes-allow-all.rules $(DESTDIR)/etc/polkit-1/rules.d/00-qubes-allow-all.rules
  135. install -D -m 0644 misc/mime-globs $(DESTDIR)/usr/share/qubes/mime-override/globs
  136. install misc/qubes-download-dom0-updates.sh $(DESTDIR)$(LIBDIR)/qubes/
  137. install -g user -m 2775 -d $(DESTDIR)/var/lib/qubes/dom0-updates
  138. install -D -m 0644 misc/qubes-master-key.asc $(DESTDIR)/usr/share/qubes/qubes-master-key.asc
  139. if [ -r misc/dispvm-dotfiles.$(DIST).tbz ] ; \
  140. then \
  141. install misc/dispvm-dotfiles.$(DIST).tbz $(DESTDIR)/etc/dispvm-dotfiles.tbz ; \
  142. else \
  143. install misc/dispvm-dotfiles.tbz $(DESTDIR)/etc/dispvm-dotfiles.tbz ; \
  144. fi;
  145. install misc/dispvm-prerun.sh $(DESTDIR)$(LIBDIR)/qubes/dispvm-prerun.sh
  146. install misc/close-window $(DESTDIR)$(LIBDIR)/qubes/close-window
  147. install misc/upgrades-installed-check $(DESTDIR)$(LIBDIR)/qubes/upgrades-installed-check
  148. install misc/upgrades-status-notify $(DESTDIR)$(LIBDIR)/qubes/upgrades-status-notify
  149. install -m 0644 network/udev-qubes-network.rules $(DESTDIR)/etc/udev/rules.d/99-qubes-network.rules
  150. install network/qubes-setup-dnat-to-ns $(DESTDIR)$(LIBDIR)/qubes
  151. install network/qubes-fix-nm-conf.sh $(DESTDIR)$(LIBDIR)/qubes
  152. install network/setup-ip $(DESTDIR)$(LIBDIR)/qubes/
  153. install network/network-manager-prepare-conf-dir $(DESTDIR)$(LIBDIR)/qubes/
  154. install -d $(DESTDIR)/etc/dhclient.d
  155. ln -s /usr/lib/qubes/qubes-setup-dnat-to-ns $(DESTDIR)/etc/dhclient.d/qubes-setup-dnat-to-ns.sh
  156. install -d $(DESTDIR)/etc/NetworkManager/dispatcher.d/
  157. install network/{qubes-nmhook,30-qubes-external-ip} $(DESTDIR)/etc/NetworkManager/dispatcher.d/
  158. install -D network/vif-route-qubes $(DESTDIR)/etc/xen/scripts/vif-route-qubes
  159. install -D network/vif-qubes-nat.sh $(DESTDIR)/etc/xen/scripts/vif-qubes-nat.sh
  160. install -m 0644 -D network/tinyproxy-updates.conf $(DESTDIR)/etc/tinyproxy/tinyproxy-updates.conf
  161. install -m 0644 -D network/updates-blacklist $(DESTDIR)/etc/tinyproxy/updates-blacklist
  162. install -m 0755 -D network/iptables-updates-proxy $(DESTDIR)$(LIBDIR)/qubes/iptables-updates-proxy
  163. install -d $(DESTDIR)/etc/xdg/autostart
  164. install -m 0755 network/show-hide-nm-applet.sh $(DESTDIR)$(LIBDIR)/qubes/show-hide-nm-applet.sh
  165. install -m 0644 network/show-hide-nm-applet.desktop $(DESTDIR)/etc/xdg/autostart/00-qubes-show-hide-nm-applet.desktop
  166. install -m 0400 -D network/iptables $(DESTDIR)/etc/qubes/iptables.rules
  167. install -m 0400 -D network/ip6tables $(DESTDIR)/etc/qubes/ip6tables.rules
  168. install -m 0755 network/update-proxy-configs $(DESTDIR)$(LIBDIR)/qubes/
  169. install -d $(DESTDIR)$(BINDIR)
  170. install -m 0755 misc/qubes-session-autostart $(DESTDIR)$(BINDIR)/qubes-session-autostart
  171. install -m 0755 misc/qvm-features-request $(DESTDIR)$(BINDIR)/qvm-features-request
  172. install qubes-rpc/{qvm-open-in-dvm,qvm-open-in-vm,qvm-copy-to-vm,qvm-move-to-vm,qvm-run,qvm-mru-entry} $(DESTDIR)$(BINDIR)
  173. install qubes-rpc/qvm-copy-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
  174. install qubes-rpc/qvm-copy-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
  175. install qubes-rpc/qvm-move-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
  176. install qubes-rpc/qvm-move-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
  177. install qubes-rpc/xdg-icon $(DESTDIR)$(LIBDIR)/qubes
  178. install qubes-rpc/{vm-file-editor,qfile-agent,qopen-in-vm} $(DESTDIR)$(LIBDIR)/qubes
  179. install qubes-rpc/qubes-open $(DESTDIR)$(BINDIR)
  180. install qubes-rpc/tar2qfile $(DESTDIR)$(LIBDIR)/qubes
  181. # Install qfile-unpacker as SUID - because it will fail to receive files from other vm
  182. install -m 4755 qubes-rpc/qfile-unpacker $(DESTDIR)$(LIBDIR)/qubes
  183. install qubes-rpc/qrun-in-vm $(DESTDIR)$(LIBDIR)/qubes
  184. install qubes-rpc/sync-ntp-clock $(DESTDIR)$(LIBDIR)/qubes
  185. install qubes-rpc/prepare-suspend $(DESTDIR)$(LIBDIR)/qubes
  186. install -m 0644 misc/qubes-suspend-module-blacklist $(DESTDIR)/etc/qubes-suspend-module-blacklist
  187. install -d $(DESTDIR)/$(KDESERVICEDIR)
  188. install -m 0644 qubes-rpc/{qvm-copy.desktop,qvm-move.desktop,qvm-dvm.desktop} $(DESTDIR)/$(KDESERVICEDIR)
  189. install -d $(DESTDIR)/etc/qubes-rpc
  190. install -m 0644 qubes-rpc/{qubes.Filecopy,qubes.OpenInVM,qubes.VMShell,qubes.SyncNtpClock} $(DESTDIR)/etc/qubes-rpc
  191. install -m 0755 qubes-rpc/qubes.OpenURL $(DESTDIR)/etc/qubes-rpc
  192. install -m 0644 qubes-rpc/{qubes.SuspendPre,qubes.SuspendPost,qubes.GetAppmenus} $(DESTDIR)/etc/qubes-rpc
  193. install -m 0755 qubes-rpc/qubes.SuspendPreAll $(DESTDIR)/etc/qubes-rpc
  194. install -m 0755 qubes-rpc/qubes.SuspendPostAll $(DESTDIR)/etc/qubes-rpc
  195. install -m 0644 qubes-rpc/qubes.WaitForSession $(DESTDIR)/etc/qubes-rpc
  196. install -m 0644 qubes-rpc/qubes.DetachPciDevice $(DESTDIR)/etc/qubes-rpc
  197. install -m 0644 qubes-rpc/qubes.{Backup,Restore} $(DESTDIR)/etc/qubes-rpc
  198. install -m 0644 qubes-rpc/qubes.Select{File,Directory} $(DESTDIR)/etc/qubes-rpc
  199. install -m 0644 qubes-rpc/qubes.GetImageRGBA $(DESTDIR)/etc/qubes-rpc
  200. install -m 0644 qubes-rpc/qubes.SetDateTime $(DESTDIR)/etc/qubes-rpc
  201. install -m 0755 qubes-rpc/qubes.InstallUpdatesGUI $(DESTDIR)/etc/qubes-rpc
  202. install -m 0755 qubes-rpc/qubes.ResizeDisk $(DESTDIR)/etc/qubes-rpc
  203. install -m 0755 qubes-rpc/qubes.StartApp $(DESTDIR)/etc/qubes-rpc
  204. install -d $(DESTDIR)/etc/qubes/suspend-pre.d
  205. install -m 0644 qubes-rpc/suspend-pre.README $(DESTDIR)/etc/qubes/suspend-pre.d/README
  206. install -d $(DESTDIR)/etc/qubes/suspend-post.d
  207. install -m 0644 qubes-rpc/suspend-post.README $(DESTDIR)/etc/qubes/suspend-post.d/README
  208. install -d $(DESTDIR)/usr/share/nautilus-python/extensions
  209. install -m 0644 qubes-rpc/*_nautilus.py $(DESTDIR)/usr/share/nautilus-python/extensions
  210. install -D -m 0755 misc/qubes-desktop-run $(DESTDIR)$(BINDIR)/qubes-desktop-run
  211. mkdir -p $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
  212. ifeq ($(shell lsb_release -is), Debian)
  213. install -m 0644 misc/qubesxdg.py $(DESTDIR)/$(PYTHON2_SITELIB)/
  214. else
  215. install -m 0644 misc/py2/qubesxdg.py* $(DESTDIR)/$(PYTHON2_SITELIB)/
  216. endif
  217. install -d $(DESTDIR)/mnt/removable
  218. install -D -m 0644 misc/xorg-preload-apps.conf $(DESTDIR)/etc/X11/xorg-preload-apps.conf
  219. install -d $(DESTDIR)/var/run/qubes
  220. install -d $(DESTDIR)/home_volatile/user
  221. install -d $(DESTDIR)/rw
  222. install-deb: install-common install-systemd install-systemd-dropins
  223. mkdir -p $(DESTDIR)/etc/apt/sources.list.d
  224. sed -e "s/@DIST@/`lsb_release -cs`/" misc/qubes-r3.list.in > $(DESTDIR)/etc/apt/sources.list.d/qubes-r3.list
  225. install -D -m 644 misc/qubes-archive-keyring.gpg $(DESTDIR)/etc/apt/trusted.gpg.d/qubes-archive-keyring.gpg
  226. install -D -m 644 network/00notify-hook $(DESTDIR)/etc/apt/apt.conf.d/00notify-hook
  227. install -d $(DESTDIR)/etc/sysctl.d
  228. install -m 644 network/80-qubes.conf $(DESTDIR)/etc/sysctl.d/
  229. install -D -m 644 misc/profile.d_qt_x11_no_mitshm.sh $(DESTDIR)/etc/profile.d/qt_x11_no_mitshm.sh
  230. install -D -m 440 misc/sudoers.d_umask $(DESTDIR)/etc/sudoers.d/umask
  231. install -d $(DESTDIR)/etc/pam.d
  232. install -m 0644 misc/pam.d_su.qubes $(DESTDIR)/etc/pam.d/su.qubes
  233. install -d $(DESTDIR)/etc/needrestart/conf.d
  234. install -D -m 0644 misc/50_qubes.conf $(DESTDIR)/etc/needrestart/conf.d/50_qubes.conf
  235. install-vm: install-rh install-common