mynode/rootfs/standard/usr/bin/mynode-install-extra
2021-11-06 17:02:57 -05:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Note: This app will install things as the current user
set -e
source /usr/share/mynode/mynode_config.sh
source /usr/share/mynode/mynode_app_versions.sh
# Make sure we have an app argument
if [ "$#" -lt 1 ]; then
echo "Usage: mynode-install-extra <app_name>"
exit 1
fi
APP="$1"
# Skip for now, probably don't need to stop all servies and require reboot
# Shut down main services to save memory and CPU and stop app being reinstalled
#/usr/bin/mynode_stop_critical_services.sh
# Custom re-install steps
if [ "$APP" = "rust" ] || [ "$APP" = "cargo" ]; then
wget https://sh.rustup.rs -O /tmp/setup_rust.sh
/bin/bash /tmp/setup_rust.sh -y
elif [ "$APP" = "electrs" ]; then
mkdir -p /home/admin/download
cd /home/admin/download
rm -rf electrs-*.tar.gz
rm -rf electrs
URL="https://github.com/romanz/electrs/archive/refs/tags/v0.9.2.tar.gz"
if [ "$#" -eq 2 ]; then
URL="$2"
fi
wget $URL -O electrs.tar.gz
tar -xvf electrs.tar.gz
mv electrs-* electrs
cd electrs
cargo build --release
sudo install -g root -o root target/release/electrs /usr/bin/electrs
cd ~
else
echo "Dont know what to do for app: $APP"
exit
fi
sync
echo "Install Complete!"