| 28 | |
| 29 | set torGroup tor |
| 30 | set torUser tor |
| 31 | |
| 32 | post-destroot { |
| 33 | xinstall -o tor -g tor -m 755 -d ${destroot}${prefix}/var/run/tor |
| 34 | destroot.keepdirs-append ${destroot}${prefix}/var/run/tor |
| 35 | system "chown -R tor:tor ${destroot}${prefix}/var/run/tor" |
| 36 | |
| 37 | xinstall -o tor -g tor -m 755 -d ${destroot}${prefix}/var/lib/tor |
| 38 | destroot.keepdirs-append ${destroot}${prefix}/var/lib/tor |
| 39 | system "chown -R tor:tor ${destroot}${prefix}/var/lib/tor" |
| 40 | } |
| 41 | |
| 42 | pre-configure { |
| 43 | addgroup ${torGroup} |
| 44 | adduser ${torUser} gid=[existsgroup ${torGroup}] |
| 45 | } |
| 46 | |
| 47 | platform darwin { |
| 48 | startupitem.create yes |
| 49 | startupitem.name Tor |
| 50 | startupitem.pidfile auto ${prefix}/var/run/tor/tor.pid |
| 51 | startupitem.logfile ${prefix}/var/log/tor.log |
| 52 | |
| 53 | startupitem.start "\${prefix}/bin/tor \\" |
| 54 | startupitem.start-append "\t\t--pidfile ${prefix}/var/run/tor/tor.pid \\" |
| 55 | startupitem.start-append "\t\t--datadirectory ${prefix}/var/lib/tor \\" |
| 56 | startupitem.start-append "\t\t--user ${torUser} \\" |
| 57 | startupitem.start-append "\t\t--group ${torGroup} 2>&1" |
| 58 | |
| 59 | startupitem.stop "if \[ -f \"${prefix}/var/run/tor/tor.pid\" \]; then" |
| 60 | startupitem.stop-append "\tkill `cat ${prefix}/var/run/tor/tor.pid` \\" |
| 61 | startupitem.stop-append "else" |
| 62 | startupitem.stop-append "\t/usr/bin/killall -SIGUSR1 tor 2>/dev/null" |
| 63 | startupitem.stop-append "fi" |
| 64 | } |