nixos/openvpn: use writeShellScript
Previously the upScript would fail with
Syntax error: "(" unexpected (expecting "done")
on line 7 if /bin/sh is not bash.
This commit is contained in:
committed by
Robert Schütz
parent
2700684d64
commit
9e1d4dff3e
@@ -14,7 +14,6 @@ let
|
||||
path = makeBinPath (getAttr "openvpn-${name}" config.systemd.services).path;
|
||||
|
||||
upScript = ''
|
||||
#! /bin/sh
|
||||
export PATH=${path}
|
||||
|
||||
# For convenience in client scripts, extract the remote domain
|
||||
@@ -34,7 +33,6 @@ let
|
||||
'';
|
||||
|
||||
downScript = ''
|
||||
#! /bin/sh
|
||||
export PATH=${path}
|
||||
${optionalString cfg.updateResolvConf
|
||||
"${pkgs.update-resolv-conf}/libexec/openvpn/update-resolv-conf"}
|
||||
@@ -47,9 +45,9 @@ let
|
||||
${optionalString (cfg.up != "" || cfg.down != "" || cfg.updateResolvConf) "script-security 2"}
|
||||
${cfg.config}
|
||||
${optionalString (cfg.up != "" || cfg.updateResolvConf)
|
||||
"up ${pkgs.writeScript "openvpn-${name}-up" upScript}"}
|
||||
"up ${pkgs.writeShellScript "openvpn-${name}-up" upScript}"}
|
||||
${optionalString (cfg.down != "" || cfg.updateResolvConf)
|
||||
"down ${pkgs.writeScript "openvpn-${name}-down" downScript}"}
|
||||
"down ${pkgs.writeShellScript "openvpn-${name}-down" downScript}"}
|
||||
${optionalString (cfg.authUserPass != null)
|
||||
"auth-user-pass ${pkgs.writeText "openvpn-credentials-${name}" ''
|
||||
${cfg.authUserPass.username}
|
||||
|
||||
Reference in New Issue
Block a user