added dependecy check
This commit is contained in:
parent
23a6f844ce
commit
b38e6acfed
10
routerapi.sh
10
routerapi.sh
@ -1,5 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
dependency_check(){
|
||||
for DEPENDENCY; do
|
||||
if ! command -v "$DEPENDENCY" 1>/dev/null; then
|
||||
printf "%s not found. Please install it.\n" "$DEPENDENCY" >&2
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
unset DEPENDENCY
|
||||
}
|
||||
dependency_check "htmlq" "xmlstarlet" "tail" "head" "curl"
|
||||
|
||||
home_html=$(curl -s $ROUTER_ADDRESS/html/home.html)
|
||||
csrf_token1=$(echo $home_html | htmlq 'meta[name="csrf_token"]' --attribute content | head -n1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user