papermario/install.sh

64 lines
1.9 KiB
Bash
Raw Normal View History

2020-08-19 02:43:40 +02:00
#!/bin/bash
2020-08-17 18:49:59 +02:00
# Ubuntu
2020-08-20 17:54:19 +02:00
if command -v apt &> /dev/null; then
2020-08-17 18:49:59 +02:00
echo "Installing packages for Ubuntu"
2020-08-20 17:54:19 +02:00
sudo apt install -y git python3 python3-pip build-essential binutils-mips-linux-gnu zlib1g-dev libyaml-dev gcc-multilib || exit 1
python3 -m pip install -U -r requirements.txt
2020-08-17 18:49:59 +02:00
if [[ $1 == "--extra" ]]; then
echo "Installing extra"
2020-08-20 17:54:19 +02:00
sudo apt install -y clang-tidy astyle || exit 1
python3 -m pip install -U -r requirements_extra.txt || exit 1
2020-08-17 18:49:59 +02:00
fi
echo "Done"
exit
fi
# Arch
if command -v pacman &> /dev/null; then
echo "Installing packages for Arch"
# Upgrade existing packages (note: no --noconfirm)
sudo pacman -Syu || exit 1
# Install dependencies
2020-08-20 13:40:24 +02:00
sudo pacman -S --noconfirm --needed git python python-pip base-devel zlib libyaml lib32-glibc || exit 1
python3 -m pip install -U -r requirements.txt
2020-08-17 18:49:59 +02:00
# Install binutils if required
if ! command -v mips-linux-gnu-ar &> /dev/null; then
PKG="mips-linux-gnu-binutils"
if command -v aura &> /dev/null; then
sudo aura -A --noconfirm $PKG || exit 1
elif command -v yay &> /dev/null; then
yay -S --noconfirm $PKG || exit 1
elif command -v yaourt &> /dev/null; then
sudo yaourt -S --noconfirm $PKG || exit 1
else
echo "AUR manager not found, installing $PKG without one"
git clone "https://aur.archlinux.org/$PKG.git" || exit 1
cd $PKG
2020-08-17 19:09:42 +02:00
makepkg -si || exit 1
2020-08-17 18:49:59 +02:00
cd ..
rm -rf $PKG
fi
fi
if [[ $1 == "--extra" ]]; then
echo "Installing extra"
2020-08-20 13:40:24 +02:00
sudo pacman -S --noconfirm --needed clang astyle || exit 1
python3 -m pip install -U -r requirements_extra.txt || exit 1
2020-08-17 18:49:59 +02:00
fi
echo "Done"
exit
fi
echo "Only Ubuntu (apt) and Arch Linux (pacman) are supported by install.sh."
echo "Please consider contributing and adding an installation script for your distro."
exit 1