-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
109 lines (93 loc) · 2.95 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
include $(TOPDIR)/rules.mk
PKG_NAME:=blue-merle
PKG_VERSION:=2.0.1
PKG_RELEASE:=$(AUTORELEASE)
PKG_MAINTAINER:=Matthias <[email protected]>
PKG_LICENSE:=BSD-3-Clause
include $(INCLUDE_DIR)/package.mk
define Package/blue-merle
SECTION:=utils
CATEGORY:=Utilities
EXTRA_DEPENDS:=luci-base, gl-sdk4-mcu, coreutils-shred, python3-pyserial
TITLE:=Anonymity Enhancements for GL-E750 Mudi
endef
define Package/blue-merle/description
The blue-merle package enhances anonymity and reduces forensic traceability of the GL-E750 Mudi 4G mobile wi-fi router
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/blue-merle/install
$(CP) ./files/* $(1)/
$(INSTALL_BIN) ./files/etc/init.d/* $(1)/etc/init.d/
$(INSTALL_BIN) ./files/etc/gl-switch.d/* $(1)/etc/gl-switch.d/
$(INSTALL_BIN) ./files/usr/bin/* $(1)/usr/bin/
$(INSTALL_BIN) ./files/usr/libexec/blue-merle $(1)/usr/libexec/blue-merle
$(INSTALL_BIN) ./files/lib/blue-merle/imei_generate.py $(1)/lib/blue-merle/imei_generate.py
endef
define Package/blue-merle/preinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] && exit 0 # if run within buildroot exit
ABORT_GLVERSION () {
echo
if [ -f "/tmp/sysinfo/model" ] && [ -f "/etc/glversion" ]; then
echo "You have a `cat /tmp/sysinfo/model`, running firmware version `cat /etc/glversion`."
fi
echo "blue-merle has only been tested with GL-E750 Mudi Versions 4.3.8. and 4.3.9"
echo "The device or firmware version you are using have not been verified to work with blue-merle."
echo -n "Would you like to continue on your own risk? (y/N): "
read answer
case $$answer in
y*) answer=0;;
y*) answer=0;;
*) answer=1;;
esac
if [[ "$$answer" -eq 0 ]]; then
exit 0
else
exit 1
fi
}
if grep -q "GL.iNet GL-E750" /proc/cpuinfo; then
GL_VERSION=$$(cat /etc/glversion)
case $$GL_VERSION in
4.3.8)
echo Version $$GL_VERSION is supported
exit 0
;;
4.3.9)
echo Version $$GL_VERSION is supported
exit 0
;;
4.*)
echo Version $$GL_VERSION is *probably* supported
ABORT_GLVERSION
;;
*)
echo Unknown version $$GL_VERSION
ABORT_GLVERSION
;;
esac
CHECK_MCUVERSION
else
ABORT_GLVERSION
fi
# Our volatile-mac service gets started during the installation
# but it modifies the client database held by the gl_clients process.
# So we stop that process now, have the database put onto volatile storage
# and start the service after installation
/etc/init.d/gl_clients stop
endef
define Package/blue-merle/postinst
#!/bin/sh
uci set switch-button.@main[0].func='sim'
uci commit switch-button
/etc/init.d/gl_clients start
echo {\"msg\": \"Successfully installed Blue Merle\"} > /dev/ttyS0
endef
define Package/blue-merle/postrm
#!/bin/sh
uci set switch-button.@main[0].func='tor'
endef
$(eval $(call BuildPackage,$(PKG_NAME)))