9 rm -rf
$(INSTALLDIR
)/www
10 mkdir
-p
$(INSTALLDIR
)/www
12 cp
*.gif
*.png
*.ico
*.html robots.txt
$(INSTALLDIR
)/www
14 # squish some of the files by trimming whitespace...
16 for F in
$(wildcard *.js
*.jsx
); do \
17 sed
'/^\/\*\s*$$/,/\*\//! { s/^\s\+//; s/\s\+$$//; /^\/\/ --\+\s*/d; /^$$/d }' < $$F > $(INSTALLDIR
)/www
/$$F; \
20 for F in
$(wildcard *.css
); do \
21 sed
'/^\/\*\s*$$/,/\*\//! { s/\s\+/ /g; s/^\s\+//; s/\s\+$$//; /^$$/d }' < $$F > $(INSTALLDIR
)/www
/$$F; \
24 # remove "debug.js" references, convert color.css, remove comments
25 # in between REMOVE-BEGIN and REMOVE-END, and compress whitespace
27 for F in
$(wildcard *.asp
*.svg
); do \
28 sed
-e
"/REMOVE-BEGIN/,/REMOVE-END/d" \
29 -e
"s,<script[^>]\+debug\.js[^>]\+></script>,," \
30 -e
"s,<link[^>]\+href='color\.css'>,<% css(); %>," \
31 -e
"s,color\.css,<% nv('web_css'); %>\.css," \
32 -e
"s,<!-- / / / -->,," \
36 -e
"/^<!--$$/,/^-->$$/! { s,^\s\+, , }" $$F > $(INSTALLDIR
)/www
/$$F; \
39 # Only include Linux 2.6 options if building for Linux 2.6.
40 ifneq ($(CONFIG_LINUX26
),y
)
41 cd
$(INSTALLDIR
)/www
&& \
42 for F in
$(wildcard *.asp
*.js
); do \
43 sed
-i
$$F -e
"/LINUX26-BEGIN/,/LINUX26-END/d"; \
45 # But remove some K24 options if building for Linux 2.6.
47 cd
$(INSTALLDIR
)/www
&& \
48 for F in
$(wildcard *.asp
*.js
); do \
49 sed
-i
$$F -e
"/LINUX24-BEGIN/,/LINUX24-END/d"; \
53 # Only include the CIFS pages if CIFS is configured in.
54 ifneq ($(TCONFIG_CIFS
),y
)
55 rm -f
$(INSTALLDIR
)/www
/admin-cifs.asp
56 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/CIFS-BEGIN/,/CIFS-END/d"
57 sed
-i
$(INSTALLDIR
)/www
/admin-bwm.asp
-e
"/CIFS-BEGIN/,/CIFS-END/d"
58 sed
-i
$(INSTALLDIR
)/www
/nas-media.asp
-e
"/CIFS-BEGIN/,/CIFS-END/d"
61 # Only include the JFFS pages if JFFS is configured in.
62 ifneq ($(TCONFIG_JFFS2
),y
)
63 rm -f
$(INSTALLDIR
)/www
/admin-jffs2.asp
64 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/JFFS2-BEGIN/,/JFFS2-END/d"
65 sed
-i
$(INSTALLDIR
)/www
/admin-bwm.asp
-e
"/JFFS2-BEGIN/,/JFFS2-END/d"
66 sed
-i
$(INSTALLDIR
)/www
/admin-upgrade.asp
-e
"/JFFS2-BEGIN/,/JFFS2-END/d"
67 sed
-i
$(INSTALLDIR
)/www
/nas-media.asp
-e
"/JFFS2-BEGIN/,/JFFS2-END/d"
70 # Only include the Zebra options if Zebra is configured in.
71 ifneq ($(TCONFIG_ZEBRA
),y
)
72 sed
-i
$(INSTALLDIR
)/www
/advanced-routing.asp
-e
"/ZEBRA-BEGIN/,/ZEBRA-END/d"
75 # Only include EMF options if EMF is configured in.
76 ifneq ($(TCONFIG_EMF
),y
)
77 sed
-i
$(INSTALLDIR
)/www
/advanced-routing.asp
-e
"/EMF-BEGIN/,/EMF-END/d"
80 # Only include if USB configured in.
81 ifneq ($(TCONFIG_USB_EXTRAS
),y
)
82 sed
-i
$(INSTALLDIR
)/www
/nas-usb.asp
-e
"/EXTRAS-BEGIN/,/EXTRAS-END/d"
85 # Only include NTFS settings if NTFS support is configured in.
86 ifneq ($(TCONFIG_NTFS
),y
)
87 sed
-i
$(INSTALLDIR
)/www
/nas-usb.asp
-e
"/NTFS-BEGIN/,/NTFS-END/d"
89 # Only include the FTP pages if FTP Server is configured in.
90 ifneq ($(TCONFIG_FTP
),y
)
91 rm -f
$(INSTALLDIR
)/www
/nas-ftp.asp
92 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/FTP-BEGIN/,/FTP-END/d"
94 # Only include the Samba pages if Samba is configured in.
95 ifneq ($(TCONFIG_SAMBASRV
),y
)
96 rm -f
$(INSTALLDIR
)/www
/nas-samba.asp
97 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/SAMBA-BEGIN/,/SAMBA-END/d"
99 # Only include the Media Server pages if Media Server is configured in.
100 ifneq ($(TCONFIG_MEDIA_SERVER
),y
)
101 rm -f
$(INSTALLDIR
)/www
/nas-media.asp
102 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/MEDIA-SRV-BEGIN/,/MEDIA-SRV-END/d"
105 # Victek for RAF verion
106 # Only include Captive Portal menu option and pages when configured.
107 ifneq ($(TCONFIG_NOCAT
),y
)
108 rm -f
$(INSTALLDIR
)/www
/splashd.asp
109 rm -f
$(INSTALLDIR
)/www
/splash.html
110 rm -f
$(INSTALLDIR
)/www
/style.css
111 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/NOCAT-BEGIN/,/NOCAT-END/d"
112 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/NOCAT-BEGIN/,/NOCAT-END/d"
115 # Only include NGinX menu option and pages when configured
116 ifneq ($(TCONFIG_NGINX
),y
)
117 rm -f
$(INSTALLDIR
)/www
/nginx.asp
118 rm -f
$(INSTALLDIR
)/www
/index.html
119 rm -f
$(INSTALLDIR
)/www
/index.php
120 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/NGINX-BEGIN/,/NGINX-END/d"
121 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/NGINX-BEGIN/,/NGINX-END/d"
124 # Only include IPv6 options if IPv6 is configured in.
125 ifneq ($(TCONFIG_IPV6
),y
)
126 cd
$(INSTALLDIR
)/www
&& \
127 for F in
$(wildcard *.asp
*.js
*.jsx
); do \
128 [ -f
$(INSTALLDIR
)/www
/$$F ] && sed
-i
$$F \
129 -e
"/IPV6-BEGIN/,/IPV6-END/d" \
132 rm -f
$(INSTALLDIR
)/www
/basic-ipv6.asp
133 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/IPV6-BEGIN/,/IPV6-END/d"
134 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/IPV6-BEGIN/,/IPV6-END/d"
135 sed
-i
$(INSTALLDIR
)/www
/admin-debug.asp
-e
"/IPV6-BEGIN/,/IPV6-END/d"
136 sed
-i
$(INSTALLDIR
)/www
/advanced-dhcpdns.asp
-e
"/IPV6-BEGIN/,/IPV6-END/d"
139 # Only include the USB and NAS pages if USB Support is configured in.
140 ifneq ($(TCONFIG_USB
),y
)
141 rm -f
$(INSTALLDIR
)/www
/nas-
*.
*
142 sed
-i
$(INSTALLDIR
)/www
/basic-network.asp
-e
"/USB-BEGIN/,/USB-END/d"
143 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/USB-BEGIN/,/USB-END/d"
144 sed
-i
$(INSTALLDIR
)/www
/admin-buttons.asp
-e
"/USB-BEGIN/,/USB-END/d"
145 sed
-i
$(INSTALLDIR
)/www
/admin-access.asp
-e
"/USB-BEGIN/,/USB-END/d"
146 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/USB-BEGIN/,/USB-END/d"
149 # Only include the USB and NAS pages if REMOVE_USBAPP is NOT configured in.
150 ifeq ($(TCONFIG_REMOVE_USBAPP
),y
)
151 rm -f
$(INSTALLDIR
)/www
/nas-
*.
*
152 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/USB-BEGIN/,/USB-END/d"
153 sed
-i
$(INSTALLDIR
)/www
/admin-buttons.asp
-e
"/USB-BEGIN/,/USB-END/d"
154 sed
-i
$(INSTALLDIR
)/www
/admin-access.asp
-e
"/USB-BEGIN/,/USB-END/d"
157 # Only include CTF option if CTF module exists
158 ## test -d $(SRCBASE)/ctf/linux ||
159 sed
-i
$(INSTALLDIR
)/www
/advanced-misc.asp
-e
"/CTF-BEGIN/,/CTF-END/d"
161 # Only include VLAN-GUI pages if VLAN-GUI is configured in.
162 ifneq ($(TCONFIG_VLAN
),y
)
163 rm -f
$(INSTALLDIR
)/www
/advanced-vlan.asp
164 rm -f
$(INSTALLDIR
)/www
/advanced-access.asp
165 rm -f
$(INSTALLDIR
)/www
/advanced-wlanvifs.asp
166 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
167 sed
-i
$(INSTALLDIR
)/www
/advanced-firewall.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
168 sed
-i
$(INSTALLDIR
)/www
/advanced-routing.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
169 sed
-i
$(INSTALLDIR
)/www
/basic-network.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
170 sed
-i
$(INSTALLDIR
)/www
/forward-upnp.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
171 sed
-i
$(INSTALLDIR
)/www
/status-devices.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
172 sed
-i
$(INSTALLDIR
)/www
/status-overview.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
173 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
174 ifeq ($(TCONFIG_NOCAT
),y
)
175 sed
-i
$(INSTALLDIR
)/www
/splashd.asp
-e
"/ VLAN-BEGIN/,/ VLAN-END/d"
178 sed
-i
$(INSTALLDIR
)/www
/advanced-routing.asp
-e
"/ NOVLAN-BEGIN/,/ NOVLAN-END/d"
179 sed
-i
$(INSTALLDIR
)/www
/basic-network.asp
-e
"/ NOVLAN-BEGIN/,/ NOVLAN-END/d"
180 sed
-i
$(INSTALLDIR
)/www
/status-devices.asp
-e
"/ NOVLAN-BEGIN/,/ NOVLAN-END/d"
181 sed
-i
$(INSTALLDIR
)/www
/status-overview.asp
-e
"/ NOVLAN-BEGIN/,/ NOVLAN-END/d"
184 ifeq ($(TOMATO_EXPERIMENTAL
),0)
185 cd
$(INSTALLDIR
)/www
&& \
186 for F in
$(wildcard *.asp
); do \
187 sed
-e
"s,<div class='title'>Tomato</div>,<div class='title'>Tomato RAF</div>," $$F > $$F.tmp
; \
192 cd
$(INSTALLDIR
)/www
&& \
193 for F in
$(wildcard *.asp
); do \
194 sed
-e
"s,<div class='version'>Version <% version(); %></div>,<div class='version'>Version <% version(); %>.9013 series (Beta)</div>," $$F > $$F.tmp
; \
198 # Only include the vpn pages if OpenVPN is compiled in
199 # Remove AES ciphers from the GUI if openssl doesn't have an AES directory
200 ifeq ($(TCONFIG_OPENVPN
),y
)
201 test -d ..
/openssl
/crypto
/aes || sed
-i
$(INSTALLDIR
)/www
/vpn.js
-e
"/AES-BEGIN/,/AES-END/d"
202 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/ VPN-BEGIN/d" -e
"/ VPN-END/d"
203 sed
-i
$(INSTALLDIR
)/www
/admin-access.asp
-e
"/ VPN-BEGIN/d" -e
"/ VPN-END/d"
205 rm -f
$(INSTALLDIR
)/www
/vpn-
{client
,server
}.asp
$(INSTALLDIR
)/www
/vpn.js
206 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/ OPENVPN-BEGIN/,/ OPENVPN-END/d"
207 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/ OPENVPN-BEGIN/,/ OPENVPN-END/d"
210 ifeq ($(TCONFIG_USERPPTP
),y
)
211 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/ VPN-BEGIN/d" -e
"/ VPN-END/d"
212 sed
-i
$(INSTALLDIR
)/www
/admin-access.asp
-e
"/ VPN-BEGIN/d" -e
"/ VPN-END/d"
214 rm -f
$(INSTALLDIR
)/www
/vpn-pptp.asp
215 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/USERPPTP-BEGIN/,/USERPPTP-END/d"
216 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/USERPPTP-BEGIN/,/USERPPTP-END/d"
217 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/JYAVENARD-BEGIN/,/JYAVENARD-END/d"
220 # Only include the PPTPD pages if PPTPD is compiled in
221 ifeq ($(TCONFIG_PPTPD
),y
)
222 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/ VPN-BEGIN/d" -e
"/ VPN-END/d"
223 sed
-i
$(INSTALLDIR
)/www
/admin-access.asp
-e
"/ VPN-BEGIN/d" -e
"/ VPN-END/d"
225 rm -f
$(INSTALLDIR
)/www
/vpn-pptp-server.asp
226 rm -f
$(INSTALLDIR
)/www
/vpn-pptp-online.asp
227 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/ PPTPD-BEGIN/,/ PPTPD-END/d"
228 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/ PPTPD-BEGIN/,/ PPTPD-END/d"
231 # Only include the snmp pages if SNMP is compiled in
232 ifneq ($(TCONFIG_SNMP
),y
)
233 rm -f
$(INSTALLDIR
)/www
/admin-snmp.asp
234 sed
-i
$(INSTALLDIR
)/www
/tomato.js
-e
"/SNMP-BEGIN/,/SNMP-END/d"
235 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/SNMP-BEGIN/,/SNMP-END/d"
238 # Only include the dnscrypt option if is compiled in
239 ifneq ($(TCONFIG_DNSCRYPT
),y
)
240 sed
-i
$(INSTALLDIR
)/www
/basic-network.asp
-e
"/DNSCRYPT-BEGIN/,/DNSCRYPT-END/d"
241 sed
-i
$(INSTALLDIR
)/www
/about.asp
-e
"/DNSCRYPT-BEGIN/,/DNSCRYPT-END/d"
245 cd
$(INSTALLDIR
)/www
&& \
246 for F in
$(wildcard *.asp
*.js
*.jsx
*.html
); do \
247 [ -f
$(INSTALLDIR
)/www
/$$F ] && sed
-i
$$F \
248 -e
"/LINUX26-BEGIN/d" -e
"/LINUX26-END/d" \
249 -e
"/LINUX24-BEGIN/d" -e
"/LINUX24-END/d" \
250 -e
"/USB-BEGIN/d" -e
"/USB-END/d" \
251 -e
"/EXTRAS-BEGIN/d" -e
"/EXTRAS-END/d" \
252 -e
"/NTFS-BEGIN/d" -e
"/NTFS-END/d" \
253 -e
"/SAMBA-BEGIN/d" -e
"/SAMBA-END/d" \
254 -e
"/FTP-BEGIN/d" -e
"/FTP-END/d" \
255 -e
"/MEDIA-SRV-BEGIN/d" -e
"/MEDIA-SRV-END/d" \
256 -e
"/THEMES-BEGIN/d" -e
"/THEMES-END/d" \
257 -e
"/JFFS2-BEGIN/d" -e
"/JFFS2-END/d" \
258 -e
"/CIFS-BEGIN/d" -e
"/CIFS-END/d" \
259 -e
"/ZEBRA-BEGIN/d" -e
"/ZEBRA-END/d" \
260 -e
"/EMF-BEGIN/d" -e
"/EMF-END/d" \
261 -e
"/ OPENVPN-BEGIN/d" -e
"/ OPENVPN-END/d" \
262 -e
"/AES-BEGIN/d" -e
"/AES-END/d" \
263 -e
"/ PPTPD-BEGIN/d" -e
"/ PPTPD-END/d" \
264 -e
"/ VPN-BEGIN/,/ VPN-END/d" \
265 -e
"/IPV6-BEGIN/d" -e
"/IPV6-END/d" \
266 -e
"/CTF-BEGIN/d" -e
"/CTF-END/d" \
267 -e
"/NOCAT-BEGIN/d" -e
"/NOCAT_END/d"\
268 -e
"/SNMP-BEGIN/d" -e
"/SNMP_END/d"\
269 -e
"/ VLAN-BEGIN/d" -e
"/ VLAN-END/d" \
270 -e
"/ NOVLAN-BEGIN/d" -e
"/ NOVLAN-END/d" \
271 -e
"/DNSCRYPT-BEGIN/d" -e
"/DNSCRYPT-END/d"\
275 # make sure old and debugging crap is gone
276 @
rm -f
$(INSTALLDIR
)/www
/debug.js
277 @
rm -f
$(INSTALLDIR
)/www
/*-x.
*
278 @
rm -f
$(INSTALLDIR
)/www
/*-old.
*
279 @
rm -f
$(INSTALLDIR
)/www
/color.css
281 chmod
0644 $(INSTALLDIR
)/www
/*
283 # remove C-style comments from java files. All "control" comments have been processed by now.
284 for F in
$(wildcard *.js
*.jsx
); do \
285 [ -f
$(INSTALLDIR
)/www
/$$F ] && $(TOP
)/www
/remcoms2.sh
$(INSTALLDIR
)/www
/$$F c
; \