lbrycrd/contrib/debian/bitcoind.postinst
ctp-tsteenholdt 2a87b1b07c Add systemd service for bitcoind
Adding systemd service for bitcoind, to provide for a simpler
out-of-the-box experience.

Configuration file is /etc/bitcoin/bitcoin.conf. This file is a
copy of the sample configuration file.

The service user 'bitcoin' is added during install. Its homedir
is in '/var/lib/bitcoin'.

bitcoind.service is disabled by default to allow the user to
configure it, before starting it the first time.

On package purge, the 'bitcoin' user as well as its homedir is
left intact, to not accidentally remove a wallet or something of
equal importance. Instead the user is presented with information
on how to perform the cleanup manually, after making sure all
important data has been backed up.
2018-04-20 08:34:12 -02:00

27 lines
550 B
Bash

#!/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