Commit bcb3ab60 authored by Ivan Vandot's avatar Ivan Vandot Committed by GitHub

remove templates, unify deb and rpm install and add bee-get-addr wrapper (#992)

parent fe7a64f8
......@@ -65,11 +65,14 @@ nfpms:
formats:
- deb
- rpm
files:
"packaging/bee.service": "/lib/systemd/system/bee.service"
"packaging/bee-get-addr": "/usr/bin/bee-get-addr"
config_files:
"packaging/bee.yaml": "/etc/bee/bee.yaml"
"packaging/default": "/etc/default/bee"
"packaging/bee.service": "/lib/systemd/system/bee.service"
overrides:
deb:
......@@ -90,8 +93,5 @@ nfpms:
postinstall: ./packaging/rpm/post
preremove: ./packaging/rpm/preun
postremove: ./packaging/rpm/postun
deb:
scripts:
templates: ./packaging/deb/templates
bindir: /usr/bin
#!/bin/sh
if [ ! `id -u` -eq 0 ] ; then
echo "
use sudo!
"
exit 1
fi
RESP=$(/usr/bin/bee init --config /etc/bee/bee.yaml 2>&1)
case "$RESP" in
Error*)
echo "
Enabled clef-signer but clef is not running.
Check https://docs.ethswarm.org/ for more info.
After you fix configuration run 'sudo bee-get-addr' again.
"
;;
*)
ETH_ADDRESS=$(echo "$RESP" | grep ethereum | cut -d' ' -f6 | tr -d '"')
echo "
Please make sure there is sufficient eth and bzz available on $ETH_ADDRESS address.
You can get both goerli eth and goerli bzz from https://faucet.ethswarm.org
After you get the funds start service with 'systemctl start bee.service'.
"
;;
esac
#!/bin/sh -e
if [ "$1" = "configure" ]; then
START=true
if [ -z "$2" ]; then
. /usr/share/debconf/confmodule
db_input high bee/ethereum-endpoint || true
if db_go; then
db_get bee/ethereum-endpoint
grep -v BEE_SWAP_ENDPOINT /etc/default/bee > /etc/default/bee.tmp
echo "BEE_SWAP_ENDPOINT=$RET" >> /etc/default/bee.tmp && mv /etc/default/bee.tmp /etc/default/bee
fi
# initial installation
if [ ! -f /var/lib/bee/keys/libp2p.key ]; then
/usr/bin/bee init --config /etc/bee/bee.yaml >/dev/null 2>&1
chown -R bee:bee /var/lib/bee/keys
fi
db_input high bee/clef-enable || true
if db_go; then
db_get bee/clef-enable
if [ "$RET" = true ]; then
grep -v BEE_CLEF_SIGNER_ENABLE /etc/default/bee > /etc/default/bee.tmp
echo "BEE_CLEF_SIGNER_ENABLE=true" >> /etc/default/bee.tmp && mv /etc/default/bee.tmp /etc/default/bee
fi
fi
set +e
RESP=$(BEE_CLEF_SIGNER_ENABLE=$RET /usr/bin/bee init --config /etc/bee/bee.yaml 2>&1)
set -e
case "$RESP" in
Error*)
START=false
echo "Enabled clef-signer but clef is not running."
echo "Check https://docs.ethswarm.org/ for more info and how to fix."
echo "Or install latest release of bee-clef from https://github.com/ethersphere/bee-clef and reinstall bee."
echo "Start bee with systemctl --no-reload start bee.service"
;;
*)
ETH_ADDRESS=$(echo "$RESP" | grep ethereum | cut -d' ' -f6 | tr -d '"')
echo "Please make sure there is sufficient eth and bzz available on $ETH_ADDRESS address."
echo "You can get both goerli eth and goerli bzz from https://faucet.ethswarm.org."
;;
esac
echo "
Bee has SWAP enabled by default and it needs ethereum endpoint to operate.
It is recommended to use external signer with bee.
Check documentation for more info https://docs.ethswarm.org/
After you finish configuration run 'sudo bee-get-addr'.
"
fi
# allow group members (bee user) to use clef's socket
if [ -S /var/lib/bee-clef/clef.ipc ]; then
chmod 660 /var/lib/bee-clef/clef.ipc
fi
......@@ -55,7 +30,8 @@ if [ "$1" = "configure" ]; then
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ $START = true ]; then
# upgrade
if [ ! -z "$2" ]; then
deb-systemd-invoke start bee.service >/dev/null || true
fi
fi
......
Template: bee/ethereum-endpoint
Type: string
Description: Set ethereum endpoint for bee.
Bee has SWAP enabled by default and needs ethereum endpoint to operate.
Template: bee/clef-enable
Type: boolean
Description: Do you want to enable clef support?
It is recommended to use external signer with bee. Bee has support for clef.
Download and install latest bee-clef release from https://github.com/ethersphere/bee-clef
if [ $1 -eq 1 ] ; then
# Initial installation
echo "Bee has SWAP enabled by default and needs ethereum endpoint to operate."
echo "Set ethereum endpoint for bee swap-endpoint inside /etc/bee/bee.yaml"
# initial installation
if [ ! -f /var/lib/bee/keys/libp2p.key ]; then
/usr/bin/bee init --config /etc/bee/bee.yaml >/dev/null 2>&1
chown -R bee:bee /var/lib/bee/keys
fi
echo "It is recommended to use external signer with bee. Bee has support for clef."
echo "Download and install latest bee-clef release from https://github.com/ethersphere/bee-clef"
echo "Enable external signer setting clef-signer-enable to true inside /etc/bee/bee.yaml"
if [ -f /var/lib/bee/keys/swarm.key ]; then
parse_json() { echo $1|sed -e 's/[{}]/''/g'|sed -e 's/", "/'\",\"'/g'|sed -e 's/" ,"/'\",\"'/g'|sed -e 's/" , "/'\",\"'/g'|sed -e 's/","/'\"---SEPERATOR---\"'/g'|awk -F=':' -v RS='---SEPERATOR---' "\$1~/\"$2\"/ {print}"|sed -e "s/\"$2\"://"|tr -d "\n\t"|sed -e 's/\\"/"/g'|sed -e 's/\\\\/\\/g'|sed -e 's/^[ \t]*//g'|sed -e 's/^"//' -e 's/"$//' ; }
echo "If you don't want to use external signer even if we recommended it."
echo "Please make sure there is sufficient eth and bzz available on $(parse_json $(cat /var/lib/bee/keys/swarm.key) address)"
echo "You can get both goerli eth and goerli bzz from https://faucet.ethswarm.org"
fi
systemctl --no-reload preset bee.service &>/dev/null || :
systemctl --no-reload enable bee.service &>/dev/null || :
echo "If you enabled external signer. Run"
echo "sudo /usr/bin/bee init --config /etc/bee/bee.yaml 2>&1 | grep ethereum | cut -d' ' -f6 | tr -d '\"'"
echo "Prefund that address at https://faucet.ethswarm.org"
echo "Service already enabled, after initial configuration."
echo "Start service with systemctl --no-reload start bee.service"
echo "
Bee has SWAP enabled by default and it needs ethereum endpoint to operate.
It is recommended to use external signer with bee.
Check documentation for more info https://docs.ethswarm.org/
After you finish configuration run 'sudo bee-get-addr'.
"
fi
# allow group members (bee user) to use clef's socket
if [ -S /var/lib/bee-clef/clef.ipc ]; then
chmod 660 /var/lib/bee-clef/clef.ipc
fi
if [ $1 -eq 2 ] ; then
# Upgrade
systemctl --no-reload restart bee.service &>/dev/null || :
# upgrade
systemctl --no-reload start bee.service &>/dev/null || :
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment