TOR: prevent creation of torPrivoxy.conf if Privoxy is disabled.

Patch by Russel O'Connor

svn path=/nixos/trunk/; revision=23862
This commit is contained in:
Evgeny Egorochkin 2010-09-19 15:40:03 +00:00
parent b9aa56969f
commit e5aea56bb5
1 changed files with 22 additions and 25 deletions

View File

@ -233,36 +233,33 @@ in
home = stateDir;
};
jobs.tor =
{ name = "tor";
jobs = {
tor = { name = "tor";
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
preStart =
''
mkdir -m 0755 -p ${stateDir}
chown ${torUser} ${stateDir}
'';
exec = "${tor}/bin/tor -f ${pkgs.writeText "torrc" cfg.config}";
};
preStart = ''
mkdir -m 0755 -p ${stateDir}
chown ${torUser} ${stateDir}
'';
exec = "${tor}/bin/tor -f ${pkgs.writeText "torrc" cfg.config}";
}; }
// optionalAttrs (cfg.client.privoxy.enable && cfg.client.enable) {
torPrivoxy = { name = "tor-privoxy";
jobs.torPrivoxy = mkIf (cfg.client.privoxy.enable && cfg.client.enable)
{ name = "tor-privoxy";
startOn = "starting tor";
stopOn = "stopping tor";
startOn = "starting tor";
stopOn = "stopping tor";
preStart = ''
mkdir -m 0755 -p ${privoxyDir}
chown ${torUser} ${privoxyDir}
preStart =
''
mkdir -m 0755 -p ${privoxyDir}
chown ${torUser} ${privoxyDir}
# Needed to run privoxy as an unprivileged user?
${modprobe}/sbin/modprobe capability || true
'';
exec = "${privoxy}/sbin/privoxy --no-daemon --user ${torUser} ${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
};
# Needed to run privoxy as an unprivileged user?
${modprobe}/sbin/modprobe capability || true
'';
exec = "${privoxy}/sbin/privoxy --no-daemon --user ${torUser} ${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
}; };
services.tor.config = ''
DataDirectory ${stateDir}