diff options
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 |