diff options
author | Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> | 2020-01-21 16:04:54 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2020-01-22 06:11:02 +0300 |
commit | 4a99207a7427949202c449eb4aa78da5d9ae2d22 (patch) | |
tree | 03e0e0feb32cd3fa318c5fd193225c7a328b736d /etc | |
parent | 3af0c4651626140172816536ac782b8562958183 (diff) |
ncp-config: dont save passwordsv1.20.6
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/library.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/etc/library.sh b/etc/library.sh index dd9b4b47..461b2e5b 100644 --- a/etc/library.sh +++ b/etc/library.sh @@ -150,6 +150,7 @@ function run_app_unsafe() echo "" >> $log + clear_password_fields "$cfg_file" return "$ret" } @@ -278,6 +279,20 @@ function check_distro() return 1 } +function clear_password_fields() +{ + local cfg_file="$1" + local cfg="$(cat "$cfg_file")" + local len="$(jq '.params | length' <<<"$cfg")" + for (( i = 0 ; i < len ; i++ )); do + local type="$(jq -r ".params[$i].type" <<<"$cfg")" + local val="$( jq -r ".params[$i].value" <<<"$cfg")" + [[ "$type" == "password" ]] && val="" + cfg="$(jq -r ".params[$i].value=\"$val\"" <<<"$cfg")" + done + echo "$cfg" > "$cfg_file" +} + function apt_install() { apt-get update |