| 1 | #!/sbin/openrc-run |
| 2 | |
| 3 | # fallback values for /etc/conf.d/knot-git |
| 4 | : ${command_user:=git:git} |
| 5 | : ${directory:=/var/lib/git} |
| 6 | |
| 7 | name=knot-git |
| 8 | description="Knot Git server for Tangled.org" |
| 9 | command="/usr/bin/knot-git" |
| 10 | command_args="server" |
| 11 | command_background=true |
| 12 | pidfile="/run/$name.pid" |
| 13 | |
| 14 | depend() { |
| 15 | need net |
| 16 | use dns logger |
| 17 | } |
| 18 | |
| 19 | start_pre() { |
| 20 | checkpath -d -o "$command_user" "$directory" |
| 21 | |
| 22 | if [ "$KNOT_REPO_SCAN_PATH" ]; then |
| 23 | checkpath -d -m 2775 -o "git:git" "$KNOT_REPO_SCAN_PATH" |
| 24 | fi |
| 25 | |
| 26 | if [ "$error_log" ]; then |
| 27 | output_log="$error_log" |
| 28 | checkpath -f -o "$command_user" "$output_log" |
| 29 | else |
| 30 | output_logger="logger -t $name -p daemon.info" |
| 31 | error_logger="logger -t $name -p daemon.error" |
| 32 | fi |
| 33 | } |