diff options
author | Sanoob Pattanath <1174257+pshanoop@users.noreply.github.com> | 2022-12-21 20:28:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-22 00:58:10 +0530 |
commit | b842815fafa891a69cae8ac5a9e85b599cc1476b (patch) | |
tree | 35058e78cf457b7e119e6975d061e396daadf8a4 | |
parent | 8758a09345f6eef24764de4a0efad737f12562c8 (diff) |
fix: parse new gopass config output
* Update gopass config for version 1.15+
Gopass 1.15+ uses gitconfig format, so fixes the parser for it.
* Remove debug lines
-rwxr-xr-x | tessen | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -68,33 +68,33 @@ get_gopass_files() { # do, we parse the list of all the files inside the dir and store them in # an associative array with the name of the files as the index and the path # as the value - if [[ $line == path* ]] && [[ -d ${line#* } ]]; then - path_files=("${line#* }"/**/*.gpg) - path_files=("${path_files[@]#"${line#* }"/}") + if [[ $line == mounts.path* ]] && [[ -d ${line#*= } ]]; then + path_files=("${line#*= }"/**/*.gpg) + path_files=("${path_files[@]#"${line#*= }"/}") path_files=("${path_files[@]%.gpg}") for file in "${path_files[@]}"; do - tmp_gopass_files["$file"]="${line#* }" + tmp_gopass_files["$file"]="${line#*= }" done fi # similarly, we go through the mount points, generate the list of files # inside those mount points, add those files to the associative array with # the file names as the index and the location of the mount point as the # value - if [[ $line == mount* ]]; then + if [[ $line == mounts.*.path* ]]; then # remove the quotes from the parsed line line="${line//\"/}" # the mount name needs to be extracted to distinguish files with # potentially identical names - mount_name="${line#mount *}" - mount_name="${mount_name% =>*}" + mount_name="${line#mounts*.}" + mount_name="${mount_name%.path*}" mount_name_arr+=("$mount_name") - if [[ -d ${line#*=> } ]]; then - path_files=("${line#*=> }"/**/*.gpg) - path_files=("${path_files[@]#"${line#*=> }"/}") + if [[ -d ${line#*= } ]]; then + path_files=("${line#*= }"/**/*.gpg) + path_files=("${path_files[@]#"${line#*= }"/}") path_files=("${path_files[@]%.gpg}") path_files=("${path_files[@]/#/"$mount_name/"}") for file in "${path_files[@]}"; do - tmp_gopass_files["$file"]="${line#*=> }" + tmp_gopass_files["$file"]="${line#*= }" done fi fi |