annotate scripts/add_dom @ 1260:f5ad11b817f1 draft default tip master

switched to using the git subdomain for git repo url
author epoch <epoch@hack.thebackupbox.net>
date Sat, 09 Oct 2021 09:21:28 +0000
parents 8e01b8361e9e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
1 #!/bin/sh
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
2
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
3 if [ x"$2" = x ]; then
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
4 echo "Usage: $0 <dom> <owner> [<ns[/nsip]>...]" >&2; exit 255
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
5 fi
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
6
1120
8e01b8361e9e changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents: 1119
diff changeset
7 dir=db/dom/"$(echo "$1" | tr . '\n' | tac | tr '\n' / )"
1116
f0ffda736b12 add_dom bugfix
Anonymous Coward <nobody@nowhere>
parents: 19
diff changeset
8 mkdir -p "$dir" || exit 1
1120
8e01b8361e9e changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents: 1119
diff changeset
9 echo "$2" > "${dir}owner"
8e01b8361e9e changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents: 1119
diff changeset
10 mkdir "${dir}ns" || exit 1
19
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
11 shift; shift;
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
12 while [ x"$1" != x ]; do
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
13 echo "$1" | tr / ' ' | (
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
14 read ns nsip
1120
8e01b8361e9e changed add_dom to not even bother with anything head -c -1 related. should still work.
epoch <epoch@hacking.allowed.org>
parents: 1119
diff changeset
15 echo "$nsip" > "${dir}ns/$ns"
19
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
16 )
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
17 shift;
31e3b4edf502 scripts for dom&ip, dn42 resdb, and doc (www.anonet2.org)
Nick <nick@somerandomnick.ano>
parents:
diff changeset
18 done