diff options
Diffstat (limited to 'contrib/debian/bitcoind.postinst')
-rw-r--r-- | contrib/debian/bitcoind.postinst | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/debian/bitcoind.postinst b/contrib/debian/bitcoind.postinst new file mode 100644 index 0000000000..e9884f3e36 --- /dev/null +++ b/contrib/debian/bitcoind.postinst @@ -0,0 +1,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 |