Mercurial > hg > anonet-resdb
annotate scripts/add_udpmsg4_path @ 1094:1d2f501fa55e draft
epoch added as 4141 and CIDR 1.41.41.0/24
author | epoch <epoch@hacking.allowed.org> |
---|---|
date | Sun, 24 Mar 2013 12:51:10 +0000 |
parents | a4e5033ce156 |
children |
rev | line source |
---|---|
603
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
1 #!/bin/sh |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
2 if [ x"$2" = x ]; then |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
3 echo "Usage: $0 <path> <owner> <key>" >&2; exit 255 |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
4 fi |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
5 path="$1" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
6 owner="$2" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
7 key="$3" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
8 if [ "$(echo -n "$path" | tr -d '/A-Za-z0-9_-' | wc -c | tr -d ' \t')" != 0 ]; then |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
9 echo "udpmsg4 paths do not allow funny chars." >&2; exit 255 |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
10 fi |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
11 if [ "$(echo "$path" | head -c1)" != / ]; then |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
12 echo "udpmsg4 paths start with a slash." >&2; exit 255 |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
13 fi |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
14 fullpath=db/udpmsg4"$path" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
15 mkdir -p "$fullpath" || exit 1 |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
16 mkdir "$fullpath/@" || exit 1 |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
17 echo "$key" >"$fullpath/@/default.key" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
18 echo "$path" >"$fullpath/@/path" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
19 echo "$owner" >"$fullpath/@/owner" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
20 echo "temp.keys" >"$fullpath/@/.gitignore" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
21 mkdir "$fullpath/@/temp.keys" |
a4e5033ce156
welcome udpmsg4 paths to resdb :-)
Nick <nick@somerandomnick.ano>
parents:
diff
changeset
|
22 mkdir "$fullpath/@/blacklisted.keys" |