Makefile 11 KB

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