aboutsummaryrefslogtreecommitdiff
path: root/keyringer
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-01-05 13:30:01 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-01-05 13:30:01 -0200
commitfbc7b1b2c12079fbb7fd55430e8d2a29c214be81 (patch)
tree5aa6ac02ca79bba56c1a2c59e0a0b3d7eead5116 /keyringer
parent1b24dedf6c343a62166661322aa092494471a830 (diff)
downloadkeyringer-fbc7b1b2c12079fbb7fd55430e8d2a29c214be81.tar.gz
keyringer-fbc7b1b2c12079fbb7fd55430e8d2a29c214be81.tar.bz2
Checking if a folder is inside a git repository
Diffstat (limited to 'keyringer')
-rwxr-xr-xkeyringer20
1 files changed, 15 insertions, 5 deletions
diff --git a/keyringer b/keyringer
index ed95a09..b92c066 100755
--- a/keyringer
+++ b/keyringer
@@ -21,6 +21,7 @@
function keyringer_init {
BASEDIR="$3"
URL="$4"
+ RECIPIENTS="$BASEDIR/config/recipients"
# Parse
if [ -z "$BASEDIR" ]; then
@@ -39,10 +40,19 @@ function keyringer_init {
exit 1
fi
else
- mkdir -p $BASEDIR/{config,keys}
- echo "# Use entries in the form of 'john@doe.com XXXXXXXX" > $BASEDIR/config/recipients
- echo "" >> $BASEDIR/config/recipients
- chmod 600 $BASEDIR/config/recipients
+ if [ -e "$BASEDIR" ]; then
+ if [ ! -d "$BASEDIR/keys" ] || [ ! -e "$RECIPIENTS" ]; then
+ echo "Invalid keyring $BASEDIR: incomplete installation"
+ exit 1
+ fi
+ else
+ mkdir -p $BASEDIR/{config,keys}
+ echo "# Use entries in the form of 'john@doe.com XXXXXXXX" > $RECIPIENTS
+ echo "" >> $RECIPIENTS
+ fi
+
+ # Secure
+ chmod 600 $RECIPIENTS
fi
# Reparse basedir to force absolute folder
@@ -53,7 +63,7 @@ function keyringer_init {
echo "$KEYRING=\"$BASEDIR\"" >> $CONFIG
# Init
- if [ ! -d "BASEDIR/.git" ]; then
+ if ! keyringer_is_git $BASEDIR; then
keyringer_exec git $BASEDIR init
keyringer_exec git $BASEDIR add .
keyringer_exec git $BASEDIR commit -m Importing