minecraft-pi-reborn/scripts/install-dependencies.sh
TheBrokenRail 74ee75e12f
All checks were successful
CI / Build (AMD64) (push) Successful in 17m4s
CI / Build (ARM64) (push) Successful in 17m8s
CI / Build (ARMHF) (push) Successful in 11m6s
CI / Test (AMD64, Server) (push) Successful in 2m35s
CI / Test (ARM64, Client) (push) Successful in 3m27s
CI / Build Example Mods (push) Successful in 1m11s
CI / Test (ARM64, Server) (push) Successful in 26s
CI / Test (AMD64, Client) (push) Successful in 5m10s
CI / Test (ARMHF, Client) (push) Successful in 3m38s
CI / Test (ARMHF, Server) (push) Successful in 38s
CI / Release (push) Has been skipped
Some Fixes
2024-06-15 10:19:18 -04:00

100 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
set -e
# Don't Use Sudo When Running As Root
if [ "$(id -u)" -eq 0 ]; then
sudo() {
"$@"
}
fi
# Run APT
install_pkg() {
sudo apt-get install --no-install-recommends -y "$@"
}
# Build Dependencies
run_build() {
install_pkg \
`# Build System` \
git \
cmake \
ninja-build \
python3 \
python3-venv \
`# Host Dependencies Needed For Compile` \
libwayland-bin \
`# Compiler` \
"crossbuild-essential-$1" \
`# Main Dependencies` \
"libopenal-dev:$1" \
`# GLFW Dependencies` \
"libwayland-dev:$1" \
"libxkbcommon-dev:$1" \
"libx11-dev:$1" \
"libxcursor-dev:$1" \
"libxi-dev:$1" \
"libxinerama-dev:$1" \
"libxrandr-dev:$1" \
"libxext-dev:$1" \
`# Zenity Dependencies` \
"libgtk-3-dev:$1" \
"libglib2.0-dev:$1" \
`# AppStream Verification` \
appstream
# Install appimagetool
sudo rm -rf /opt/squashfs-root /opt/appimagetool /usr/local/bin/appimagetool
case "$(dpkg --print-architecture)" in
'armhf') APPIMAGE_ARCH='armhf';;
'arm64') APPIMAGE_ARCH='aarch64';;
'i386') APPIMAGE_ARCH='i686';;
'amd64') APPIMAGE_ARCH='x86_64';;
esac
sudo mkdir -p /opt
sudo wget -O /opt/appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${APPIMAGE_ARCH}.AppImage"
sudo chmod +x /opt/appimagetool
# Workaround AppImage Issues With Docker
sudo ./scripts/fix-appimage-for-docker.sh /opt/appimagetool
# Extract
cd /opt
sudo ./appimagetool --appimage-extract > /dev/null
sudo rm -f ./appimagetool
# Link
sudo mv ./squashfs-root ./appimagetool
sudo ln -s /opt/appimagetool/AppRun /usr/local/bin/appimagetool
}
# Test Dependencies
run_test() {
sudo apt-get install --no-install-recommends -y \
"libc6:$1" \
"libstdc++6:$1" \
"libopenal1:$1" \
"libglib2.0-0:$1"
}
# Example Mods Dependencies
run_example_mods() {
install_pkg \
cmake \
ninja-build \
g++-arm-linux-gnueabihf \
gcc-arm-linux-gnueabihf
}
# Variables
MODE="$1"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
# Add ARM Repository
sudo dpkg --add-architecture "${ARCH}"
# Update APT
sudo apt-get update
sudo apt-get dist-upgrade -y
# Install Packages
"run_${MODE}" "${ARCH}"