Don't store future passwords after store

This commit is contained in:
Bob Mottram 2016-11-23 12:17:47 +00:00
parent bb7f71eedc
commit 5ff2e50dfe
1 changed files with 10 additions and 1 deletions

View File

@ -50,6 +50,9 @@ REMOVE_APP=
CURR_PASSWORD="" CURR_PASSWORD=""
TESTS= TESTS=
# If this file is present then don't store passwords
NO_PASSWORD_STORE_FILE=~/.nostore
function get_backup_key_id { function get_backup_key_id {
MY_BACKUP_KEY_ID=$(gpg --list-keys "(backup key)" | \ MY_BACKUP_KEY_ID=$(gpg --list-keys "(backup key)" | \
grep 'pub ' | awk -F ' ' '{print $2}' | \ grep 'pub ' | awk -F ' ' '{print $2}' | \
@ -135,7 +138,10 @@ function clear_passwords {
rm -rf /root/.passwords/$USERNAME rm -rf /root/.passwords/$USERNAME
fi fi
done done
echo $'Passwords cleared' if [ ! -f $NO_PASSWORD_STORE_FILE ]; then
touch $NO_PASSWORD_STORE_FILE
fi
echo $'Passwords cleared. Future passwords will not be stored.'
exit 0 exit 0
} }
@ -233,6 +239,9 @@ if [ ${#CURR_PASSWORD} -eq 0 ]; then
fi fi
else else
# store password # store password
if [ -f $NO_PASSWORD_STORE_FILE ]; then
exit 0
fi
if [ ! -d ~/.passwords/$CURR_USERNAME ]; then if [ ! -d ~/.passwords/$CURR_USERNAME ]; then
mkdir -p ~/.passwords/$CURR_USERNAME mkdir -p ~/.passwords/$CURR_USERNAME
fi fi