mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-20 04:37:19 +02:00
* #2703 dont delete RTL config * #2703 move RTL config to HDD * fix config exists detection
This commit is contained in:
@@ -184,6 +184,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
sudo ufw allow $((RTLHTTP+1)) comment "${systemdService} HTTPS"
|
sudo ufw allow $((RTLHTTP+1)) comment "${systemdService} HTTPS"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
# make sure config directory exists
|
||||||
|
sudo mkdir -p /mnt/hdd/app-data/rtl 2>/dev/null
|
||||||
|
sudo chown -R rtl:rtl /mnt/hdd/app-data/rtl
|
||||||
|
|
||||||
echo "# Create Systemd Service: ${systemdService}.service (Template)"
|
echo "# Create Systemd Service: ${systemdService}.service (Template)"
|
||||||
echo "
|
echo "
|
||||||
# Systemd unit for ${systemdService}
|
# Systemd unit for ${systemdService}
|
||||||
@@ -194,7 +198,7 @@ Wants=
|
|||||||
After=
|
After=
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=\"RTL_CONFIG_PATH=/home/rtl/${systemdService}/\"
|
Environment=\"RTL_CONFIG_PATH=/mnt/hdd/app-data/rtl/${systemdService}/\"
|
||||||
ExecStartPre=-/home/admin/config.scripts/bonus.rtl.sh prestart ${LNTYPE} ${CHAIN}
|
ExecStartPre=-/home/admin/config.scripts/bonus.rtl.sh prestart ${LNTYPE} ${CHAIN}
|
||||||
ExecStart=/usr/bin/node /home/rtl/RTL/rtl
|
ExecStart=/usr/bin/node /home/rtl/RTL/rtl
|
||||||
User=rtl
|
User=rtl
|
||||||
@@ -359,20 +363,26 @@ if [ "$1" = "prestart" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# prepare RTL-Config.json file
|
# prepare RTL-Config.json file
|
||||||
echo "# PREPARE /home/rtl/${systemdService}/RTL-Config.json"
|
echo "# PREPARE /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json"
|
||||||
# make and clean directory
|
|
||||||
mkdir -p /home/rtl/${systemdService}
|
# make sure directory exists
|
||||||
rm -f /home/rtl/${systemdService}/RTL-Config.json 2>/dev/null
|
mkdir -p /mnt/hdd/app-data/rtl/${systemdService} 2>/dev/null
|
||||||
# copy template
|
|
||||||
cp /home/rtl/RTL/docs/Sample-RTL-Config.json /home/rtl/${systemdService}/RTL-Config.json
|
# check if RTL-Config.json exists
|
||||||
chmod 600 /home/rtl/${systemdService}/RTL-Config.json
|
configExists=$(ls /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json 2>/dev/null | grep -c "RTL-Config.json")
|
||||||
|
if [ "${configExists}" == "0" ]; then
|
||||||
|
# copy template
|
||||||
|
cp /home/rtl/RTL/docs/Sample-RTL-Config.json /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
|
||||||
|
chmod 600 /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
|
||||||
|
fi
|
||||||
|
|
||||||
# LND changes of config
|
# LND changes of config
|
||||||
if [ "${LNTYPE}" == "lnd" ]; then
|
if [ "${LNTYPE}" == "lnd" ]; then
|
||||||
echo "# LND Config"
|
echo "# LND Config"
|
||||||
cat /home/rtl/${systemdService}/RTL-Config.json | \
|
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json | \
|
||||||
jq ".port = \"${RTLHTTP}\"" | \
|
jq ".port = \"${RTLHTTP}\"" | \
|
||||||
jq ".multiPass = \"${RPCPASSWORD}\"" | \
|
jq ".multiPass = \"${RPCPASSWORD}\"" | \
|
||||||
|
jq ".multiPassHashed = \"\"" | \
|
||||||
jq ".nodes[0].lnNode = \"${hostname}\"" | \
|
jq ".nodes[0].lnNode = \"${hostname}\"" | \
|
||||||
jq ".nodes[0].lnImplementation = \"LND\"" | \
|
jq ".nodes[0].lnImplementation = \"LND\"" | \
|
||||||
jq ".nodes[0].Authentication.macaroonPath = \"/home/rtl/.lnd/data/chain/${network}/${CHAIN}/\"" | \
|
jq ".nodes[0].Authentication.macaroonPath = \"/home/rtl/.lnd/data/chain/${network}/${CHAIN}/\"" | \
|
||||||
@@ -381,18 +391,19 @@ if [ "$1" = "prestart" ]; then
|
|||||||
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
|
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
|
||||||
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
|
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
|
||||||
jq ".nodes[0].Settings.lnServerUrl = \"https://localhost:${portprefix}8080\"" | \
|
jq ".nodes[0].Settings.lnServerUrl = \"https://localhost:${portprefix}8080\"" | \
|
||||||
jq ".nodes[0].Settings.channelBackupPath = \"/home/rtl/${systemdService}-SCB-backup-$hostname\"" | \
|
jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \
|
||||||
jq ".nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /home/rtl/${systemdService}/RTL-Config.json.tmp
|
jq ".nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
|
||||||
mv /home/rtl/${systemdService}/RTL-Config.json.tmp /home/rtl/${systemdService}/RTL-Config.json
|
mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# C-Lightning changes of config
|
# C-Lightning changes of config
|
||||||
# https://github.com/Ride-The-Lightning/RTL/blob/master/docs/C-Lightning-setup.md
|
# https://github.com/Ride-The-Lightning/RTL/blob/master/docs/C-Lightning-setup.md
|
||||||
if [ "${LNTYPE}" == "cl" ]; then
|
if [ "${LNTYPE}" == "cl" ]; then
|
||||||
echo "# CL Config"
|
echo "# CL Config"
|
||||||
cat /home/rtl/${systemdService}/RTL-Config.json | \
|
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json | \
|
||||||
jq ".port = \"${RTLHTTP}\"" | \
|
jq ".port = \"${RTLHTTP}\"" | \
|
||||||
jq ".multiPass = \"${RPCPASSWORD}\"" | \
|
jq ".multiPass = \"${RPCPASSWORD}\"" | \
|
||||||
|
jq ".multiPassHashed = \"\"" | \
|
||||||
jq ".nodes[0].lnNode = \"${hostname}\"" | \
|
jq ".nodes[0].lnNode = \"${hostname}\"" | \
|
||||||
jq ".nodes[0].lnImplementation = \"CLT\"" | \
|
jq ".nodes[0].lnImplementation = \"CLT\"" | \
|
||||||
jq ".nodes[0].Authentication.macaroonPath = \"/home/bitcoin/c-lightning-REST/certs\"" | \
|
jq ".nodes[0].Authentication.macaroonPath = \"/home/bitcoin/c-lightning-REST/certs\"" | \
|
||||||
@@ -401,9 +412,9 @@ if [ "$1" = "prestart" ]; then
|
|||||||
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
|
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
|
||||||
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
|
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
|
||||||
jq ".nodes[0].Settings.lnServerUrl = \"https://localhost:${portprefix}6100\"" | \
|
jq ".nodes[0].Settings.lnServerUrl = \"https://localhost:${portprefix}6100\"" | \
|
||||||
jq ".nodes[0].Settings.channelBackupPath = \"/home/rtl/${systemdService}-SCB-backup-$hostname\"" | \
|
jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \
|
||||||
jq ".nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /home/rtl/${systemdService}/RTL-Config.json.tmp
|
jq ".nodes[0].Settings.swapServerUrl = \"https://localhost:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
|
||||||
mv /home/rtl/${systemdService}/RTL-Config.json.tmp /home/rtl/${systemdService}/RTL-Config.json
|
mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# RTL prestart config done"
|
echo "# RTL prestart config done"
|
||||||
|
Reference in New Issue
Block a user