Update 'root/usr/libexec/apps/btcpayserver/btcpayserver.sh'

main
ben 1 year ago
parent 8d859e2403
commit 4dbb63cebe

@ -4,69 +4,68 @@ ACTION=${1}
shift 1 shift 1
get_image() { get_image() {
local IMAGE_NAME=$(uci get btcpayserver.@btcpayserver[0].image_name 2>/dev/null) IMAGE_NAME=$(uci get btcpayserver.@btcpayserver[0].image_name 2>/dev/null)
} }
do_install_detail() { do_install_detail() {
local config=$(uci get btcpayserver.@btcpayserver[0].config_path 2>/dev/null) config=$(uci get btcpayserver.@btcpayserver[0].config_path 2>/dev/null)
local port=$(uci get btcpayserver.@btcpayserver[0].port 2>/dev/null) port=$(uci get btcpayserver.@btcpayserver[0].port 2>/dev/null)
local IMAGE_NAME=$(uci get btcpayserver.@btcpayserver[0].image_name 2>/dev/null) IMAGE_NAME=$(uci get btcpayserver.@btcpayserver[0].image_name 2>/dev/null)
GEN_PASS=$(head -c14 /dev/urandom | tr -dc A-Za-z0-9) GEN_PASS=$(head -c14 /dev/urandom | tr -dc A-Za-z0-9)
GEN_PASS2=$(head -c14 /dev/urandom | tr -dc A-Za-z0-9) GEN_PASS2=$(head -c14 /dev/urandom | tr -dc A-Za-z0-9)
LAN_IP=$(uci get network.lan.ipaddr) LAN_IP=$(uci get network.lan.ipaddr)
LAN_IP="${LAN_IP%/*}" LAN_IP="${LAN_IP%/*}"
[ -z "$config" ] && { echo "config path is empty!"; exit 1; } [ -z "$config" ] && { echo "config path is empty!"; exit 1; }
[ -z "$port" ] && port=8888 [ -z "$port" ] && port=8888
[ -z "$IMAGE_NAME" ] && IMAGE_NAME=clightning [ -z "$IMAGE_NAME" ] && IMAGE_NAME=clightning
}
setup_btcpayserver() { setup_btcpayserver() {
git clone https://github.com/btcpayserver/btcpayserver-docker /opt/docker2/compose/btcpayserver/btcpayserver-docker/ git clone https://github.com/btcpayserver/btcpayserver-docker /opt/docker2/compose/btcpayserver/btcpayserver-docker/
touch /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh touch /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh
chmod +x /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh chmod +x /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh
cat > /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh <<EOF cat > /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh <<EOF
#!/bin/bash #!/bin/bash
export BTCPAY_HOST="${LAN_IP}" export BTCPAY_HOST="${LAN_IP}"
export NBITCOIN_NETWORK="${config}" export NBITCOIN_NETWORK="${config}"
export BTCPAYGEN_CRYPTO1="btc" export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s" export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s"
export BTCPAYGEN_REVERSEPROXY="nginx" export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_LIGHTNING="${IMAGE_NAME}" export BTCPAYGEN_LIGHTNING="${IMAGE_NAME}"
export BTCPAY_ENABLE_SSH=true export BTCPAY_ENABLE_SSH=true
export NOREVERSEPROXY_HTTP_PORT="${port}" export NOREVERSEPROXY_HTTP_PORT="${port}"
export BTCPAY_PROTOCOL="http" export BTCPAY_PROTOCOL="http"
export BTCPAYGEN_REVERSEPROXY="none" export BTCPAYGEN_REVERSEPROXY="none"
bash /opt/docker2/compose/btcpayserver/btcpayserver-docker/btcpay-setup.sh -i bash /opt/docker2/compose/btcpayserver/btcpayserver-docker/btcpay-setup.sh -i
EOF EOF
} }
if [ "\$(id -u)" -ne 0 ]; then if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root." echo "This script must be run as root."
exit 1 exit 1
fi fi
setup_btcpayserver setup_btcpayserver
EOF chmod +x /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh
chmod +x /opt/docker2/compose/btcpayserver/btcpayserver-docker/go.sh echo "Please open a terminal window and login via SSH to $LAN_IP"
echo "Please open a terminal window and login via SSH to $LAN_IP" echo "Copy paste the commands to finish the BTCpay server Install"
echo "Copy paste the commands to finish the BTCpay server Install" echo ".................Enter commands below......................"
echo ".................Enter commands below......................" echo "cd /opt/docker2/compose/btcpayserver/btcpayserver-docker"
echo "cd /opt/docker2/compose/btcpayserver/btcpayserver-docker" echo ". ./go.sh -i"
echo ". ./go.sh -i echo "..........................................................."
echo "..........................................................."
uci add shortcutmenu lists
uci add shortcutmenu lists uci set shortcutmenu.@lists[-1].webname="$IMAGE_NAME"
uci set shortcutmenu.@lists[-1].webname="$IMAGE_NAME" uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:$port"
uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:$port" uci set shortcutmenu.@lists[-1].webpath="/"
uci set shortcutmenu.@lists[-1].webpath="/" uci commit shortcutmenu
uci commit shortcutmenu
}
usage() { usage() {
echo "usage: $0 sub-command" echo "usage: $0 sub-command"
@ -103,5 +102,4 @@ case "${ACTION}" in
usage usage
exit 1 exit 1
;; ;;
esac esac
Loading…
Cancel
Save