-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path03-configure.sh
executable file
·168 lines (128 loc) · 4.14 KB
/
03-configure.sh
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/sh
################################
# Disable WWAN support (mobiled)
################################
uci set mobiled.globals.enabled='0'
uci set mobiled.device_defaults.enabled='0'
uci commit
/etc/init.d/mobiled stop
/etc/init.d/mobiled disable
#########################
# Disable Printer sharing
#########################
uci set printersharing.config.enabled='0'
uci set samba.printers.enabled='0'
uci commit
########################################
# Disable Content Sharing (Samba / DNLA)
########################################
uci set samba.samba.enabled='0'
uci commit
/etc/init.d/samba stop
/etc/init.d/samba disable
/etc/init.d/samba-nmbd stop
/etc/init.d/samba-nmbd disable
uci set dlnad.config.enabled='0'
uci commit
/etc/init.d/dlnad stop
/etc/init.d/dlnad disable
#############################
# Disable Telephony via MMPBX
#############################
uci set mmpbx.global.enabled='0'
uci commit
/etc/init.d/mmpbxd stop
/etc/init.d/mmpbxd disable
############################
# Disable Traffic Monitoring
############################
/etc/init.d/trafficmon stop
/etc/init.d/trafficmon disable
###############################
# Disable Time of Day ACL rules
###############################
uci set tod.global.enabled='0'
uci commit
/etc/init.d/tod stop
/etc/init.d/tod disable
#####################
# Disable Wake on LAN
#####################
uci set wol.config.enabled='0'
uci commit
/etc/init.d/wol stop
/etc/init.d/wol disable
#########################
# Ability to control LEDs
#########################
# ledfw controls internet/wifi/voip/etc LEDs
/etc/init.d/ledfw stop
# Install control script so we can turn LEDs on and off via the 'Status' button
# Some firmware refer to this as `button.info` rather than `button.easy_reset`
uci set button.easy_reset.handler='toggleleds.sh' # Original value: rtfd
uci set button.easy_reset.min='0' # Original value: 7
uci set button.easy_reset.max='2' # Original value: 90
uci commit
cat > /usr/sbin/toggleleds.sh << EOF
#!/bin/sh
ledfw_status=\$(pidof ledfw.lua)
# If currently on
if [ -n "\$ledfw_status" ]; then
/etc/init.d/ledfw stop
for led in /sys/class/leds/*; do
echo '0' > "\$led/brightness"
echo 'none' > "\$led/trigger"
done
else
/etc/init.d/ledfw start
# Wifi LEDs don't come back on til you restart hostapd
hostapd_status=\$(pidof hostapd)
if [ -n "\$hostapd_status" ]; then
/etc/init.d/hostapd restart
fi
sleep 0.5
# Blue power light
led="/sys/class/leds/power"
echo '0' > "\$led:red/brightness"
echo '255' > "\$led:blue/brightness"
fi
EOF
chmod +x /usr/sbin/toggleleds.sh
cat > /etc/init.d/leds-off << EOF
#!/bin/sh /etc/rc.common
START=99 # Must be after ledfw (12) and led (96)
LEDFW_STATUS=\$(pidof ledfw.lua)
start() {
if [ -n "\$LEDFW_STATUS" ]; then
# Toggle off if ledfw is running
/usr/sbin/toggleleds.sh
else
# Explictly turn everything off
for led in /sys/class/leds/*; do
echo '0' > "\$led/brightness"
echo 'none' > "\$led/trigger"
done
fi
}
EOF
chmod +x /etc/init.d/leds-off
# Shut all the LEDs down so this takes effect immediately
/etc/init.d/leds-off enable
/etc/init.d/leds-off start
###########################################
# Enable opkg repository feeds from OpenWrt
#
# Note that by default, the TG799vac only has 32MB of storage (~25MB free) so if
# you want to install lots of packages, you should consider an extroot config
# with a USB stick.
#
# See https://openwrt.org/docs/guide-user/additional-software/extroot_configuration
###########################################
echo -n "
src/gz chaos_calmer http://archive.openwrt.org/chaos_calmer/15.05.1/brcm63xx/smp/packages/base
src/gz luci http://archive.openwrt.org/chaos_calmer/15.05.1/brcm63xx/smp/packages/luci
src/gz management http://archive.openwrt.org/chaos_calmer/15.05.1/brcm63xx/smp/packages/management
src/gz routing http://archive.openwrt.org/chaos_calmer/15.05.1/brcm63xx/smp/packages/routing
src/gz packages http://archive.openwrt.org/chaos_calmer/15.05.1/brcm63xx/smp/packages/packages
src/gz telephony http://archive.openwrt.org/chaos_calmer/15.05.1/brcm63xx/smp/packages/telephony
" >> /etc/opkg/distfeeds.conf