-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (100 loc) · 3.7 KB
/
Makefile
File metadata and controls
120 lines (100 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#
# Copyright (C) 2019 OpenWrt-DNSCrypt-Proxy
# Copyright (C) 2019 peter-tank
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-dnscrypt-proxy2
PKG_VERSION:=2.1.3
PKG_RELEASE:=1
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=peter-tank
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_minisign
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/config
config PACKAGE_$(PKG_NAME)_INCLUDE_minisign
bool "Include minisign for customized offline resolvers list self-sign."
default n
endef
define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=DNSCrypt Proxy LuCI interface
URL:=https://github.com/peter-tank/luci-app-dnscrypt-proxy2
PKGARCH:=all
DEPENDS:=+PACKAGE_$(PKG_NAME)_INCLUDE_minisign:minisign
endef
define Package/$(PKG_NAME)/description
LuCI Support for dnscrypt-proxy2.
endef
define Build/Prepare
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/dnscrypt-proxy
/etc/config/public-resolvers
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./files/luci/controller/dnscrypt-proxy.lua $(1)/usr/lib/lua/luci/controller/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) $(PKG_BUILD_DIR)/dnscrypt-proxy.*.lmo $(1)/usr/lib/lua/luci/i18n/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/tools
$(INSTALL_DATA) ./files/luci/tools/*.lua $(1)/usr/lib/lua/luci/tools/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/dnscrypt-proxy
$(INSTALL_DATA) ./files/luci/model/cbi/dnscrypt-proxy/*.lua $(1)/usr/lib/lua/luci/model/cbi/dnscrypt-proxy/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/dnscrypt-proxy
$(INSTALL_DATA) ./files/luci/view/dnscrypt-proxy/*.htm $(1)/usr/lib/lua/luci/view/dnscrypt-proxy/
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/root/etc/uci-defaults/dnscrypt-proxy $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/dnscrypt-proxy_resolvers.init $(1)/etc/init.d/dnscrypt-proxy_resolvers
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/dnscrypt-proxy.config $(1)/etc/config/dnscrypt-proxy
$(INSTALL_DATA) ./files/public-resolvers.config $(1)/etc/config/public-resolvers
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/dnscrypt-proxy.init $(1)/etc/init.d/dnscrypt-proxy
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./files/luci-app-dnscrypt-proxy2.json $(1)/usr/share/rpcd/acl.d/
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/dnscrypt-proxy ) && rm -f /etc/uci-defaults/dnscrypt-proxy
chmod 755 /etc/init.d/dnscrypt-proxy >/dev/null 2>&1
#/etc/init.d/dnscrypt-proxy enable >/dev/null 2>&1
uci -q batch <<-EOF >/dev/null
delete firewall.dnscrypt-proxy
set firewall.dnscrypt-proxy=include
set firewall.dnscrypt-proxy.type=script
set firewall.dnscrypt-proxy.path=/var/etc/dnscrypt-proxy.include
set firewall.dnscrypt-proxy.reload=0
commit firewall
EOF
fi
exit 0
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for dnscrypt-proxy"
/etc/init.d/dnscrypt-proxy disable
/etc/init.d/dnscrypt-proxy stop
echo "Removing firewall rule for dnscrypt-proxy"
uci -q batch <<-EOF >/dev/null
delete firewall.dnscrypt-proxy
commit firewall
EOF
fi
exit 0
endef
$(eval $(call BuildPackage,$(PKG_NAME)))