echo >&2 "URI format: \`[gnunet://][user@]gns.name[/path/to/repo]'."
exit 1
fi
+pkey="$(gnunet-identity -qde "$username")"
while read -r cmd arg; do
case "$cmd" in
ip="$(gnunet-vpn -s "$service" -p "$peer" -t)"
echo >&2 "Using tunnel ip \`$ip'."
-{ printf '%s\n' "$path" "$arg"; cat; } | socat stdio tcp4:"$ip":9418
+{ printf '%s\n' "$path" "$arg" "$pkey"; cat; } | socat stdio tcp4:"$ip":9418
read -r path || { echo "No path specified." | tee /dev/stderr; exit 1; }
read -r comm || { echo "No command specified." | tee /dev/stderr; exit 1; }
+read -r pkey || { echo "No pkey specified." | tee /dev/stderr; exit 1; }
full_path="$(realpath -sm "$base_path$path")"
case "$full_path" in
- "$base_path") ;;
- "$base_path/"*) ;;
- *) echo "Invalid path: \`$full_path'." | tee /dev/stderr
- exit 1
- ;;
+"$base_path") ;;
+"$base_path/"*) ;;
+*) echo "Invalid path: \`$full_path'." | tee /dev/stderr
+ exit 1
+ ;;
esac
-if test "$comm" != "git-upload-pack"; then
- echo "Command \`$comm' has to be git-upload-pack." | tee /dev/stderr
+case "$comm" in
+git-upload-pack)
+ # No pkey checking.
+ ;;
+git-receive-pack)
+ # Accept any valid pkey. FIXME
+ echo "Command \`$comm' not supported yet." | tee /dev/stderr
exit 1
-fi
+ ;;
+*)
+ echo "Unknown command: \`$comm'." | tee /dev/stderr
+ exit 1
+ ;;
+esac
git_dir="$(git -C "$full_path" rev-parse --path-format=absolute --git-dir)" || { echo "Not a git repository: \`$full_path'." | tee /dev/stderr; exit 1; }