changeset 1193:2f57d4d36759 draft

add muh nameserver, some script tweaks
author cathugger <cathugger@cock.li>
date Fri, 10 Mar 2017 03:30:16 +0000
parents a0de6dd1652e
children 0a7add0a8821
files db/as/6370/owner db/dom/ano/cathugger/ns/uz56x91zhcjmtvt5r6gj8fg5rxybgqw9wvu5vpy55gp4vjhllbtwl5.ns.cathugger.ano db/dom/ano/cathugger/owner db/ip/15/00/00/cidr db/ip/15/00/00/owner scripts/add_ip scripts/cidr2hex scripts/dec2hex scripts/git-config scripts/git-pull scripts/hex2dec scripts/ip2hex scripts/ns2ip scripts/update-git-remotes
diffstat 14 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/as/6370/owner	Fri Mar 10 03:30:16 2017 +0000
@@ -0,0 +1,1 @@
+cathugger
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/dom/ano/cathugger/ns/uz56x91zhcjmtvt5r6gj8fg5rxybgqw9wvu5vpy55gp4vjhllbtwl5.ns.cathugger.ano	Fri Mar 10 03:30:16 2017 +0000
@@ -0,0 +1,1 @@
+1.0.0.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/dom/ano/cathugger/owner	Fri Mar 10 03:30:16 2017 +0000
@@ -0,0 +1,1 @@
+cathugger
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/15/00/00/cidr	Fri Mar 10 03:30:16 2017 +0000
@@ -0,0 +1,1 @@
+21.0.0.0/24
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/ip/15/00/00/owner	Fri Mar 10 03:30:16 2017 +0000
@@ -0,0 +1,1 @@
+cathugger
--- a/scripts/add_ip	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/add_ip	Fri Mar 10 03:30:16 2017 +0000
@@ -5,7 +5,7 @@
 fi
 
 cidr="$1"
-hex="$(./scripts/cidr2hex "$cidr")"
+hex=$($(dirname "$0")/cidr2hex "$cidr") || exit 1
 dir=db/ip/"$hex"
 if [ -e "$dir" ]; then
  echo "Refusing to clobber existing record" >&2; exit 1
--- a/scripts/cidr2hex	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/cidr2hex	Fri Mar 10 03:30:16 2017 +0000
@@ -4,4 +4,6 @@
  echo "Usage: $0 <cidr>" >&2; exit 255
 fi
 
-./scripts/ip2hex "$(./scripts/cidr2ip "$1")"
+dn=$(dirname "$0")
+ip=$("$dn"/cidr2ip "$1") || exit 1
+"$dn"/ip2hex "$ip"
--- a/scripts/dec2hex	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/dec2hex	Fri Mar 10 03:30:16 2017 +0000
@@ -17,6 +17,6 @@
    bc -q
   ) | tail -c3
  else
-  cat ./scripts/dec2hex.d/"$(cat)"
+  cat `dirname "$0"`/dec2hex.d/"$(cat)"
  fi
 )
--- a/scripts/git-config	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/git-config	Fri Mar 10 03:30:16 2017 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-[ -z $2 ] && echo 'Usage: ./scripts/git-config <name> <email>'
+[ -z $2 ] && echo "Usage: $0 <name> <email>" >&2
 [ -z $2 ] && exit 1
 
 git config user.name $1
--- a/scripts/git-pull	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/git-pull	Fri Mar 10 03:30:16 2017 +0000
@@ -1,7 +1,6 @@
-#!/bin/bash
+#!/bin/sh
 if [ -z "$1" ]; then
-    echo './scripts/git-pull $PEER_NAME'
+    echo "Usage: $0 \$PEER_NAME" >&2
     exit 1
 fi
-[ -e db/usr/"$1"/git ] && git pull `cat db/usr/"$1"/git` master
-[ -e db/usr/"$1"/git ] || echo "./git-pull: record does not exist for $1"
+[ -e db/usr/"$1"/git ] && git pull `cat db/usr/"$1"/git` master || echo "$0: record does not exist for $1" >&2
--- a/scripts/hex2dec	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/hex2dec	Fri Mar 10 03:30:16 2017 +0000
@@ -12,6 +12,6 @@
  if [ x"$USE_BC" = x1 ]; then
   bc -q
  else
-  cat ./scripts/hex2dec.d/"$(cat)"
+  cat `dirname "$0"`/hex2dec.d/"$(cat)"
  fi
 )
--- a/scripts/ip2hex	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/ip2hex	Fri Mar 10 03:30:16 2017 +0000
@@ -5,5 +5,5 @@
 fi
 
 for x in $(echo -n "$1" | tr . ' ') ; do
- ./scripts/dec2hex "$x"
+`dirname "$0"`/dec2hex "$x"
 done | tr '\n' / | head -c -1 ; echo
--- a/scripts/ns2ip	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/ns2ip	Fri Mar 10 03:30:16 2017 +0000
@@ -3,7 +3,7 @@
 opt="$1"
 if [ "x$opt" = "x-f" ]; then
  shift
-elif ! ./scripts/check_db_safety; then
+elif ! `dirname "$0"`/check_db_safety; then
  exit 1
 fi
 ns="$1"
--- a/scripts/update-git-remotes	Fri Mar 10 01:12:23 2017 +0000
+++ b/scripts/update-git-remotes	Fri Mar 10 03:30:16 2017 +0000
@@ -4,7 +4,7 @@
 # TODO: detect users' git address changes
 #
 
-if ! ./scripts/check_db_safety; then
+if ! `dirname "$0"`/check_db_safety; then
  exit 1
 fi