Add set gateway entry to KUAL
This commit is contained in:
parent
220a446fb6
commit
926b15949d
3 changed files with 16 additions and 2 deletions
|
@ -14,6 +14,11 @@ PIDFILE="${DAEMON_PATH}/${DAEMON}.pid"
|
|||
# SCRIPTNAME="/etc/init.d/${NAME}"
|
||||
|
||||
case "$1" in
|
||||
set-gateway)
|
||||
GATEWAY=$(ip route | grep default | grep "${NET}" | awk '{print $3}')
|
||||
echo "$GATEWAY"
|
||||
echo "$GATEWAY" >"${DAEMON_PATH}/gateway.txt"
|
||||
;;
|
||||
enable)
|
||||
touch "$DAEMON_ENABLED_FILE"
|
||||
;;
|
||||
|
@ -24,7 +29,7 @@ start)
|
|||
if [ -e "$DAEMON_ENABLED_FILE" ]; then
|
||||
printf "%-50s" "Starting $NAME..."
|
||||
cd "$DAEMON_PATH" || exit
|
||||
. "$DAEMON_ENV_FILE"
|
||||
. "$DAEMON_ENV_FILE" || exit
|
||||
PID=$(
|
||||
RUST_BACKTRACE=full RUST_LOG=debug $DAEMON "$DAEMONOPTS" >/dev/null 2>&1 &
|
||||
echo $!
|
||||
|
@ -72,7 +77,7 @@ restart)
|
|||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {status|start|stop|restart}"
|
||||
echo "Usage: $0 {set-gateway|enable|disable|status|start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
4
kdash_client/extensions/kdash/kdash.env
Normal file
4
kdash_client/extensions/kdash/kdash.env
Normal file
|
@ -0,0 +1,4 @@
|
|||
export KDASH_URL=
|
||||
export KDASH_JWT=
|
||||
export NET="wlan0"
|
||||
export ROUTER_IP="$(cat "${DAEMON_PATH}/gateway.txt" | sed -e 's/^[ \t]*//' -e 's/\ *$//g')"
|
|
@ -3,6 +3,11 @@
|
|||
{
|
||||
"name": "kdash",
|
||||
"items": [
|
||||
{
|
||||
"name": "Set Gateway",
|
||||
"priority": 0,
|
||||
"action": "./daemon.sh set-gateway"
|
||||
},
|
||||
{ "name": "Enable", "priority": 0, "action": "./daemon.sh enable" },
|
||||
{ "name": "Disable", "priority": 0, "action": "./daemon.sh disable" },
|
||||
{ "name": "Start", "priority": 0, "action": "./daemon.sh start" },
|
||||
|
|
Loading…
Reference in a new issue