upgrade grpc binaries
This commit is contained in:
parent
ae31a2830d
commit
a01aae2b2e
5 changed files with 145 additions and 4083 deletions
|
|
@ -1,13 +1,22 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_VERSION="0.1.0"
|
||||
|
||||
cleanup() {
|
||||
echo "Cleaning up temporary files..."
|
||||
rm -f /tmp/*.sh
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
log_error() {
|
||||
log "ERROR: $1"
|
||||
log "Exiting with status $2"
|
||||
exit $2
|
||||
}
|
||||
|
||||
BASE_URL="https://raw.githubusercontent.com/shocknet/Lightning.Pub/master/scripts/"
|
||||
BASE_URL="https://raw.githubusercontent.com/shocknet/Lightning.Pub/fix-arm/scripts/"
|
||||
|
||||
modules=(
|
||||
"utils"
|
||||
|
|
@ -22,6 +31,8 @@ modules=(
|
|||
"extract_nprofile"
|
||||
)
|
||||
|
||||
echo "Script version $SCRIPT_VERSION"
|
||||
|
||||
for module in "${modules[@]}"; do
|
||||
wget -q "${BASE_URL}/${module}.sh" -O "/tmp/${module}.sh" || log_error "Failed to download ${module}.sh" 1
|
||||
source "/tmp/${module}.sh" || log_error "Failed to source ${module}.sh" 1
|
||||
|
|
@ -35,6 +46,7 @@ if [ "$OS" = "Mac" ]; then
|
|||
log "Handling macOS specific setup"
|
||||
handle_macos || log_error "macOS setup failed" 1
|
||||
else
|
||||
log "Starting LND installation..."
|
||||
lnd_output=$(install_lnd)
|
||||
install_result=$?
|
||||
|
||||
|
|
@ -42,7 +54,6 @@ else
|
|||
log_error "LND installation failed" $install_result
|
||||
fi
|
||||
|
||||
# Extract the LND status from the output
|
||||
lnd_status=$(echo "$lnd_output" | grep "LND_STATUS:" | cut -d':' -f2)
|
||||
|
||||
case $lnd_status in
|
||||
|
|
@ -52,16 +63,16 @@ else
|
|||
*) log "WARNING: Unexpected status from install_lnd: $lnd_status" ;;
|
||||
esac
|
||||
|
||||
install_nodejs || log_error "NodeJS installation failed" $?
|
||||
|
||||
pub_output=$(install_lightning_pub)
|
||||
install_result=$?
|
||||
|
||||
if [ $install_result -ne 0 ]; then
|
||||
log_error "Lightning.Pub installation failed" $install_result
|
||||
log "Starting Node.js installation..."
|
||||
install_nodejs
|
||||
nodejs_result=$?
|
||||
log "Node.js installation completed with status: $nodejs_result"
|
||||
if [ $nodejs_result -ne 0 ]; then
|
||||
log_error "NodeJS installation failed" $nodejs_result
|
||||
fi
|
||||
|
||||
# Extract the upgrade status from the output
|
||||
install_lightning_pub
|
||||
|
||||
pub_upgrade_status=$(echo "$pub_output" | grep "UPGRADE_STATUS:" | cut -d':' -f2)
|
||||
|
||||
if [ "$pub_upgrade_status" = "100" ]; then
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
install_lightning_pub() {
|
||||
|
||||
local upgrade_status=0
|
||||
|
||||
if [ "$EUID" -eq 0 ]; then
|
||||
|
|
@ -11,6 +12,29 @@ install_lightning_pub() {
|
|||
USER_NAME=$(whoami)
|
||||
fi
|
||||
|
||||
log "Checking for build essentials..."
|
||||
if [ "$OS" = "Linux" ]; then
|
||||
if command -v gcc &> /dev/null && command -v make &> /dev/null; then
|
||||
log "Build essentials already installed."
|
||||
else
|
||||
log "Installing build essentials..."
|
||||
if command -v apt-get &> /dev/null; then
|
||||
log "Using apt-get to install build-essential"
|
||||
sudo apt-get update > /dev/null 2>&1
|
||||
sudo apt-get install -y build-essential > /dev/null 2>&1
|
||||
elif command -v yum &> /dev/null; then
|
||||
log "Using yum to install Development Tools"
|
||||
sudo yum groupinstall -y "Development Tools" > /dev/null 2>&1
|
||||
else
|
||||
log "Unable to install build essentials. Neither apt-get nor yum found."
|
||||
return 1
|
||||
fi
|
||||
log "Build essentials installation attempt completed."
|
||||
fi
|
||||
else
|
||||
log "Not on Linux, skipping build essentials check."
|
||||
fi
|
||||
|
||||
log "${PRIMARY_COLOR}Installing${RESET_COLOR} ${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR}..."
|
||||
REPO_URL="https://github.com/shocknet/Lightning.Pub/tarball/master"
|
||||
|
||||
|
|
@ -50,22 +74,29 @@ install_lightning_pub() {
|
|||
|
||||
log "${PRIMARY_COLOR}Installing${RESET_COLOR} npm dependencies..."
|
||||
|
||||
npm install > npm_install.log 2>&1
|
||||
npm install > npm_install.log
|
||||
npm_exit_code=$?
|
||||
|
||||
if [ $npm_exit_code -ne 0 ]; then
|
||||
log "${PRIMARY_COLOR}Failed to install npm dependencies. Check npm_install.log for details.${RESET_COLOR}"
|
||||
log "${PRIMARY_COLOR}Failed to install npm dependencies. Error details:${RESET_COLOR}"
|
||||
tail -n 20 npm_install.log | while IFS= read -r line; do
|
||||
log " $line"
|
||||
done
|
||||
log "${PRIMARY_COLOR}Full log available in $USER_HOME/lightning_pub/npm_install.log${RESET_COLOR}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules)" ]; then
|
||||
log "${PRIMARY_COLOR}npm install completed, but node_modules is empty or missing. Installation may have failed.${RESET_COLOR}"
|
||||
log "Checking npm_install.log for errors:"
|
||||
grep -i "error" npm_install.log | tail -n 10 | while IFS= read -r line; do
|
||||
log " $line"
|
||||
done
|
||||
log "${PRIMARY_COLOR}Full log available in $USER_HOME/lightning_pub/npm_install.log${RESET_COLOR}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log "npm dependencies installed successfully."
|
||||
|
||||
# Echo a specific string followed by the upgrade status
|
||||
echo "UPGRADE_STATUS:$upgrade_status"
|
||||
return 0 # Always return 0 to indicate success
|
||||
return 0
|
||||
}
|
||||
|
|
@ -26,9 +26,11 @@ install_nodejs() {
|
|||
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_VERSION=$(node -v | sed 's/v//')
|
||||
log "Current Node.js version: $NODE_VERSION"
|
||||
if [ "$(printf '%s\n' "$MINIMUM_VERSION" "$NODE_VERSION" | sort -V | head -n1)" = "$MINIMUM_VERSION" ]; then
|
||||
log "Node.js is already installed and meets the minimum version requirement."
|
||||
return
|
||||
log "Exiting install_nodejs function with status 0"
|
||||
return 0
|
||||
else
|
||||
log "${PRIMARY_COLOR}Updating${RESET_COLOR} Node.js to the LTS version..."
|
||||
fi
|
||||
|
|
@ -36,10 +38,14 @@ install_nodejs() {
|
|||
log "Node.js is not installed. ${PRIMARY_COLOR}Installing the LTS version...${RESET_COLOR}"
|
||||
fi
|
||||
|
||||
sudo -u $USER_NAME bash -c "source ${NVM_DIR}/nvm.sh && nvm install --lts" || {
|
||||
log "Attempting to install/update Node.js..."
|
||||
if ! sudo -u $USER_NAME bash -c "source ${NVM_DIR}/nvm.sh && nvm install --lts"; then
|
||||
log "${PRIMARY_COLOR}Failed to install Node.js.${RESET_COLOR}"
|
||||
exit 1
|
||||
}
|
||||
log "Exiting install_nodejs function with status 1"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log "Node.js LTS installation completed."
|
||||
log "Exiting install_nodejs function with status 0"
|
||||
return 0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue