From 183829cf99b629a43e8f6d1033f627f9082b980e Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Thu, 27 Dec 2012 13:38:37 +0100 Subject: [PATCH] gogoclient: change working dir before starting otherwise state files are placed in / --- modules/services/networking/gogoclient.nix | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/services/networking/gogoclient.nix b/modules/services/networking/gogoclient.nix index 519c45a385a..7d742df97b0 100644 --- a/modules/services/networking/gogoclient.nix +++ b/modules/services/networking/gogoclient.nix @@ -59,13 +59,14 @@ in networking.enableIPv6 = true; boot.systemd.services.gogoclient = { - description = "ipv6 tunnel"; after = [ "network.target" ]; + requires = [ "network.target" ]; - preStart = let authMethod = if cfg.password == "" then "anonymous" else "any"; in - '' + unitConfig.RequiresMountsFor = "/var/lib/gogoc"; + + script = let authMethod = if cfg.password == "" then "anonymous" else "any"; in '' mkdir -p -m 700 /var/lib/gogoc cat ${pkgs.gogoclient}/share/${pkgs.gogoclient.name}/gogoc.conf.sample | \ ${pkgs.gnused}/bin/sed \ @@ -74,18 +75,12 @@ in -e "s|^server=.*|server=${cfg.server}|" \ -e "s|^auth_method=.*|auth_method=${authMethod}|" \ -e "s|^#log_file=|log_file=1|" > /var/lib/gogoc/gogoc.conf + cd /var/lib/gogoc + exec ${pkgs.gogoclient}/bin/gogoc -y -f /var/lib/gogoc/gogoc.conf ''; - - serviceConfig.ExecStart = "${pkgs.gogoclient}/bin/gogoc -y -f /var/lib/gogoc/gogoc.conf"; - - restartTriggers = attrValues cfg; - } // optionalAttrs cfg.autorun { - wantedBy = [ "ip-up.target" ]; - partOf = [ "ip-up.target" ]; - }; };