2021-11-06 21:02:40 +00:00
|
|
|
#!/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
|
2021-11-06 22:02:57 +00:00
|
|
|
if [ "$#" -lt 1 ]; then
|
2021-11-06 21:02:40 +00:00
|
|
|
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
|
2021-11-24 02:49:36 +00:00
|
|
|
/bin/bash /tmp/setup_rust.sh -y --default-toolchain none
|
|
|
|
sync
|
|
|
|
if [ -f $HOME/.cargo/env ]; then
|
|
|
|
# Remove old toolchains
|
|
|
|
source $HOME/.cargo/env
|
|
|
|
TOOLCHAINS=$(rustup toolchain list)
|
|
|
|
for toolchain in $TOOLCHAINS; do
|
|
|
|
if [[ "$toolchain" == *"linux"* ]] && [[ "$toolchain" != *"${RUST_VERSION}"* ]]; then
|
|
|
|
rustup toolchain remove $toolchain || true
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Install and use desired version
|
|
|
|
rustup install $RUST_VERSION
|
|
|
|
rustup default $RUST_VERSION
|
|
|
|
rustc --version
|
|
|
|
fi
|
2021-11-06 22:02:57 +00:00
|
|
|
elif [ "$APP" = "electrs" ]; then
|
2021-11-24 05:02:54 +00:00
|
|
|
source $HOME/.cargo/env
|
2021-11-06 22:02:57 +00:00
|
|
|
mkdir -p /home/admin/download
|
|
|
|
cd /home/admin/download
|
|
|
|
rm -rf electrs-*.tar.gz
|
|
|
|
rm -rf electrs
|
|
|
|
|
2021-11-21 23:14:00 +00:00
|
|
|
URL="https://github.com/romanz/electrs/archive/refs/tags/v0.9.3.tar.gz"
|
2021-11-06 22:02:57 +00:00
|
|
|
if [ "$#" -eq 2 ]; then
|
|
|
|
URL="$2"
|
|
|
|
fi
|
|
|
|
wget $URL -O electrs.tar.gz
|
|
|
|
tar -xvf electrs.tar.gz
|
|
|
|
mv electrs-* electrs
|
|
|
|
|
|
|
|
cd electrs
|
2021-11-24 02:49:36 +00:00
|
|
|
cargo +$RUST_VERSION build --release
|
2021-11-06 22:02:57 +00:00
|
|
|
sudo install -g root -o root target/release/electrs /usr/bin/electrs
|
|
|
|
cd ~
|
2021-11-06 21:02:40 +00:00
|
|
|
else
|
|
|
|
echo "Dont know what to do for app: $APP"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
sync
|
|
|
|
echo "Install Complete!"
|