Merge branch 'non-interactive-bootstrap' into 'master'
Bootstrap non-interactively See merge request redox-os/redox!1424
This commit is contained in:
commit
1f93e814a9
78
bootstrap.sh
78
bootstrap.sh
|
@ -297,9 +297,17 @@ freebsd()
|
||||||
# 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"
|
||||||
|
# $2 install non-interactively, boolean
|
||||||
###############################################################################
|
###############################################################################
|
||||||
archLinux()
|
archLinux()
|
||||||
{
|
{
|
||||||
|
noninteractive=$2
|
||||||
|
|
||||||
|
pacman_install="pacman -S --needed"
|
||||||
|
if [ "$noninteractive" = true ]; then
|
||||||
|
pacman_install+=" --noconfirm"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Detected Arch Linux"
|
echo "Detected Arch Linux"
|
||||||
packages="cmake \
|
packages="cmake \
|
||||||
fuse \
|
fuse \
|
||||||
|
@ -360,20 +368,34 @@ archLinux()
|
||||||
#sudo pacman -Syu
|
#sudo pacman -Syu
|
||||||
|
|
||||||
echo "Installing packages $packages..."
|
echo "Installing packages $packages..."
|
||||||
sudo pacman -S --needed $packages
|
sudo $pacman_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
|
||||||
# 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 install non-interactively, boolean
|
||||||
|
# $3 the package manager to use
|
||||||
###############################################################################
|
###############################################################################
|
||||||
ubuntu()
|
ubuntu()
|
||||||
{
|
{
|
||||||
|
noninteractive=$2
|
||||||
|
package_manager=$3
|
||||||
echo "Detected Ubuntu/Debian"
|
echo "Detected Ubuntu/Debian"
|
||||||
echo "Updating system..."
|
echo "Updating system..."
|
||||||
sudo "$2" update
|
sudo $package_manager update
|
||||||
|
|
||||||
|
if [ $package_manager == "apt-get" ]; then
|
||||||
|
if [ "$noninteractive" = true ]; then
|
||||||
|
install_command+="DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes --quiet"
|
||||||
|
else
|
||||||
|
install_command="apt-get install"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
install_command="$package_manager install"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing required packages..."
|
echo "Installing required packages..."
|
||||||
pkgs="\
|
pkgs="\
|
||||||
ant \
|
ant \
|
||||||
|
@ -432,12 +454,12 @@ ubuntu()
|
||||||
case "$host_arch" in
|
case "$host_arch" in
|
||||||
x86*|i?86) pkgs="$pkgs libc6-dev-i386 syslinux-utils";;
|
x86*|i?86) pkgs="$pkgs libc6-dev-i386 syslinux-utils";;
|
||||||
esac
|
esac
|
||||||
sudo "$2" install $pkgs
|
sudo $install_command $pkgs
|
||||||
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..."
|
||||||
sudo "$2" install qemu-system-x86 qemu-kvm
|
sudo $install_command qemu-system-x86 qemu-kvm
|
||||||
sudo "$2" install qemu-efi-arm qemu-system-arm
|
sudo $install_command qemu-efi-arm qemu-system-arm
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
|
@ -452,7 +474,7 @@ ubuntu()
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Installing VirtualBox..."
|
echo "Installing VirtualBox..."
|
||||||
sudo "$2" install virtualbox
|
sudo $install_command virtualbox
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "VirtualBox already installed!"
|
echo "VirtualBox already installed!"
|
||||||
|
@ -467,19 +489,27 @@ ubuntu()
|
||||||
# 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"
|
||||||
|
# $2 install non-interactively, boolean
|
||||||
###############################################################################
|
###############################################################################
|
||||||
fedora()
|
fedora()
|
||||||
{
|
{
|
||||||
|
noninteractive=$2
|
||||||
|
|
||||||
|
dnf_install="dnf install"
|
||||||
|
if [ "$noninteractive" = true ]; then
|
||||||
|
dnf_install+=" --assumeyes --quiet"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Detected Fedora"
|
echo "Detected Fedora"
|
||||||
if [ -z "$(which git)" ]; then
|
if [ -z "$(which git)" ]; then
|
||||||
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..."
|
||||||
sudo dnf install qemu-system-x86 qemu-kvm
|
sudo $dnf_install qemu-system-x86 qemu-kvm
|
||||||
else
|
else
|
||||||
echo "QEMU already installed!"
|
echo "QEMU already installed!"
|
||||||
fi
|
fi
|
||||||
|
@ -554,14 +584,13 @@ fedora()
|
||||||
COUNT=$(echo $PKGS | wc -w)
|
COUNT=$(echo $PKGS | wc -w)
|
||||||
if [ $COUNT -ne 0 ]; then
|
if [ $COUNT -ne 0 ]; then
|
||||||
echo "Installing necessary build tools..."
|
echo "Installing necessary build tools..."
|
||||||
sudo dnf install $PKGS
|
sudo $dnf_install $PKGS
|
||||||
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
|
||||||
# *SUSE Linux
|
# *SUSE Linux
|
||||||
# @params: $1 the emulator to install, "virtualbox" or "qemu"
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
suse()
|
suse()
|
||||||
{
|
{
|
||||||
|
@ -818,6 +847,10 @@ usage()
|
||||||
echo " -p [package Choose an Ubuntu package manager, apt-fast or"
|
echo " -p [package Choose an Ubuntu package manager, apt-fast or"
|
||||||
echo " manager] aptitude"
|
echo " manager] aptitude"
|
||||||
echo " -d Only install the dependencies, skip boot step"
|
echo " -d Only install the dependencies, skip boot step"
|
||||||
|
echo " -y Install non-interactively. Answer \"yes\" or"
|
||||||
|
echo " select the default option for rustup and package"
|
||||||
|
echo " managers. Only the apt, dnf and pacman"
|
||||||
|
echo " package managers are supported."
|
||||||
echo "EXAMPLES:"
|
echo "EXAMPLES:"
|
||||||
echo
|
echo
|
||||||
echo "./bootstrap.sh -e qemu"
|
echo "./bootstrap.sh -e qemu"
|
||||||
|
@ -840,8 +873,10 @@ cargoInstall() {
|
||||||
# This function takes care of everything associated to rust, and the version manager
|
# This function takes care of everything associated to rust, and the version manager
|
||||||
# That controls it, it can install rustup and uninstall multirust as well as making
|
# That controls it, it can install rustup and uninstall multirust as well as making
|
||||||
# sure that the correct version of rustc is selected by rustup
|
# sure that the correct version of rustc is selected by rustup
|
||||||
|
# @params: $1 install non-interactively, boolean
|
||||||
####################################################################################
|
####################################################################################
|
||||||
rustInstall() {
|
rustInstall() {
|
||||||
|
noninteractive=$1
|
||||||
# Check to see if multirust is installed, we don't want it messing with rustup
|
# Check to see if multirust is installed, we don't want it messing with rustup
|
||||||
# In the future we can probably remove this but I believe it's good to have for now
|
# In the future we can probably remove this but I believe it's good to have for now
|
||||||
if [ -e /usr/local/lib/rustlib/uninstall.sh ] ; then
|
if [ -e /usr/local/lib/rustlib/uninstall.sh ] ; then
|
||||||
|
@ -859,15 +894,21 @@ rustInstall() {
|
||||||
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
|
||||||
if [ -z "$(which rustup)" ]; then
|
if [ -z "$(which rustup)" ]; then
|
||||||
|
rustup_options="--default-toolchain nightly"
|
||||||
echo "You do not have rustup installed."
|
echo "You do not have rustup installed."
|
||||||
|
if [ "$noninteractive" = true ]; then
|
||||||
|
rustup="y"
|
||||||
|
rustup_options+=" -y"
|
||||||
|
else
|
||||||
echo "We HIGHLY recommend using rustup."
|
echo "We HIGHLY recommend using rustup."
|
||||||
echo "Would you like to install it now?"
|
echo "Would you like to install it now?"
|
||||||
echo "*WARNING* this involves a 'curl | sh' style command"
|
echo "*WARNING* this involves a 'curl | sh' style command"
|
||||||
printf "(y/N): "
|
printf "(y/N): "
|
||||||
read rustup
|
read rustup
|
||||||
|
fi
|
||||||
if echo "$rustup" | grep -iq "^y" ;then
|
if echo "$rustup" | grep -iq "^y" ;then
|
||||||
#install rustup
|
#install rustup
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly
|
curl https://sh.rustup.rs -sSf | sh -s -- $rustup_options
|
||||||
# You have to add the rustup variables to the $PATH
|
# You have to add the rustup variables to the $PATH
|
||||||
echo "export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> ~/.bashrc
|
echo "export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> ~/.bashrc
|
||||||
# source the variables so that we can execute rustup commands in the current shell
|
# source the variables so that we can execute rustup commands in the current shell
|
||||||
|
@ -967,7 +1008,9 @@ emulator="qemu"
|
||||||
defpackman="apt-get"
|
defpackman="apt-get"
|
||||||
dependenciesonly=false
|
dependenciesonly=false
|
||||||
update=false
|
update=false
|
||||||
while getopts ":e:p:udhs" opt
|
noninteractive=false
|
||||||
|
|
||||||
|
while getopts ":e:p:udhys" opt
|
||||||
do
|
do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
e) emulator="$OPTARG";;
|
e) emulator="$OPTARG";;
|
||||||
|
@ -975,6 +1018,7 @@ do
|
||||||
d) dependenciesonly=true;;
|
d) dependenciesonly=true;;
|
||||||
u) update=true;;
|
u) update=true;;
|
||||||
h) usage;;
|
h) usage;;
|
||||||
|
y) noninteractive=true;;
|
||||||
s) statusCheck && exit;;
|
s) statusCheck && exit;;
|
||||||
\?) echo "I don't know what to do with that option, try -h for help"; exit 1;;
|
\?) echo "I don't know what to do with that option, try -h for help"; exit 1;;
|
||||||
esac
|
esac
|
||||||
|
@ -982,7 +1026,7 @@ done
|
||||||
|
|
||||||
banner
|
banner
|
||||||
|
|
||||||
rustInstall
|
rustInstall "$noninteractive"
|
||||||
|
|
||||||
if [ "$update" == "true" ]; then
|
if [ "$update" == "true" ]; then
|
||||||
git pull upstream master
|
git pull upstream master
|
||||||
|
@ -1001,10 +1045,10 @@ else
|
||||||
suse "$emulator"
|
suse "$emulator"
|
||||||
# Debian or any derivative of it
|
# Debian or any derivative of it
|
||||||
elif hash 2>/dev/null apt-get; then
|
elif hash 2>/dev/null apt-get; then
|
||||||
ubuntu "$emulator" "$defpackman"
|
ubuntu "$emulator" "$noninteractive" "$defpackman"
|
||||||
# Fedora
|
# Fedora
|
||||||
elif hash 2>/dev/null dnf; then
|
elif hash 2>/dev/null dnf; then
|
||||||
fedora "$emulator"
|
fedora "$emulator" "$noninteractive"
|
||||||
# Gentoo
|
# Gentoo
|
||||||
elif hash 2>/dev/null emerge; then
|
elif hash 2>/dev/null emerge; then
|
||||||
gentoo "$emulator"
|
gentoo "$emulator"
|
||||||
|
@ -1013,7 +1057,7 @@ else
|
||||||
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" "$noninteractive"
|
||||||
# FreeBSD
|
# FreeBSD
|
||||||
elif hash 2>/dev/null pkg; then
|
elif hash 2>/dev/null pkg; then
|
||||||
freebsd "$emulator"
|
freebsd "$emulator"
|
||||||
|
|
Loading…
Reference in a new issue