You've already forked OpenUxAS-bootstrap
mirror of
https://github.com/AdaCore/OpenUxAS-bootstrap.git
synced 2026-02-12 13:07:23 -08:00
86 lines
1.8 KiB
Bash
Executable File
86 lines
1.8 KiB
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
if [ -z "$BOOTSTRAP_ROOT" ]; then
|
|
BOOTSTRAP_ROOT="${HOME}/bootstrap"
|
|
fi
|
|
|
|
if [ -z "$BOOTSTRAP_FORK" ]; then
|
|
BOOTSTRAP_FORK="AdaCore/OpenUxAS-bootstrap.git"
|
|
fi
|
|
|
|
colorize() {
|
|
if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2"
|
|
else echo -n "$2"
|
|
fi
|
|
}
|
|
|
|
# Checks for bootstrap, and suggests to remove it for installing
|
|
if [ -d "${BOOTSTRAP_ROOT}" ]; then
|
|
{ echo
|
|
colorize 1 "CRITICAL"
|
|
echo ": Can not proceed with installation. Kindly remove the '${BOOTSTRAP_ROOT}' directory first."
|
|
echo
|
|
} >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v git 1>/dev/null 2>&1; then
|
|
{ echo
|
|
colorize 1 "CRITICAL"
|
|
echo ": Git is not installed, can't continue."
|
|
echo
|
|
} >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v python3 1>/dev/null 2>&1; then
|
|
{ echo
|
|
colorize 1 "CRITICAL"
|
|
echo ": python3 is not installed, can't continue."
|
|
echo
|
|
} >&2
|
|
exit 1
|
|
fi
|
|
|
|
PYTHON_MAJOR_VERSION=`python3 -c 'import sys; print(sys.version_info[0])'`
|
|
PYTHON_MINOR_VERSION=`python3 -c 'import sys; print(sys.version_info[1])'`
|
|
|
|
if ((10#${PYTHON_MAJOR_VERSION} < 3)); then
|
|
{ echo
|
|
colorize 1 "CRITICAL"
|
|
echo ": python >= 3.8 is required, can't continue."
|
|
echo
|
|
} >&2
|
|
exit 1
|
|
else
|
|
if ((10#${PYTHON_MINOR_VERSION} < 8)); then
|
|
{ echo
|
|
colorize 1 "CRITICAL"
|
|
echo ": python >= 3.8 is required, can't continue."
|
|
echo
|
|
}
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
failed_checkout() {
|
|
colorize 1 "CRITICAL"
|
|
echo ": Failed to git clone $1"
|
|
exit -1
|
|
}
|
|
|
|
checkout() {
|
|
[ -d "$2" ] || git clone --depth 1 "$1" "$2" || failed_checkout "$1"
|
|
}
|
|
|
|
|
|
if [ -n "${USE_GIT_URI}" ]; then
|
|
GITHUB="git://github.com"
|
|
else
|
|
GITHUB="https://github.com"
|
|
fi
|
|
|
|
checkout "${GITHUB}/${BOOTSTRAP_FORK}" "${BOOTSTRAP_ROOT}"
|
|
|
|
(cd "${BOOTSTRAP_ROOT}" && python3 util/install --automatic -v --log-file provisioning.log)
|