home
·
contact
·
privacy
projects
/
config
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ensure we don't get asked for SSH passphrase repeatedly in borg script.
[config]
/
all_new_2018
/
borg.sh
diff --git
a/all_new_2018/borg.sh
b/all_new_2018/borg.sh
index 759779564452f9b80a82ba9df9cfbe72ed16a586..8cf0c441d42f75b8ccab931716ffc651e0358fb9 100755
(executable)
--- a/
all_new_2018/borg.sh
+++ b/
all_new_2018/borg.sh
@@
-1,6
+1,5
@@
#!/bin/sh
set -e
#!/bin/sh
set -e
-set -x
standard_repo="borg"
config_file="${HOME}/.borgrepos"
standard_repo="borg"
config_file="${HOME}/.borgrepos"
@@
-15,6
+14,8
@@
usage() {
}
read_pw() {
}
read_pw() {
+ eval $(ssh-agent)
+ ssh-add
stty -echo
printf "Passphrase: "
read password
stty -echo
printf "Passphrase: "
read password
@@
-44,8
+45,8
@@
if [ "${first_arg}" = "init" ]; then
cat "${config_file}" >> "${tmp_file}"
cp "${tmp_file}" "${config_file}"
elif [ "${first_arg}" = "store" ]; then
cat "${config_file}" >> "${tmp_file}"
cp "${tmp_file}" "${config_file}"
elif [ "${first_arg}" = "store" ]; then
- if [
"$#" -lt
2 ]; then
- echo "Need
archive name and paths
to archive."
+ if [
! "$#" -eq
2 ]; then
+ echo "Need
precisely two arguments: archive name and path
to archive."
false
fi
archive_name=$1
false
fi
archive_name=$1
@@
-58,9
+59,9
@@
elif [ "${first_arg}" = "store" ]; then
continue
fi
repo="${line}:${standard_repo}"
continue
fi
repo="${line}:${standard_repo}"
- archive="${repo}::${archive_name}"
+ archive="${repo}::${archive_name}
-{utcnow:%Y-%m-%dT%H:%M}
"
echo "Creating archive: ${archive}"
echo "Creating archive: ${archive}"
- borg create --verbose --list "${archive}"
${to_backup}
+ borg create --verbose --list "${archive}"
"${to_backup}"
done
elif [ "${first_arg}" = "check" ]; then
if [ ! "$#" -eq 0 ]; then
done
elif [ "${first_arg}" = "check" ]; then
if [ ! "$#" -eq 0 ]; then