mac fixes
This commit is contained in:
parent
740f518895
commit
471464905f
3 changed files with 23 additions and 16 deletions
|
|
@ -101,7 +101,7 @@ mktemp_in() {
|
||||||
json_value() {
|
json_value() {
|
||||||
local key="$1"
|
local key="$1"
|
||||||
if [ "$OS" = "Mac" ]; then
|
if [ "$OS" = "Mac" ]; then
|
||||||
echo "$2" | grep "\"${key}\"" | awk -F'"' '{print $4}' | head -1
|
echo "$2" | grep "\"${key}\"" | awk -F'"' '{print $4; exit}'
|
||||||
else
|
else
|
||||||
echo "$2" | grep -oP "\"${key}\": \"\\K[^\"]+"
|
echo "$2" | grep -oP "\"${key}\": \"\\K[^\"]+"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,13 @@ install_lnd() {
|
||||||
USER_HOME=$HOME
|
USER_HOME=$HOME
|
||||||
USER_NAME=$(whoami)
|
USER_NAME=$(whoami)
|
||||||
|
|
||||||
|
# LND data directory (Mac uses Application Support, Linux uses .lnd)
|
||||||
|
if [ "$OS" = "Mac" ]; then
|
||||||
|
LND_DIR="$USER_HOME/Library/Application Support/Lnd"
|
||||||
|
else
|
||||||
|
LND_DIR="$USER_HOME/.lnd"
|
||||||
|
fi
|
||||||
|
|
||||||
log "Checking latest LND version..."
|
log "Checking latest LND version..."
|
||||||
LND_VERSION=$(get_latest_release_tag "lightningnetwork/lnd")
|
LND_VERSION=$(get_latest_release_tag "lightningnetwork/lnd")
|
||||||
|
|
||||||
|
|
@ -80,23 +87,23 @@ install_lnd() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create .lnd directory if it doesn't exist
|
# Create LND data directory if it doesn't exist
|
||||||
mkdir -p $USER_HOME/.lnd
|
mkdir -p "$LND_DIR"
|
||||||
|
|
||||||
# Ensure lnd.conf exists.
|
# Ensure lnd.conf exists.
|
||||||
touch $USER_HOME/.lnd/lnd.conf
|
touch "$LND_DIR/lnd.conf"
|
||||||
|
|
||||||
# Check for and add default settings only if the keys are missing.
|
# Check for and add default settings only if the keys are missing.
|
||||||
grep -q "^bitcoin.mainnet=" $USER_HOME/.lnd/lnd.conf || echo "bitcoin.mainnet=true" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^bitcoin.mainnet=" "$LND_DIR/lnd.conf" || echo "bitcoin.mainnet=true" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^bitcoin.node=" $USER_HOME/.lnd/lnd.conf || echo "bitcoin.node=neutrino" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^bitcoin.node=" "$LND_DIR/lnd.conf" || echo "bitcoin.node=neutrino" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^neutrino.addpeer=neutrino.shock.network" $USER_HOME/.lnd/lnd.conf || echo "neutrino.addpeer=neutrino.shock.network" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^neutrino.addpeer=neutrino.shock.network" "$LND_DIR/lnd.conf" || echo "neutrino.addpeer=neutrino.shock.network" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^neutrino.addpeer=asia.blixtwallet.com" $USER_HOME/.lnd/lnd.conf || echo "neutrino.addpeer=asia.blixtwallet.com" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^neutrino.addpeer=asia.blixtwallet.com" "$LND_DIR/lnd.conf" || echo "neutrino.addpeer=asia.blixtwallet.com" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^neutrino.addpeer=europe.blixtwallet.com" $USER_HOME/.lnd/lnd.conf || echo "neutrino.addpeer=europe.blixtwallet.com" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^neutrino.addpeer=europe.blixtwallet.com" "$LND_DIR/lnd.conf" || echo "neutrino.addpeer=europe.blixtwallet.com" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^neutrino.addpeer=btcd.lnolymp.us" $USER_HOME/.lnd/lnd.conf || echo "neutrino.addpeer=btcd.lnolymp.us" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^neutrino.addpeer=btcd.lnolymp.us" "$LND_DIR/lnd.conf" || echo "neutrino.addpeer=btcd.lnolymp.us" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^neutrino.addpeer=btcd-mainnet.lightning.computer" $USER_HOME/.lnd/lnd.conf || echo "neutrino.addpeer=btcd-mainnet.lightning.computer" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^neutrino.addpeer=btcd-mainnet.lightning.computer" "$LND_DIR/lnd.conf" || echo "neutrino.addpeer=btcd-mainnet.lightning.computer" >> "$LND_DIR/lnd.conf"
|
||||||
grep -q "^fee.url=" $USER_HOME/.lnd/lnd.conf || echo "fee.url=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json" >> $USER_HOME/.lnd/lnd.conf
|
grep -q "^fee.url=" "$LND_DIR/lnd.conf" || echo "fee.url=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json" >> "$LND_DIR/lnd.conf"
|
||||||
|
|
||||||
chmod 600 $USER_HOME/.lnd/lnd.conf
|
chmod 600 "$LND_DIR/lnd.conf"
|
||||||
|
|
||||||
# Port conflict resolution.
|
# Port conflict resolution.
|
||||||
local lnd_port=9735
|
local lnd_port=9735
|
||||||
|
|
@ -108,8 +115,8 @@ install_lnd() {
|
||||||
lnd_port_new=$(find_available_port $lnd_port)
|
lnd_port_new=$(find_available_port $lnd_port)
|
||||||
log "Configuring LND to use new port $lnd_port_new."
|
log "Configuring LND to use new port $lnd_port_new."
|
||||||
|
|
||||||
sed_i '/^listen=/d' $USER_HOME/.lnd/lnd.conf
|
sed_i '/^listen=/d' "$LND_DIR/lnd.conf"
|
||||||
echo "listen=0.0.0.0:$lnd_port_new" >> $USER_HOME/.lnd/lnd.conf
|
echo "listen=0.0.0.0:$lnd_port_new" >> "$LND_DIR/lnd.conf"
|
||||||
log "LND configuration updated. The service will be restarted by the installer."
|
log "LND configuration updated. The service will be restarted by the installer."
|
||||||
else
|
else
|
||||||
log "Port $lnd_port is in use by a healthy LND service (assumed to be our own). No changes will be made."
|
log "Port $lnd_port is in use by a healthy LND service (assumed to be our own). No changes will be made."
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ install_nodejs_mac() {
|
||||||
|
|
||||||
# Get latest LTS version from Node.js
|
# Get latest LTS version from Node.js
|
||||||
local node_index=$(download_stdout "https://nodejs.org/dist/index.json")
|
local node_index=$(download_stdout "https://nodejs.org/dist/index.json")
|
||||||
local lts_version=$(echo "$node_index" | grep -o '"version":"v[0-9.]*","date":"[^"]*","files":\[[^]]*\],"npm":"[^"]*","v8":"[^"]*","uv":"[^"]*","zlib":"[^"]*","openssl":"[^"]*","modules":"[^"]*","lts":"[^"]*"' | grep -v '"lts":false' | head -1 | grep -o '"version":"v[^"]*"' | awk -F'"' '{print $4}')
|
local lts_version=$(echo "$node_index" | grep -o '"version":"v[0-9.]*"[^}]*"lts":"[^"]*"' | grep -v '"lts":false' | awk -F'"' '{print $4; exit}')
|
||||||
|
|
||||||
if [ -z "$lts_version" ]; then
|
if [ -z "$lts_version" ]; then
|
||||||
log "Failed to fetch Node.js LTS version."
|
log "Failed to fetch Node.js LTS version."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue