blob: 9f89c61570ebeea6f6d087a45a5257666cdd9a48 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
_bc_user=bitcoin
_bc_group=bitcoin
post_install() {
_mkuser
chown -R $_bc_user:$_bc_group /etc/bitcoin /srv/bitcoin
printf "%b\n" "$bitcoin"
}
post_upgrade() {
_mkuser
chown -R $_bc_user:$_bc_group /etc/bitcoin /srv/bitcoin
printf "%b\n" "$bitcoin"
}
post_remove() {
_rmuser
rm -rf /srv/bitcoin
}
_mkuser() {
getent passwd $_bc_user &>/dev/null || {
echo -n "Creating bitcoin user... "
grep -E "^$_bc_group:" /etc/group >/dev/null || groupadd $_bc_group
useradd -m -d /etc/bitcoin -g $_bc_group -s /usr/bin/nologin $_bc_user 2>/dev/null
echo "done"
}
}
_rmuser() {
echo -n "Removing bitcoin user... "
userdel -rf $_bc_user 2>/dev/null
echo "done"
}
read -d '' bitcoin <<'EOF'
########################################################################
########################################################################
## ##
## Bitcoin Core ##
## ____________ ##
## ##
## To start bitcoin-core: ##
## ##
## # systemctl start bitcoin ##
## ##
## To communicate with bitcoin-core as a normal user: ##
## ##
## $ mkdir -p ~/.bitcoin ##
## $ cat > ~/.bitcoin/bitcoin.conf <<'EOF' ##
## rpcconnect=127.0.0.1 ##
## rpcport=8332 ##
## rpcuser=bitcoin ##
## rpcpassword=secret ##
## EOF ##
## ##
## $ bitcoin-cli getmininginfo ##
## ##
## Config: /etc/bitcoin/bitcoin.conf ##
## Blockchain: /srv/bitcoin ##
## Documentation: /usr/share/doc/bitcoin ##
## ##
########################################################################
########################################################################
EOF
|