File: prepare-environment

package info (click to toggle)
bird 1.6.8-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 4,516 kB
  • sloc: ansic: 43,639; sh: 3,364; perl: 2,022; lex: 678; makefile: 238; xml: 204; sed: 13
file content (28 lines) | stat: -rwxr-xr-x 521 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

set -eu

BIRD_RUN_DIR=/run/bird
. /etc/bird/envvars


mkdir --parents "$BIRD_RUN_DIR";

if [ -n "$BIRD_RUN_USER" ]; then
    if ! getent passwd $BIRD_RUN_USER >/dev/null; then
	echo "Configured user '$BIRD_RUN_USER' doesn't exist."
	exit 1
    fi
fi

if [ -n "$BIRD_RUN_GROUP" ]; then
    if ! getent group $BIRD_RUN_GROUP >/dev/null; then
	echo "Configured group '$BIRD_RUN_GROUP' doesn't exist."
	exit 1
    fi
fi

chown --silent "$BIRD_RUN_USER:$BIRD_RUN_GROUP" "$BIRD_RUN_DIR"
chmod 775 "$BIRD_RUN_DIR"

: