Correct Hilink authentication and service

This commit is contained in:
Christian Zeitnitz 2021-06-18 17:27:11 +02:00
parent 0625fcc5ef
commit 8f702a2a55
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,3 @@
SUBSYSTEM=="net", ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14db", NAME="hilink%n", TAG+="systemd", ENV{SYSTEMD_WANTS}="start start_huawei_hilink.service" SUBSYSTEM=="net", ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14db", NAME="hilink%n", TAG+="systemd", ENV{SYSTEMD_WANTS}="start start_huawei_hilink@hilink%n.service"

View file

@ -33,14 +33,19 @@ while [ -n "$1" ]; do
shift shift
done done
if [ ! _loginState ] && [ -z "$hilink_password" ] || [ -z "$hilink_pin" ]; then _getAuthRouter; fi
if [ ! -z "$devname" ]; then # get host IP for given device name if [ ! -z "$devname" ]; then # get host IP for given device name
gw=$(ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev $devname.*/\1/p") gw=$(ip route list | sed -rn "s/default via (([0-9]{1,3}\.){3}[0-9]{1,3}).*dev $devname.*/\1/p")
if [ -z "$gw" ]; then exit; fi # device name not found in routing list -> abort if [ -z "$gw" ]; then exit; fi # device name not found in routing list -> abort
hilink_host="$gw" hilink_host="$gw"
fi fi
if [ -z "$hilink_password" ] || [ -z "$hilink_pin" ]; then
_getAuthRouter
if [ ! -z "$raspap_user" ]; then hilink_user="$raspap_user"; fi
if [ ! -z "$raspap_password" ]; then hilink_password="$raspap_password"; fi
if [ ! -z "$raspap_pin" ]; then hilink_pin="$raspap_pin"; fi
fi
echo "Hilink: switch device at $hilink_host to mode $datamode" | systemd-cat echo "Hilink: switch device at $hilink_host to mode $datamode" | systemd-cat
status="usage: -c 1/0 to disconnect/connect" status="usage: -c 1/0 to disconnect/connect"