aboutsummaryrefslogtreecommitdiff
path: root/contrib/debian/bitcoind.postinst
blob: e9884f3e3603211a730cc3be705fb4c4abeb0126 (plain)
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
#!/bin/sh

# setup bitcoin account, homedir etc

set -e

BCUSER="bitcoin"
BCHOME="/var/lib/bitcoin"

if [ "$1" = "configure" ]; then

	# Add bitcoin user/group - this will gracefully abort if the user already exists.
	# A homedir is never created.
	adduser --system --home "${BCHOME}" --no-create-home --group "${BCUSER}"

	# If the homedir does not already exist, create it with proper
	# ownership and permissions.
	if [ ! -d "${BCHOME}" ]; then
		mkdir -m 0750 -p "${BCHOME}"
		chown "${BCUSER}:${BCUSER}" "${BCHOME}"
	fi

fi

#DEBHELPER#

exit 0