add dns, get version scripts

This commit is contained in:
daniel fusser 2023-04-10 01:26:30 +02:00
parent 511ce5f9fd
commit 44b85645d3
3 changed files with 51 additions and 0 deletions

0
add_api_user.sh Normal file → Executable file
View File

30
add_dns.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
set -e
ssh_user="admin"
ssh_host="${ssh_user}@192.168.2.1"
ssh_opts="-p 11422"
dns_domain=dafu.dev
dns_hostname=${1}
dns_ip=${2:-192.168.2.20}
. util.sh # import ssh function after options are set
fg_add_dns_script="
execute batch start
config system dns-database
edit \"${dns_domain}\"
config dns-entry
edit 0
set hostname \"${dns_hostname}\"
set ip \"${dns_ip}\"
end
end
execute batch end
execute batch lastlog
"
run_ssh_script "${fg_add_dns_script}"

21
get_fw.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -e
# FG_HOST=192.168.2.1 FG_PORT=11422 ./get_fw.sh
ssh_user="${FG_USER:-admin}"
ssh_host="${ssh_user}@${FG_HOST:-}"
ssh_port=${FG_PORT:-22}
ssh_opts="-q -p ${ssh_port}"
. util.sh # import ssh function after options are set
fg_updatekey_script="
get system status
"
ver=$(run_ssh_script "${fg_updatekey_script}" | \
grep "Version" | \
grep -o -P "(?<=Version: ).*(?=,build.*)" 2>/dev/null)
echo "Version is $ver"