diff options
| author | cathugger <cathugger@cock.li> | 2017-03-10 03:30:16 +0000 | 
|---|---|---|
| committer | cathugger <cathugger@cock.li> | 2017-03-10 03:30:16 +0000 | 
| commit | 7e5469a0dee1fbaf661720fc330d47d992f1d8fe (patch) | |
| tree | d5f8a16a1ae8e390103e35a77d975e3157115236 /scripts | |
| parent | 9ec38bd2c56d112e49360c4f8be92900c998205c (diff) | |
| download | resdb-7e5469a0dee1fbaf661720fc330d47d992f1d8fe.tar.gz resdb-7e5469a0dee1fbaf661720fc330d47d992f1d8fe.zip | |
add muh nameserver, some script tweaks
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/add_ip | 2 | ||||
| -rwxr-xr-x | scripts/cidr2hex | 4 | ||||
| -rwxr-xr-x | scripts/dec2hex | 2 | ||||
| -rwxr-xr-x | scripts/git-config | 2 | ||||
| -rwxr-xr-x | scripts/git-pull | 7 | ||||
| -rwxr-xr-x | scripts/hex2dec | 2 | ||||
| -rwxr-xr-x | scripts/ip2hex | 2 | ||||
| -rwxr-xr-x | scripts/ns2ip | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | scripts/update-git-remotes | 2 | 
9 files changed, 13 insertions, 12 deletions
| diff --git a/scripts/add_ip b/scripts/add_ip index 0d7d87c..e582a49 100755 --- a/scripts/add_ip +++ b/scripts/add_ip @@ -5,7 +5,7 @@ if [ x"$2" = x ]; then  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 diff --git a/scripts/cidr2hex b/scripts/cidr2hex index 36974e0..7a84522 100755 --- a/scripts/cidr2hex +++ b/scripts/cidr2hex @@ -4,4 +4,6 @@ if [ x"$1" = x ]; then   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" diff --git a/scripts/dec2hex b/scripts/dec2hex index 9194d01..53ccf10 100755 --- a/scripts/dec2hex +++ b/scripts/dec2hex @@ -17,6 +17,6 @@     bc -q    ) | tail -c3   else -  cat ./scripts/dec2hex.d/"$(cat)" +  cat `dirname "$0"`/dec2hex.d/"$(cat)"   fi  ) diff --git a/scripts/git-config b/scripts/git-config index bad9a0b..d55954a 100755 --- a/scripts/git-config +++ b/scripts/git-config @@ -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 diff --git a/scripts/git-pull b/scripts/git-pull index 260c33b..449d6a8 100755 --- a/scripts/git-pull +++ b/scripts/git-pull @@ -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 diff --git a/scripts/hex2dec b/scripts/hex2dec index bf5d82d..1a59f5a 100755 --- a/scripts/hex2dec +++ b/scripts/hex2dec @@ -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  ) diff --git a/scripts/ip2hex b/scripts/ip2hex index 2c8ce36..9cd2a99 100755 --- a/scripts/ip2hex +++ b/scripts/ip2hex @@ -5,5 +5,5 @@ if [ x"$1" = x ]; then  fi  for x in $(echo -n "$1" | tr . ' ') ; do - ./scripts/dec2hex "$x" +`dirname "$0"`/dec2hex "$x"  done | tr '\n' / | head -c -1 ; echo diff --git a/scripts/ns2ip b/scripts/ns2ip index ff5bf2b..f5e965b 100755 --- a/scripts/ns2ip +++ b/scripts/ns2ip @@ -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" diff --git a/scripts/update-git-remotes b/scripts/update-git-remotes index 8048d54..04300cc 100644..100755 --- a/scripts/update-git-remotes +++ b/scripts/update-git-remotes @@ -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 | 
