nixos/ddclient: support all special characters in password

(cherry picked from commit f0bd0f3e4c)
This commit is contained in:
Felix Schröter
2021-12-03 12:22:47 +01:00
committed by Bjørn Forsman
parent af780ad9aa
commit 9c7491d3cf

View File

@@ -31,8 +31,8 @@ let
preStart = ''
install ${configFile} /run/${RuntimeDirectory}/ddclient.conf
${lib.optionalString (cfg.configFile == null) (if (cfg.passwordFile != null) then ''
password=$(head -n 1 ${cfg.passwordFile})
sed -i "s/^password=$/password=$password/" /run/${RuntimeDirectory}/ddclient.conf
password=$(printf "%q" "$(head -n 1 "${cfg.passwordFile}")")
sed -i "s|^password=$|password=$password|" /run/${RuntimeDirectory}/ddclient.conf
'' else ''
sed -i '/^password=$/d' /run/${RuntimeDirectory}/ddclient.conf
'')}