forked from xcode75/luci-app-xclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
123 lines (92 loc) · 3.43 KB
/
Makefile
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
121
122
123
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-xclient
PKG_VERSION:=v1.0.1
PKG_MAINTAINER:=xcode75
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=2. XClient
TITLE:=LuCI Support for Xray
PKGARCH:=all
MAINTAINER:=xcode75
DEPENDS:=+coreutils +coreutils-base64 +pdnsd-alt +coreutils-nohup +curl +dnsmasq-full +luci-compat +dns2socks +ipset +ip-full +iptables-mod-tproxy +libuci-lua +lua +luci-lib-jsonc +microsocks +tcping +resolveip +shadowsocks-libev-ss-local +shadowsocks-libev-ss-redir +unzip +uclient-fetch +wget-ssl +libmbedtls
endef
define Package/$(PKG_NAME)/config
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/xclient
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for xclient"
/etc/init.d/xclient disable
/etc/init.d/xclient stop
echo "Removing firewall rule for xclient"
uci -q batch <<-EOF >/dev/null
delete firewall.xclient
commit firewall
chmod -R 777 /usr/share/xclient 2>/dev/null
EOF
fi
exit 0
endef
define Package/$(PKG_NAME)/preinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
rm -rf /tmp/dnsmasq.xclient 2>/dev/null
mv /etc/config/xclient /etc/config/xclient.bak 2>/dev/null
rm -rf /usr/lib/lua/luci/model/cbi/xclient 2>/dev/null
rm -rf /usr/lib/lua/luci/view/xclient 2>/dev/null
chmod -R 777 /usr/share/xclient 2>/dev/null
fi
exit 0
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
rm -rf /tmp/luci*
mv /etc/config/xclient.bak /etc/config/xclient 2>/dev/null
/etc/init.d/xclient disable 2>/dev/null
chmod +x /etc/init.d/xclient 2>/dev/null
/etc/init.d/xclient disable 2>/dev/null
/etc/init.d/xclient stop 2>/dev/null
chmod -R 777 /usr/share/xclient 2>/dev/null
fi
exit 0
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/xclient
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/xclient
$(INSTALL_DATA) ./luasrc/controller/* $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./luasrc/model/cbi/xclient/* $(1)/usr/lib/lua/luci/model/cbi/xclient
$(INSTALL_DATA) ./luasrc/view/xclient/* $(1)/usr/lib/lua/luci/view/xclient
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./root/etc/init.d/* $(1)/etc/init.d
$(INSTALL_CONF) ./root/etc/config/* $(1)/etc/config
$(INSTALL_CONF) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/share/xclient
$(INSTALL_DATA) ./root/usr/bin/* $(1)/usr/bin
$(INSTALL_DATA) ./root/usr/share/xclient/* $(1)/usr/share/xclient
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/luci-app-xclient.json $(1)/usr/share/rpcd/acl.d/luci-app-xclient.json
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/luci-app-xclient.json $(1)/usr/share/luci/menu.d/luci-app-xclient.json
$(INSTALL_DIR) $(1)/www
$(INSTALL_DIR) $(1)/www/luci-static
$(INSTALL_DIR) $(1)/www/luci-static/xclient
$(INSTALL_DIR) $(1)/www/luci-static/xclient/img
cp -pR ./root/www/luci-static/xclient/img/*.png $(1)/www/luci-static/xclient/img
cp -pR ./root/www/luci-static/xclient/img/*.svg $(1)/www/luci-static/xclient/img
endef
$(eval $(call BuildPackage,$(PKG_NAME)))