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