annotate scripts/add_udpmsg4_path @ 781:f9c3f2b6a6b1 draft

patched peer2anonet bootstrap bug
author d3v11 <d3v11@d3v11.ano>
date Sat, 26 Nov 2011 20:06:20 +0000
parents a4e5033ce156
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"