Skip to content

Commit 2aef253

Browse files
fix install script silent failure #118
1 parent 3f956e0 commit 2aef253

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

server/bwmon.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,12 @@ create() {
165165
}
166166

167167
fcdisable() {
168-
fc status > /dev/null 2>&1
169-
if [ $? -eq 0 ]; then
170-
log "Flow Cache will be disabled ..."
171-
fc disable
172-
fc flush
168+
if command -v fc >/dev/null 2>&1; then
169+
if fc status > /dev/null 2>&1; then
170+
log "Flow Cache will be disabled ..."
171+
fc disable
172+
fc flush
173+
fi
173174
fi
174175
}
175176

server/install.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@
1919
#!/bin/sh
2020
set -e
2121
echo "...Bandwidth Usage Installation..."
22-
opkg print-architecture > /dev/null 2>&1
23-
if [ $? -ne 0 ]; then
22+
if opkg print-architecture > /dev/null 2>&1; then
23+
echo "Entware is installed"
24+
else
2425
echo "Please install entware!"
2526
echo "https://github.com/Entware/Entware"
2627
exit 1
27-
else
28-
echo "Entware is installed"
2928
fi
3029
if [ ! -x /opt/sbin/lighttpd ] || ! opkg list-installed lighttpd > /dev/null 2>&1; then
3130
echo "Installing lighttpd (Entware build) ..."
@@ -39,11 +38,12 @@ if ! bc -v >/dev/null 2>&1; then
3938
else
4039
echo "bc is installed"
4140
fi
42-
fc status > /dev/null 2>&1
43-
if [ $? -eq 0 ]; then
44-
echo "Flow Cache will be disabled ..."
45-
fc disable
46-
fc flush
41+
if command -v fc >/dev/null 2>&1; then
42+
if fc status >/dev/null 2>&1; then
43+
echo "Flow Cache will be disabled ..."
44+
fc disable
45+
fc flush
46+
fi
4747
fi
4848
echo "Installing bwmon ..."
4949
chmod +x server/bwmon.sh

0 commit comments

Comments
 (0)