diff --git a/os/routers/glmain/config.yaml b/os/routers/glmain/config.yaml index 18d80bd..01426b3 100644 --- a/os/routers/glmain/config.yaml +++ b/os/routers/glmain/config.yaml @@ -47,4 +47,7 @@ iot: - name: 'apollo-eddie' mac: '30:30:F9:DC:A8:18' - name: 'apollo-office' - mac: '30:30:F9:DA:C7:A4' \ No newline at end of file + mac: '30:30:F9:DA:C7:A4' +apl: + - name: 'hp-print' + mac: '48:9E:BD:CB:07:E3' \ No newline at end of file diff --git a/os/routers/glmain/gen-mappings.py b/os/routers/glmain/gen-mappings.py index ca9189d..80418e2 100755 --- a/os/routers/glmain/gen-mappings.py +++ b/os/routers/glmain/gen-mappings.py @@ -20,6 +20,7 @@ ip_prefix_map = { "hub": "10.0.12.", "cam": "10.0.13.", "iot": "10.0.14.", + "apl": "10.0.15." } def cap1_and_join(*args: str) -> str: diff --git a/os/routers/glmain/output/etc/dnsmasq.conf b/os/routers/glmain/output/etc/dnsmasq.conf index 8174c91..b4b9546 100644 --- a/os/routers/glmain/output/etc/dnsmasq.conf +++ b/os/routers/glmain/output/etc/dnsmasq.conf @@ -48,3 +48,5 @@ dhcp-host=30:30:F9:DC:A8:18,IotApollo-eddie,10.0.14.4,infinite address=/apollo-eddie.iot.internal/10.0.14.4 dhcp-host=30:30:F9:DA:C7:A4,IotApollo-office,10.0.14.5,infinite address=/apollo-office.iot.internal/10.0.14.5 +dhcp-host=48:9E:BD:CB:07:E3,AplHp-print,10.0.15.1,infinite +address=/hp-print.apl.internal/10.0.15.1 diff --git a/os/routers/glmain/output/summary.yaml b/os/routers/glmain/output/summary.yaml index 2d26d1a..e71f751 100644 --- a/os/routers/glmain/output/summary.yaml +++ b/os/routers/glmain/output/summary.yaml @@ -68,4 +68,8 @@ Iot: host: "apollo-eddie.iot.internal" Apollo-office: ip: "10.0.14.5" - host: "apollo-office.iot.internal" \ No newline at end of file + host: "apollo-office.iot.internal" +Apl: + Hp-print: + ip: "10.0.15.1" + host: "hp-print.apl.internal" \ No newline at end of file diff --git a/os/routers/glmain/push.sh b/os/routers/glmain/push.sh index 7b8cd59..f4e61c3 100755 --- a/os/routers/glmain/push.sh +++ b/os/routers/glmain/push.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -BASE_PATH=$(realpath $BASH_SOURCE | xargs dirname) +BASE_PATH=$(realpath "${BASH_SOURCE[0]}" | xargs dirname) ROUTER=${1:-10.0.0.1} USER=${2:-root} @@ -23,17 +23,17 @@ function ask { server=$USER@$ROUTER echo "using 🤖 $server" -pushd $BASE_PATH +pushd "$BASE_PATH" || exit 1 echo "Updating conf..." ./gen-mappings.py cat output/summary.yaml -ask +ask "continue update" -scp -O output/etc/dnsmasq.conf $USER@$ROUTER:/tmp/dnsmasq.new.conf -ssh $USER@$ROUTER << EOF -echo "Backing up dnsmasq.conf file to /tmp/dnsmasq.old.conf" +scp -O output/etc/dnsmasq.conf "$server:/tmp/dnsmasq.new.conf" +ssh "$server" << EOF +echo 'Backing up dnsmasq.conf file to /tmp/dnsmasq.old.conf' cp /etc/dnsmasq.conf /tmp/dnsmasq.old.conf -echo "Updating dnsmasq.conf 🙇🏼" +echo 'Updating dnsmasq.conf 🙇🏼' cp /tmp/dnsmasq.new.conf /etc/dnsmasq.conf if dnsmasq --test ; then /etc/init.d/dnsmasq restart @@ -44,4 +44,8 @@ else dnsmasq --test echo "Revert successful! 👍" fi -EOF \ No newline at end of file +EOF + +git add . +git commit -m "Updated Router Config at $(date)" +git push \ No newline at end of file