mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 12:07:45 +01:00
refactor: use a log helper
This commit is contained in:
18
bootstrap.sh
18
bootstrap.sh
@@ -12,13 +12,18 @@ set -eo pipefail
|
|||||||
# That's good because it prevents our output overlapping with wget's.
|
# That's good because it prevents our output overlapping with wget's.
|
||||||
# It also means that we can't run a partially downloaded script.
|
# It also means that we can't run a partially downloaded script.
|
||||||
|
|
||||||
|
log-fail() {
|
||||||
|
declare desc="log fail formatter"
|
||||||
|
echo "$@" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
ensure-environment() {
|
ensure-environment() {
|
||||||
local FREE_MEMORY
|
local FREE_MEMORY
|
||||||
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
|
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
|
||||||
|
|
||||||
hostname -f >/dev/null 2>&1 || {
|
hostname -f >/dev/null 2>&1 || {
|
||||||
echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
|
log-fail "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_MEMORY=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
FREE_MEMORY=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
||||||
@@ -90,8 +95,7 @@ install-dokku-from-source() {
|
|||||||
local DOKKU_CHECKOUT="$1"
|
local DOKKU_CHECKOUT="$1"
|
||||||
|
|
||||||
if ! command -v apt-get &>/dev/null; then
|
if ! command -v apt-get &>/dev/null; then
|
||||||
echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
|
log-fail "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt-get -qq -y install git make software-properties-common
|
apt-get -qq -y install git make software-properties-common
|
||||||
@@ -115,8 +119,7 @@ install-dokku-from-package() {
|
|||||||
install-dokku-from-rpm-package "$@"
|
install-dokku-from-rpm-package "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported Linux distribution. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
|
log-fail "Unsupported Linux distribution. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -199,8 +202,7 @@ install-dokku-from-rpm-package() {
|
|||||||
local DOKKU_CHECKOUT="$1"
|
local DOKKU_CHECKOUT="$1"
|
||||||
|
|
||||||
if [[ "$DOKKU_DISTRO_VERSION" != "7" ]]; then
|
if [[ "$DOKKU_DISTRO_VERSION" != "7" ]]; then
|
||||||
echo "Only CentOS version 7 is supported."
|
log-fail "Unsupported Linux distribution. Only the following versions are supported: CentOS [7]"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "--> Installing docker"
|
echo "--> Installing docker"
|
||||||
|
|||||||
Reference in New Issue
Block a user