Improve errors in bootstrap scripts
This commit is contained in:
parent
7bec121856
commit
cb42d21c64
261
bootstrap.sh
261
bootstrap.sh
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# This function is simply a banner to introduce the script
|
# This function is simply a banner to introduce the script
|
||||||
##########################################################
|
##########################################################
|
||||||
|
@ -92,11 +94,15 @@ osx_macports()
|
||||||
|
|
||||||
install_macports_pkg "git"
|
install_macports_pkg "git"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
install_macports_pkg "qemu" "qemu-system-x86_64"
|
install_macports_pkg "qemu" "qemu-system-x86_64"
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
install_macports_pkg "virtualbox"
|
install_macports_pkg "virtualbox"
|
||||||
fi
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
install_macports_pkg "coreutils"
|
install_macports_pkg "coreutils"
|
||||||
install_macports_pkg "findutils"
|
install_macports_pkg "findutils"
|
||||||
|
@ -161,11 +167,15 @@ osx_homebrew()
|
||||||
|
|
||||||
install_brew_pkg "git"
|
install_brew_pkg "git"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
install_brew_pkg "qemu" "qemu-system-x86_64"
|
install_brew_pkg "qemu" "qemu-system-x86_64"
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
install_brew_pkg "virtualbox"
|
install_brew_pkg "virtualbox"
|
||||||
fi
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
install_brew_pkg "automake"
|
install_brew_pkg "automake"
|
||||||
install_brew_pkg "bison"
|
install_brew_pkg "bison"
|
||||||
|
@ -221,18 +231,21 @@ osx_homebrew()
|
||||||
###############################################################################
|
###############################################################################
|
||||||
freebsd()
|
freebsd()
|
||||||
{
|
{
|
||||||
set -xe
|
set -x
|
||||||
echo "FreeBSD detected!"
|
echo "FreeBSD detected!"
|
||||||
echo "Installing missing packages..."
|
echo "Installing missing packages..."
|
||||||
|
|
||||||
install_freebsd_pkg "git"
|
install_freebsd_pkg "git"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
|
||||||
install_freebsd_pkg "qemu" "qemu-system-x86_64"
|
|
||||||
else
|
|
||||||
install_freebsd_pkg "virtualbox"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
|
install_freebsd_pkg "qemu" "qemu-system-x86_64"
|
||||||
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
|
install_freebsd_pkg "virtualbox"
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
install_freebsd_pkg "coreutils"
|
install_freebsd_pkg "coreutils"
|
||||||
install_freebsd_pkg "findutils"
|
install_freebsd_pkg "findutils"
|
||||||
install_freebsd_pkg "gcc"
|
install_freebsd_pkg "gcc"
|
||||||
|
@ -277,7 +290,7 @@ freebsd()
|
||||||
install_freebsd_pkg "scons"
|
install_freebsd_pkg "scons"
|
||||||
install_freebsd_pkg "lua54"
|
install_freebsd_pkg "lua54"
|
||||||
install_freebsd_pkg "py-protobuf-compiler"
|
install_freebsd_pkg "py-protobuf-compiler"
|
||||||
set +xe
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -330,12 +343,15 @@ archLinux()
|
||||||
lua \
|
lua \
|
||||||
ant \
|
ant \
|
||||||
protobuf"
|
protobuf"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
packages="$packages qemu"
|
packages="$packages qemu"
|
||||||
elif [ "$1" == "virtualbox" ]; then
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
packages="$packages virtualbox"
|
packages="$packages virtualbox"
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Scripts should not cause a system update in order to just install a couple
|
# Scripts should not cause a system update in order to just install a couple
|
||||||
# of packages. If pacman -S --needed is going to fail, let it fail and the
|
# of packages. If pacman -S --needed is going to fail, let it fail and the
|
||||||
# user will figure out the issues (without updating if required) and rerun
|
# user will figure out the issues (without updating if required) and rerun
|
||||||
|
@ -424,13 +440,25 @@ ubuntu()
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Installing VirtualBox..."
|
|
||||||
sudo "$2" install virtualbox
|
if grep '^ID=debian$' /etc/os-release > /dev/null; then
|
||||||
|
echo "Virtualbox is not in the official debian packages"
|
||||||
|
echo "To install virtualbox on debian, see https://wiki.debian.org/VirtualBox"
|
||||||
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
|
echo "or run with -e qemu"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Installing VirtualBox..."
|
||||||
|
sudo "$2" install virtualbox
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "VirtualBox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,6 +474,7 @@ fedora()
|
||||||
echo "Installing git..."
|
echo "Installing git..."
|
||||||
sudo dnf install git-all
|
sudo dnf install git-all
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
echo "Installing QEMU..."
|
echo "Installing QEMU..."
|
||||||
|
@ -453,14 +482,19 @@ fedora()
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Installing VirtualBox..."
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
sudo dnf install virtualbox
|
echo "or run with -e qemu"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "VirtualBox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use rpm -q <package> to check if it's already installed
|
# Use rpm -q <package> to check if it's already installed
|
||||||
PKGS=$(for pkg in file \
|
PKGS=$(for pkg in file \
|
||||||
autoconf \
|
autoconf \
|
||||||
|
@ -531,71 +565,127 @@ fedora()
|
||||||
suse()
|
suse()
|
||||||
{
|
{
|
||||||
echo "Detected SUSE Linux"
|
echo "Detected SUSE Linux"
|
||||||
|
|
||||||
|
packages=(
|
||||||
|
"gcc"
|
||||||
|
"gcc-c++"
|
||||||
|
"glibc-devel-32bit"
|
||||||
|
"nasm"
|
||||||
|
"make"
|
||||||
|
"fuse-devel"
|
||||||
|
"cmake"
|
||||||
|
"openssl"
|
||||||
|
"automake"
|
||||||
|
"gettext-tools"
|
||||||
|
"libtool"
|
||||||
|
"po4a"
|
||||||
|
"patch"
|
||||||
|
"flex"
|
||||||
|
"gperf"
|
||||||
|
"autoconf"
|
||||||
|
"bison"
|
||||||
|
"curl"
|
||||||
|
"wget"
|
||||||
|
"file"
|
||||||
|
"libexpat-devel"
|
||||||
|
"gmp-devel"
|
||||||
|
"libpng16-devel"
|
||||||
|
"libjpeg8-devel"
|
||||||
|
"perl"
|
||||||
|
"perl-HTML-Parser"
|
||||||
|
"m4"
|
||||||
|
"patch"
|
||||||
|
"scons"
|
||||||
|
"pkgconf"
|
||||||
|
"syslinux-utils"
|
||||||
|
"ninja"
|
||||||
|
"meson"
|
||||||
|
"python-Mako"
|
||||||
|
"xdg-utils"
|
||||||
|
"zip"
|
||||||
|
"unzip"
|
||||||
|
"llvm"
|
||||||
|
"clang"
|
||||||
|
"doxygen"
|
||||||
|
"lua54"
|
||||||
|
"ant"
|
||||||
|
"protobuf"
|
||||||
|
)
|
||||||
|
|
||||||
if [ -z "$(which git)" ]; then
|
if [ -z "$(which git)" ]; then
|
||||||
echo "Installing git..."
|
echo "Will install git ..."
|
||||||
zypper install git
|
packages+=(git)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
echo "Installing QEMU..."
|
echo "Will install QEMU..."
|
||||||
sudo zypper install qemu-x86 qemu-kvm
|
packages+=(qemu-x86 qemu-kvm)
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Please install VirtualBox and re-run this script,"
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
echo "or run with -e qemu"
|
echo "or run with -e qemu"
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
echo "VirtualBox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing necessary build tools..."
|
echo "Installing necessary build tools..."
|
||||||
sudo zypper install \
|
|
||||||
gcc \
|
# We could install all the packages in a single zypper command with:
|
||||||
gcc-c++ \
|
#
|
||||||
glibc-devel-32bit \
|
# zypper install package1 package2 package3
|
||||||
nasm \
|
#
|
||||||
make \
|
# But there is an issue with this: zypper returns a success code if at
|
||||||
fuse-devel \
|
# least one of the packages was correctly installed, but we need it to fail
|
||||||
cmake \
|
# if any of the packages is missing.
|
||||||
openssl \
|
#
|
||||||
automake \
|
# To confirm that the packages are available, we try to install them one by
|
||||||
gettext-tools \
|
# one with --dry-run.
|
||||||
libtool \
|
# We still install all the packages in a single zypper command so that the
|
||||||
po4a \
|
# user has to confirm only once.
|
||||||
patch \
|
for p in ${packages[@]}; do
|
||||||
flex \
|
if rpm -q "${p}" > /dev/null ; then
|
||||||
gperf \
|
echo "${p} is already installed"
|
||||||
autoconf \
|
else
|
||||||
bison \
|
# Zypper shows a confirmation prompt and the "y" answer even with
|
||||||
curl \
|
# --non-interactive and --no-confirm:
|
||||||
wget \
|
#
|
||||||
file \
|
# 1 new package to install.
|
||||||
libexpat-devel \
|
# Overall download size: 281.7 KiB. Already cached: 0 B. After the operation, additional 394.6 KiB will be used.
|
||||||
gmp-devel \
|
# Continue? [y/n/v/...? shows all options] (y): y
|
||||||
libpng16-devel \
|
#
|
||||||
libjpeg8-devel \
|
# That could make the user think that the package was installed,
|
||||||
perl \
|
# when it was only a dry run.
|
||||||
perl-HTML-Parser \
|
# To avoid the confusion, we hide the output unless there was an
|
||||||
m4 \
|
# error.
|
||||||
patch \
|
if out="$(zypper --non-interactive install --no-confirm --dry-run --force-resolution ${p} 2>&1)" ; then
|
||||||
scons \
|
echo "${p} can be installed"
|
||||||
pkgconf \
|
else
|
||||||
syslinux-utils \
|
echo "no"
|
||||||
ninja \
|
echo ""
|
||||||
meson \
|
echo "Zypper output:"
|
||||||
python-Mako \
|
echo ""
|
||||||
xdg-utils \
|
echo "${out}"
|
||||||
zip \
|
echo ""
|
||||||
unzip \
|
echo "Could not find how to install '${p}', try running:"
|
||||||
llvm \
|
echo ""
|
||||||
clang \
|
echo " zypper install ${p}"
|
||||||
doxygen \
|
echo ""
|
||||||
lua54 \
|
exit 1
|
||||||
ant \
|
fi
|
||||||
protobuf
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
zypper install ${packages[@]}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
@ -618,15 +708,29 @@ gentoo()
|
||||||
echo "Installing fuse..."
|
echo "Installing fuse..."
|
||||||
sudo emerge sys-fs/fuse
|
sudo emerge sys-fs/fuse
|
||||||
fi
|
fi
|
||||||
if [ "$2" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
echo "Please install QEMU and re-run this script"
|
echo "Please install QEMU and re-run this script"
|
||||||
echo "Step1. Add QEMU_SOFTMMU_TARGETS=\"x86_64\" to /etc/portage/make.conf"
|
echo "Step1. Add QEMU_SOFTMMU_TARGETS=\"x86_64\" to /etc/portage/make.conf"
|
||||||
echo "Step2. Execute \"sudo emerge app-emulation/qemu\""
|
echo "Step2. Execute \"sudo emerge app-emulation/qemu\""
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
|
echo "or run with -e qemu"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "VirtualBox already installed!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(which cmake)" ]; then
|
if [ -z "$(which cmake)" ]; then
|
||||||
echo "Installing cmake..."
|
echo "Installing cmake..."
|
||||||
sudo emerge dev-util/cmake
|
sudo emerge dev-util/cmake
|
||||||
|
@ -651,14 +755,17 @@ solus()
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Please install VirtualBox and re-run this script,"
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
echo "or run with -e qemu"
|
echo "or run with -e qemu"
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
echo "VirtualBox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing necessary build tools..."
|
echo "Installing necessary build tools..."
|
||||||
|
@ -746,7 +853,7 @@ rustInstall() {
|
||||||
sudo /usr/local/lib/rustlib/uninstall.sh
|
sudo /usr/local/lib/rustlib/uninstall.sh
|
||||||
else
|
else
|
||||||
echo "Please manually uninstall multirust and any other versions of rust, then re-run bootstrap."
|
echo "Please manually uninstall multirust and any other versions of rust, then re-run bootstrap."
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# If rustup is not installed we should offer to install it for them
|
# If rustup is not installed we should offer to install it for them
|
||||||
|
@ -774,7 +881,7 @@ rustInstall() {
|
||||||
echo "Please either run the script again, accepting rustup install"
|
echo "Please either run the script again, accepting rustup install"
|
||||||
echo "or install rustc nightly manually (not recommended) via:"
|
echo "or install rustc nightly manually (not recommended) via:"
|
||||||
echo "\#curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly"
|
echo "\#curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly"
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Your Rust install looks good!"
|
echo "Your Rust install looks good!"
|
||||||
fi
|
fi
|
||||||
|
@ -868,7 +975,7 @@ do
|
||||||
u) update=true;;
|
u) update=true;;
|
||||||
h) usage;;
|
h) usage;;
|
||||||
s) statusCheck && exit;;
|
s) statusCheck && exit;;
|
||||||
\?) echo "I don't know what to do with that option, try -h for help"; exit;;
|
\?) echo "I don't know what to do with that option, try -h for help"; exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -922,4 +1029,4 @@ if [ "$dependenciesonly" = false ]; then
|
||||||
boot
|
boot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Redox bootstrap complete!"
|
echo "Redox bootstrap complete!"
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# This function is simply a banner to introduce the script
|
# This function is simply a banner to introduce the script
|
||||||
##########################################################
|
##########################################################
|
||||||
|
@ -13,10 +15,10 @@ banner()
|
||||||
|
|
||||||
###################################################################################
|
###################################################################################
|
||||||
# This function takes care of installing a dependency via package manager of choice
|
# This function takes care of installing a dependency via package manager of choice
|
||||||
# for building redox on BSDs (MacOS, FreeBSD, etc.).
|
# for building Redox on BSDs (macOS, FreeBSD, etc.).
|
||||||
# @params: $1 package manager
|
# @params: $1 package manager
|
||||||
# $2 package name
|
# $2 package name
|
||||||
# $3 binary name (optional)
|
# $3 binary name (optional)
|
||||||
###################################################################################
|
###################################################################################
|
||||||
install_bsd_pkg()
|
install_bsd_pkg()
|
||||||
{
|
{
|
||||||
|
@ -58,14 +60,14 @@ install_freebsd_pkg()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function checks which of the supported package managers
|
# This function checks which of the supported package managers
|
||||||
# is available on the OSX Host.
|
# is available on the macOS host.
|
||||||
# If a supported package manager is found, it delegates the installing work to
|
# If a supported package manager is found, it delegates the installing work to
|
||||||
# the relevant function.
|
# the relevant function.
|
||||||
# Otherwise this function will exit this script with an error.
|
# Otherwise this function will exit this script with an error.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
osx()
|
osx()
|
||||||
{
|
{
|
||||||
echo "Detected OSX!"
|
echo "Detected macOS!"
|
||||||
|
|
||||||
if [ ! -z "$(which brew)" ]; then
|
if [ ! -z "$(which brew)" ]; then
|
||||||
osx_homebrew $@
|
osx_homebrew $@
|
||||||
|
@ -81,24 +83,27 @@ osx()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies using MacPorts
|
# This function takes care of installing all dependencies using MacPorts
|
||||||
# for building redox on Mac OSX
|
# for building Redox on macOS
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
osx_macports()
|
osx_macports()
|
||||||
{
|
{
|
||||||
echo "Macports detected! Now updating..."
|
echo "MacPorts detected! Now updating..."
|
||||||
sudo port -v selfupdate
|
sudo port -v selfupdate
|
||||||
|
|
||||||
echo "Installing missing packages..."
|
echo "Installing missing packages..."
|
||||||
|
|
||||||
install_macports_pkg "git"
|
install_macports_pkg "git"
|
||||||
install_macports_pkg "cmake"
|
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
install_macports_pkg "qemu" "qemu-system-x86_64"
|
install_macports_pkg "qemu" "qemu-system-x86_64"
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
install_macports_pkg "virtualbox"
|
install_macports_pkg "virtualbox"
|
||||||
fi
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
install_macports_pkg "osxfuse"
|
install_macports_pkg "osxfuse"
|
||||||
install_macports_pkg "podman"
|
install_macports_pkg "podman"
|
||||||
|
@ -106,8 +111,8 @@ osx_macports()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies using Homebrew
|
# This function takes care of installing all dependencies using Homebrew
|
||||||
# for building redox on Mac OSX
|
# for building Redox on macOS
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
osx_homebrew()
|
osx_homebrew()
|
||||||
{
|
{
|
||||||
|
@ -118,11 +123,15 @@ osx_homebrew()
|
||||||
|
|
||||||
install_brew_pkg "git"
|
install_brew_pkg "git"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
install_brew_pkg "qemu" "qemu-system-x86_64"
|
install_brew_pkg "qemu" "qemu-system-x86_64"
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
install_brew_pkg "virtualbox"
|
install_brew_pkg "virtualbox"
|
||||||
fi
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
install_brew_pkg "make"
|
install_brew_pkg "make"
|
||||||
install_brew_pkg "podman"
|
install_brew_pkg "podman"
|
||||||
|
@ -130,43 +139,50 @@ osx_homebrew()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies using pkg
|
# This function takes care of installing all dependencies using pkg
|
||||||
# for building redox on FreeBSD
|
# for building Redox on FreeBSD
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
freebsd()
|
freebsd()
|
||||||
{
|
{
|
||||||
set -xe
|
set -x
|
||||||
echo "FreeBSD detected!"
|
echo "FreeBSD detected!"
|
||||||
echo "Installing missing packages..."
|
echo "Installing missing packages..."
|
||||||
|
|
||||||
install_freebsd_pkg "git"
|
install_freebsd_pkg "git"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
install_freebsd_pkg "qemu" "qemu-system-x86_64"
|
install_freebsd_pkg "qemu" "qemu-system-x86_64"
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
install_freebsd_pkg "virtualbox"
|
install_freebsd_pkg "virtualbox"
|
||||||
fi
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
install_freebsd_pkg "gmake"
|
install_freebsd_pkg "gmake"
|
||||||
install_freebsd_pkg "podman"
|
install_freebsd_pkg "podman"
|
||||||
set +xe
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies for building redox on
|
# This function takes care of installing all dependencies for building Redox on
|
||||||
# Arch linux
|
# Arch Linux
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
archLinux()
|
archLinux()
|
||||||
{
|
{
|
||||||
|
|
||||||
echo "Detected Arch Linux"
|
echo "Detected Arch Linux"
|
||||||
packages="git podman fuse"
|
packages="git podman fuse"
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
packages="$packages qemu"
|
packages="$packages qemu"
|
||||||
elif [ "$1" == "virtualbox" ]; then
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
packages="$packages virtualbox"
|
packages="$packages virtualbox"
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Scripts should not cause a system update in order to just install a couple
|
# Scripts should not cause a system update in order to just install a couple
|
||||||
# of packages. If pacman -S --needed is going to fail, let it fail and the
|
# of packages. If pacman -S --needed is going to fail, let it fail and the
|
||||||
# user will figure out the issues (without updating if required) and rerun
|
# user will figure out the issues (without updating if required) and rerun
|
||||||
|
@ -176,12 +192,13 @@ archLinux()
|
||||||
|
|
||||||
echo "Installing packages $packages..."
|
echo "Installing packages $packages..."
|
||||||
sudo pacman -S --needed $packages
|
sudo pacman -S --needed $packages
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies for building redox on
|
# This function takes care of installing all dependencies for building Redox on
|
||||||
# debian based linux
|
# Debian-based Linux
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
# $2 the package manager to use
|
# $2 the package manager to use
|
||||||
###############################################################################
|
###############################################################################
|
||||||
ubuntu()
|
ubuntu()
|
||||||
|
@ -200,20 +217,33 @@ ubuntu()
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Installing Virtualbox..."
|
|
||||||
sudo "$2" install virtualbox
|
if grep '^ID=debian$' /etc/os-release > /dev/null; then
|
||||||
|
echo "Virtualbox is not in the official debian packages"
|
||||||
|
echo "To install virtualbox on debian, see https://wiki.debian.org/VirtualBox"
|
||||||
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
|
echo "or run with -e qemu"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Installing VirtualBox..."
|
||||||
|
sudo "$2" install virtualbox
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Virtualbox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies for building redox on
|
# This function takes care of installing all dependencies for building Redox on
|
||||||
# fedora linux
|
# Fedora Linux
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
fedora()
|
fedora()
|
||||||
{
|
{
|
||||||
|
@ -222,6 +252,7 @@ fedora()
|
||||||
echo "Installing git..."
|
echo "Installing git..."
|
||||||
sudo dnf install git-all
|
sudo dnf install git-all
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
echo "Installing QEMU..."
|
echo "Installing QEMU..."
|
||||||
|
@ -229,14 +260,19 @@ fedora()
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Installing virtualbox..."
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
sudo dnf install virtualbox
|
echo "or run with -e qemu"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Virtualbox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use rpm -q <package> to check if it's already installed
|
# Use rpm -q <package> to check if it's already installed
|
||||||
PKGS=$(for pkg in podman; do rpm -q $pkg > /dev/null || echo $pkg; done)
|
PKGS=$(for pkg in podman; do rpm -q $pkg > /dev/null || echo $pkg; done)
|
||||||
# If the list of packages is not empty, install missing
|
# If the list of packages is not empty, install missing
|
||||||
|
@ -248,41 +284,100 @@ fedora()
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This function takes care of installing all dependencies for building redox on
|
# This function takes care of installing all dependencies for building Redox on
|
||||||
# *suse linux
|
# *SUSE Linux
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
###############################################################################
|
###############################################################################
|
||||||
suse()
|
suse()
|
||||||
{
|
{
|
||||||
echo "Detected SUSE Linux"
|
echo "Detected SUSE Linux"
|
||||||
|
|
||||||
|
packages=(
|
||||||
|
"make"
|
||||||
|
"fuse-devel"
|
||||||
|
"podman"
|
||||||
|
)
|
||||||
|
|
||||||
if [ -z "$(which git)" ]; then
|
if [ -z "$(which git)" ]; then
|
||||||
echo "Installing git..."
|
echo "Will install git ..."
|
||||||
zypper install git
|
packages+=(git)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
echo "Installing QEMU..."
|
echo "Will install QEMU..."
|
||||||
sudo zypper install qemu-x86 qemu-kvm
|
packages+=(qemu-x86 qemu-kvm)
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Please install Virtualbox and re-run this script,"
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
echo "or run with -e qemu"
|
echo "or run with -e qemu"
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Virtualbox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing necessary build tools..."
|
echo "Installing necessary build tools..."
|
||||||
sudo zypper install make fuse-devel podman
|
|
||||||
|
# We could install all the packages in a single zypper command with:
|
||||||
|
#
|
||||||
|
# zypper install package1 package2 package3
|
||||||
|
#
|
||||||
|
# But there is an issue with this: zypper returns a success code if at
|
||||||
|
# least one of the packages was correctly installed, but we need it to fail
|
||||||
|
# if any of the packages is missing.
|
||||||
|
#
|
||||||
|
# To confirm that the packages are available, we try to install them one by
|
||||||
|
# one with --dry-run.
|
||||||
|
# We still install all the packages in a single zypper command so that the
|
||||||
|
# user has to confirm only once.
|
||||||
|
for p in ${packages[@]}; do
|
||||||
|
if rpm -q "${p}" > /dev/null ; then
|
||||||
|
echo "${p} is already installed"
|
||||||
|
else
|
||||||
|
# Zypper shows a confirmation prompt and the "y" answer even with
|
||||||
|
# --non-interactive and --no-confirm:
|
||||||
|
#
|
||||||
|
# 1 new package to install.
|
||||||
|
# Overall download size: 281.7 KiB. Already cached: 0 B. After the operation, additional 394.6 KiB will be used.
|
||||||
|
# Continue? [y/n/v/...? shows all options] (y): y
|
||||||
|
#
|
||||||
|
# That could make the user think that the package was installed,
|
||||||
|
# when it was only a dry run.
|
||||||
|
# To avoid the confusion, we hide the output unless there was an
|
||||||
|
# error.
|
||||||
|
if out="$(zypper --non-interactive install --no-confirm --dry-run --force-resolution ${p} 2>&1)" ; then
|
||||||
|
echo "${p} can be installed"
|
||||||
|
else
|
||||||
|
echo "no"
|
||||||
|
echo ""
|
||||||
|
echo "Zypper output:"
|
||||||
|
echo ""
|
||||||
|
echo "${out}"
|
||||||
|
echo ""
|
||||||
|
echo "Could not find how to install '${p}', try running:"
|
||||||
|
echo ""
|
||||||
|
echo " zypper install ${p}"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
zypper install ${packages[@]}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# This function takes care of installing all dependencies for building redox on
|
# This function takes care of installing all dependencies for building Redox on
|
||||||
# gentoo linux
|
# Gentoo Linux
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
##############################################################################
|
##############################################################################
|
||||||
gentoo()
|
gentoo()
|
||||||
{
|
{
|
||||||
|
@ -295,32 +390,47 @@ gentoo()
|
||||||
echo "Installing fuse..."
|
echo "Installing fuse..."
|
||||||
sudo emerge sys-fs/fuse
|
sudo emerge sys-fs/fuse
|
||||||
fi
|
fi
|
||||||
if [ "$2" == "qemu" ]; then
|
|
||||||
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
echo "Please install QEMU and re-run this script"
|
echo "Please install QEMU and re-run this script"
|
||||||
echo "Step1. Add QEMU_SOFTMMU_TARGETS=\"x86_64\" to /etc/portage/make.conf"
|
echo "Step1. Add QEMU_SOFTMMU_TARGETS=\"x86_64\" to /etc/portage/make.conf"
|
||||||
echo "Step2. Execute \"sudo emerge app-emulation/qemu\""
|
echo "Step2. Execute \"sudo emerge app-emulation/qemu\""
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
|
echo "or run with -e qemu"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "VirtualBox already installed!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(which cmake)" ]; then
|
if [ -z "$(which cmake)" ]; then
|
||||||
echo "Installing cmake..."
|
echo "Installing cmake..."
|
||||||
sudo emerge dev-util/cmake
|
sudo emerge dev-util/cmake
|
||||||
fi
|
fi
|
||||||
if [ -z "$(which podman)" ]; then
|
if [ -z "$(which podman)" ]; then
|
||||||
echo "Please install Podman, https://wiki.gentoo.org/wiki/Podman"
|
echo "Please install Podman, https://wiki.gentoo.org/wiki/Podman"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# This function takes care of installing all dependencies for building redox on
|
# This function takes care of installing all dependencies for building Redox on
|
||||||
# SolusOS
|
# Solus
|
||||||
# @params: $1 the emulator to install, virtualbox or qemu
|
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
||||||
##############################################################################
|
##############################################################################
|
||||||
solus()
|
solus()
|
||||||
{
|
{
|
||||||
echo "Detected SolusOS"
|
echo "Detected Solus"
|
||||||
|
|
||||||
if [ "$1" == "qemu" ]; then
|
if [ "$1" == "qemu" ]; then
|
||||||
if [ -z "$(which qemu-system-x86_64)" ]; then
|
if [ -z "$(which qemu-system-x86_64)" ]; then
|
||||||
|
@ -328,14 +438,17 @@ solus()
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ "$1" == "virtualbox" ]; then
|
||||||
if [ -z "$(which virtualbox)" ]; then
|
if [ -z "$(which virtualbox)" ]; then
|
||||||
echo "Please install Virtualbox and re-run this script,"
|
echo "Please install VirtualBox and re-run this script,"
|
||||||
echo "or run with -e qemu"
|
echo "or run with -e qemu"
|
||||||
exit
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Virtualbox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Unknown emulator: $1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing necessary build tools..."
|
echo "Installing necessary build tools..."
|
||||||
|
@ -343,6 +456,7 @@ solus()
|
||||||
sudo eopkg it fuse-devel git make fuse2-devel rsync
|
sudo eopkg it fuse-devel git make fuse2-devel rsync
|
||||||
if [ -z "$(which podman)" ]; then
|
if [ -z "$(which podman)" ]; then
|
||||||
echo "Please install Podman"
|
echo "Please install Podman"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,14 +553,11 @@ boot()
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
if [[ "$(uname)" == "FreeBSD" ]]; then
|
if [[ "$(uname)" == "FreeBSD" ]]; then
|
||||||
MAKE="gmake"
|
MAKE="gmake"
|
||||||
echo "kldload fuse.ko # This loads the kernel module for fuse"
|
echo "kldload fuse.ko # This loads the kernel module for FUSE"
|
||||||
fi
|
fi
|
||||||
echo "$MAKE all"
|
echo "$MAKE all"
|
||||||
echo "$MAKE virtualbox or qemu"
|
echo "$MAKE virtualbox or qemu"
|
||||||
echo
|
echo
|
||||||
echo "You can also edit mk/config.mk and change PODMAN_BUILD to 1 so"
|
|
||||||
echo "you don't need to specify it on the command line."
|
|
||||||
echo
|
|
||||||
echo " Good luck!"
|
echo " Good luck!"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
@ -477,7 +588,7 @@ do
|
||||||
u) update=true;;
|
u) update=true;;
|
||||||
h) usage;;
|
h) usage;;
|
||||||
s) statusCheck && exit;;
|
s) statusCheck && exit;;
|
||||||
\?) echo "I don't know what to do with that option, try -h for help"; exit;;
|
\?) echo "I don't know what to do with that option, try -h for help"; exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -494,7 +605,7 @@ if [ "Darwin" == "$(uname -s)" ]; then
|
||||||
else
|
else
|
||||||
# Here we will use package managers to determine which operating system the user is using.
|
# Here we will use package managers to determine which operating system the user is using.
|
||||||
|
|
||||||
# Suse and derivatives
|
# SUSE and derivatives
|
||||||
if hash 2>/dev/null zypper; then
|
if hash 2>/dev/null zypper; then
|
||||||
suse "$emulator"
|
suse "$emulator"
|
||||||
# Debian or any derivative of it
|
# Debian or any derivative of it
|
||||||
|
@ -506,10 +617,10 @@ else
|
||||||
# Gentoo
|
# Gentoo
|
||||||
elif hash 2>/dev/null emerge; then
|
elif hash 2>/dev/null emerge; then
|
||||||
gentoo "$emulator"
|
gentoo "$emulator"
|
||||||
# SolusOS
|
# Solus
|
||||||
elif hash 2>/dev/null eopkg; then
|
elif hash 2>/dev/null eopkg; then
|
||||||
solus "$emulator"
|
solus "$emulator"
|
||||||
# Arch linux
|
# Arch Linux
|
||||||
elif hash 2>/dev/null pacman; then
|
elif hash 2>/dev/null pacman; then
|
||||||
archLinux "$emulator"
|
archLinux "$emulator"
|
||||||
# FreeBSD
|
# FreeBSD
|
||||||
|
@ -517,7 +628,7 @@ else
|
||||||
freebsd "$emulator"
|
freebsd "$emulator"
|
||||||
# Unsupported platform
|
# Unsupported platform
|
||||||
else
|
else
|
||||||
printf "\e[31;1mFatal error: \e[0;31mUnsupported platform, please open an issue\[0m"
|
printf "\e[31;1mFatal error: \e[0;31mUnsupported platform, please open an issue\e[0m\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -525,4 +636,4 @@ if [ "$dependenciesonly" = false ]; then
|
||||||
boot
|
boot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Redox bootstrap complete!"
|
echo "Redox bootstrap complete!"
|
Loading…
Reference in a new issue