#! /bin/sh # # post-darcs # # Simple cgi-bin script applying changes via HTTP POST # # Used with darcs-apply-http # # # Author: Pekka Pessi # # This software is copyright (C) 2007 Pekka Pessi. # This software is copyright (C) 2007 Nokia Corporation. All Rights Reserved. # # You are free to distribute this software under the terms of # the GNU General Public License version 2 or later. # # See the file GPL for more details. # repos=/var/www/repos # More secure (?) location for keyrings keyrings=/var/lib/dah/keyrings umask 007 echo "Content-Type: text/plain" echo query="`echo "$QUERY_STRING" | sed 's/&.*$//; s-%2F-/-; s,[^-A-Za-z0-9/]/,,g; s-^/*--;'`" repodir="$repos/$query" prefs="$repodir/_darcs/prefs/" test -n "$query" || { echo "$QUERY_STRING: no repository"; exit ; } test -d "$prefs" || { echo "$query: no such repository"; exit ; } test -r "$prefs/apply-url" || { echo "$query: invalid repository"; exit ; } cd "$repodir" || { echo "$query: cannot access repository"; exit ; } echo "post-darcs: verifying and applying" if test -r "$keyrings/$query" ; then verify="--verify=$keyrings/$query" elif test -r "$prefs/keyring" ; then verify=--verify="$prefs/keyring" else verify=--dry-run fi exec 2>&1 # gpg wants to write to ~/.gnupg/trustdb. bad gpg GNUPGHOME="$prefs" export GNUPGHOME darcs apply $verify