fix: source functions
sourcing /lib/functions so uci_get is in scope
This commit is contained in:
7
Makefile
7
Makefile
@@ -1,7 +0,0 @@
|
|||||||
default: debug
|
|
||||||
|
|
||||||
debug:
|
|
||||||
# return true to not see Makefile errors
|
|
||||||
sh -x wifi4eu.login || true
|
|
||||||
deploy:
|
|
||||||
scp *.login router:/etc/travelmate
|
|
||||||
7
justfile
Normal file
7
justfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
check fname:
|
||||||
|
shellcheck {{fname}}
|
||||||
|
debug fname:
|
||||||
|
# return true to not see Makefile errors
|
||||||
|
sh -x {{fname}} || true
|
||||||
|
deploy fname:
|
||||||
|
scp {{fname}} router:/etc/travelmate
|
||||||
9
test/functions.sh
Normal file
9
test/functions.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# create a symlink to this file at /lib/functions.sh for testing
|
||||||
|
|
||||||
|
# mock implementation of uci_get that always returns the default value
|
||||||
|
uci_get() {
|
||||||
|
for item in "$@"; do
|
||||||
|
last=$item
|
||||||
|
done
|
||||||
|
echo "$last"
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# auto-login for https://wifi4eu.ec.europa.eu or general fortigate
|
# auto-login for https://wifi4eu.ec.europa.eu or general fortigate
|
||||||
|
. "/lib/functions.sh"
|
||||||
|
|
||||||
trm_fetch="$(command -v curl)"
|
trm_fetch="$(command -v curl)"
|
||||||
trm_captiveurl="$(uci_get travelmate global trm_captiveurl "http://detectportal.firefox.com")"
|
trm_captiveurl="$(uci_get travelmate global trm_captiveurl "http://detectportal.firefox.com")"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user