mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-18 08:48:27 -04:00
c780149083
Change rust message if already installed
39 lines
941 B
Plaintext
Executable File
39 lines
941 B
Plaintext
Executable File
#!/usr/bin/with-contenv bash
|
|
|
|
set -e
|
|
|
|
RUST_BINS_PATH="/rust-bins"
|
|
PACKAGES_TO_INSTALL_LIST="/mod-repo-packages-to-install.list"
|
|
|
|
ARCH=$(uname -m)
|
|
SUPPORTED_ARCHS=("x86_64" "aarch64")
|
|
|
|
if [[ ! " ${SUPPORTED_ARCHS[@]} " =~ " ${ARCH} " ]]; then
|
|
echo "**** unsupported architecture: $ARCH ****"
|
|
exit 1
|
|
fi
|
|
|
|
RUST_BINARY_ARCHIVE_PATH="$RUST_BINS_PATH/rust-$ARCH-gnu.tar.gz"
|
|
|
|
grep_os_release() {
|
|
grep -q "$1" /etc/os-release && true || false
|
|
}
|
|
|
|
if [[ -f "$RUST_BINARY_ARCHIVE_PATH" ]]; then
|
|
echo "**** unpacking rust tar ****"
|
|
tar -xzf "$RUST_BINARY_ARCHIVE_PATH" -C "$RUST_BINS_PATH" --strip-components=1
|
|
|
|
echo "**** installing rust ****"
|
|
"$RUST_BINS_PATH/install.sh"
|
|
rm -rf "$RUST_BINS_PATH"
|
|
|
|
echo "**** adding build tools ****"
|
|
if grep_os_release "debian"; then
|
|
echo "build-essential" >>"$PACKAGES_TO_INSTALL_LIST"
|
|
else
|
|
echo "gcc" >>"$PACKAGES_TO_INSTALL_LIST"
|
|
fi
|
|
else
|
|
echo "**** rust already installed ****"
|
|
fi
|