You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.0 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=wg-installer
  3. PKG_RELEASE:=$(AUTORELEASE)
  4. PKG_MAINTAINER:=Nick Hainke <vincent@systemli.org>
  5. include $(INCLUDE_DIR)/package.mk
  6. Build/Compile=
  7. define Package/wg-installer/Default
  8. SECTION:=net
  9. CATEGORY:=Network
  10. TITLE:=WireGuard Installer
  11. URL:=https://github.com/Freifunk-Spalter/
  12. PKGARCH:=all
  13. DEPENDS:=+kmod-wireguard +wireguard-tools +owipcalc
  14. endef
  15. define Package/wg-installer-server
  16. $(call Package/wg-installer/Default)
  17. TITLE+= (server)
  18. MENU:=1
  19. DEPENDS+=+rpcd +uhttpd +uhttpd-mod-ubus +coreutils-dirname
  20. endef
  21. define Package/wg-installer-server/install
  22. $(INSTALL_DIR) $(1)/usr/share/wginstaller/
  23. $(INSTALL_BIN) ./wg-server/lib/install_wginstaller_user.sh $(1)/usr/share/wginstaller/install_wginstaller_user.sh
  24. $(INSTALL_BIN) ./wg-server/lib/wg_functions.sh $(1)/usr/share/wginstaller/wg_functions.sh
  25. $(INSTALL_BIN) ./common/wg.sh $(1)/usr/share/wginstaller/wg.sh
  26. $(INSTALL_DIR) $(1)/usr/libexec/rpcd/
  27. $(INSTALL_BIN) ./wg-server/wginstaller.sh $(1)/usr/libexec/rpcd/wginstaller
  28. $(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
  29. $(CP) ./wg-server/config/wginstaller.json $(1)/usr/share/rpcd/acl.d/
  30. $(INSTALL_DIR) $(1)/etc/config
  31. $(INSTALL_CONF) ./wg-server/config/wgserver.conf $(1)/etc/config/wgserver
  32. $(INSTALL_DIR) $(1)/etc/init.d
  33. $(INSTALL_BIN) ./wg-server/config/wgserver.init $(1)/etc/init.d/wgserver
  34. endef
  35. define Package/wg-installer-server/conffiles
  36. /etc/config/wgserver
  37. endef
  38. define Package/wg-installer-server/postinst
  39. #!/bin/sh
  40. if [ -z $${IPKG_INSTROOT} ] ; then
  41. . /usr/share/wginstaller/install_wginstaller_user.sh
  42. fi
  43. endef
  44. define Package/wg-installer-server-hotplug-babeld
  45. $(call Package/wg-installer-server)
  46. DEPENDS:=wg-installer-server
  47. endef
  48. define Package/wg-installer-server-hotplug-babeld/install
  49. $(INSTALL_DIR) $(1)/etc/hotplug.d/net/
  50. $(INSTALL_BIN) ./wg-server/hotplug.d/99-mesh-babeld $(1)/etc/hotplug.d/net/99-mesh-babeld
  51. endef
  52. define Package/wg-installer-server-hotplug-olsrd
  53. $(call Package/wg-installer-server)
  54. DEPENDS:=wg-installer-server
  55. endef
  56. define Package/wg-installer-server-hotplug-olsrd/install
  57. $(INSTALL_DIR) $(1)/etc/hotplug.d/net/
  58. $(INSTALL_BIN) ./wg-server/hotplug.d/99-mesh-olsrd $(1)/etc/hotplug.d/net/99-mesh-olsrd
  59. endef
  60. define Package/wg-installer-client
  61. $(call Package/wg-installer/Default)
  62. TITLE+= (client)
  63. DEPENDS+=+curl
  64. endef
  65. define Package/wg-installer-client/install
  66. $(INSTALL_DIR) $(1)/usr/share/wginstaller/
  67. $(INSTALL_BIN) ./wg-client/lib/rpcd_ubus.sh $(1)/usr/share/wginstaller/rpcd_ubus.sh
  68. $(INSTALL_BIN) ./common/wg.sh $(1)/usr/share/wginstaller/wg.sh
  69. $(INSTALL_DIR) $(1)/usr/bin
  70. $(INSTALL_BIN) ./wg-client/wg-client-installer.sh $(1)/usr/bin/wg-client-installer
  71. $(INSTALL_DIR) $(1)/etc/config
  72. $(INSTALL_CONF) ./wg-client/config/wgclient.conf $(1)/etc/config/wgclient
  73. endef
  74. define Package/wg-installer-client/conffiles
  75. /etc/config/wgclient
  76. endef
  77. $(eval $(call BuildPackage,wg-installer-server))
  78. $(eval $(call BuildPackage,wg-installer-server-hotplug-babeld))
  79. $(eval $(call BuildPackage,wg-installer-server-hotplug-olsrd))
  80. $(eval $(call BuildPackage,wg-installer-client))