aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/keyringer/functions23
-rwxr-xr-xshare/keyringer/edit1
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index dd0de03..22f16f8 100644
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -112,22 +112,23 @@ function keyringer_set_tmpfile {
exit 1
fi
- mkdir -p $BASEDIR/tmp
-
if [ -z "$1" ]; then
template="$BASEDIR/tmp/keyringer.XXXXXXXXXX"
else
template="$BASEDIR/tmp/$1.XXXXXXXXXX"
fi
- TMPFILE="`mktemp $template`" || exit 1
+ mkdir -p $BASEDIR/tmp
+ keyringer_git_ignore 'tmp/*'
+
+ tmpfile="`mktemp $template`"
if [ "$?" != "0" ]; then
- echo "Error: can't set tmpfile $TMPFILE"
+ echo "Error: can't set tmpfile $tmpfile"
exit 1
fi
- echo $TMPFILE
+ echo $tmpfile
}
# Remove a temporary file
@@ -143,3 +144,15 @@ function keyringer_unset_tmpfile {
exit 1
fi
}
+
+# Add a pattern into gitignore
+function keyringer_git_ignore {
+ if [ ! -z "$BASEDIR/.gitignore" ]; then
+ echo $1 > $BASEDIR/.gitignore
+ keyringer_exec git $BASEDIR add .gitignore
+ else
+ if ! grep -q -e "^$1$" $BASEDIR/.gitignore; then
+ echo $1 >> $BASEDIR/.gitignore
+ fi
+ fi
+}
diff --git a/share/keyringer/edit b/share/keyringer/edit
index 153e236..b5cc4ae 100755
--- a/share/keyringer/edit
+++ b/share/keyringer/edit
@@ -8,6 +8,7 @@ LIB="`dirname $0`/../../lib/keyringer/functions"
source $LIB
# Config
+ACTIONS="`dirname $0`"
BASEDIR="$1"
FILE="`keyringer_filename $2`"
KEYDIR="$BASEDIR/keys"