diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-01-05 13:30:01 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-01-05 13:30:01 -0200 |
commit | fbc7b1b2c12079fbb7fd55430e8d2a29c214be81 (patch) | |
tree | 5aa6ac02ca79bba56c1a2c59e0a0b3d7eead5116 /keyringer | |
parent | 1b24dedf6c343a62166661322aa092494471a830 (diff) | |
download | keyringer-fbc7b1b2c12079fbb7fd55430e8d2a29c214be81.tar.gz keyringer-fbc7b1b2c12079fbb7fd55430e8d2a29c214be81.tar.bz2 |
Checking if a folder is inside a git repository
Diffstat (limited to 'keyringer')
-rwxr-xr-x | keyringer | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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 |