diff options
author | Julien Dessaux | 2021-02-11 19:10:38 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-02-11 19:10:38 +0100 |
commit | 6e49d2b6c76bdc11c42fb292f7bdafc95e492d51 (patch) | |
tree | 36d95d04f7ae47e75a4334f0b06c931d43b7d2d6 /files/borg.fact | |
parent | Fixed borg backups on openbsd (diff) | |
download | borg-ansible-role-6e49d2b6c76bdc11c42fb292f7bdafc95e492d51.tar.gz borg-ansible-role-6e49d2b6c76bdc11c42fb292f7bdafc95e492d51.tar.bz2 borg-ansible-role-6e49d2b6c76bdc11c42fb292f7bdafc95e492d51.zip |
Revitalized the borg role
Diffstat (limited to '')
-rw-r--r-- | files/borg.fact | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/files/borg.fact b/files/borg.fact index ee6504c..a27d5b0 100644 --- a/files/borg.fact +++ b/files/borg.fact @@ -4,19 +4,21 @@ # ~~~~ ~~~~ # ############################################################################### -echo '{' +printf "{\n" if [ -e '/root/.ssh/borg.pub' ]; then - pubkey=`cat /root/.ssh/borg.pub | tr -d "\n"` - echo -ne ' "pubkey": "'$pubkey'"' - pubkey_prefix=",\n" + pubkey=`cat /root/.ssh/borg.pub | tr -d "\n"` + printf " \"pubkey\": \"$pubkey\"" + pubkey_prefix=",\n" fi if [ -e '/srv/borg/repos/' ]; then - echo -ne "${pubkey_prefix:-}"' "repos": {'"\n" - for repo in `ls /srv/borg/repos/`; do - id=`awk '/^id =/ {print $3}' /srv/borg/repos/${repo}/config` - echo -ne ${repo_prefix:-}' "'$repo'": "'$id'"' - repo_prefix=",\n" - done - echo -ne "\n }" + printf "${pubkey_prefix:-} \"repos\": {\n" + for repo in `ls /srv/borg/repos/`; do + if [ -e "/srv/borg/repos/${repo}/config" ]; then + id=`awk '/^id =/ {print $3}' /srv/borg/repos/${repo}/config` + printf "${repo_prefix:-} \"$repo\": \"$id\"" + repo_prefix=",\n" + fi + done + printf "\n }" fi -echo -ne "\n}" +printf "\n}" |