added dependecy check

This commit is contained in:
Shihaam Abdul Rahman 2023-05-24 21:18:19 +05:00
parent 23a6f844ce
commit b38e6acfed
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636

View File

@ -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)