Mercurial > hg > anonet-resdb
annotate scripts/add_udpmsg4_path @ 917:feb20bee2971 draft
hanged Addresses ofssssssss
author | pikaj00 <pikaj00@gmail.com> |
---|---|
date | Sun, 05 Feb 2012 16:04:32 -0500 |
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" |