Makefile 14 KB

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