Code cleanup and optimization (#2965)

* prepare_host_basic: Code cleanup and optimization

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>

* Checking and install at the beginning the basic utilities

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>

* Logging has been removed because it makes little sense.

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>
This commit is contained in:
The-going
2021-07-05 00:25:40 +03:00
committed by GitHub
parent fb69b203d6
commit eca7bbb12d
3 changed files with 21 additions and 52 deletions

View File

@@ -130,26 +130,19 @@ else
exit $?
fi
if [ "$OFFLINE_WORK" == "yes" ]; then
# Check for required packages
if [[ -z "$(command -v dialog)" ]]; then
sudo apt-get update
sudo apt-get install -y dialog
fi
echo -e "\n"
display_alert "* " "You are working offline."
display_alert "* " "Sources, time and host will not be checked"
echo -e "\n"
sleep 3s
if [[ -z "$(command -v fuser)" ]]; then
sudo apt-get update
sudo apt-get install -y psmisc
fi
else
if [[ -z "$(command -v getfacl)" ]]; then
sudo apt-get update
sudo apt-get install -y acl
fi
# check and install the basic utilities here
prepare_host_basic
if [[ -z "$(command -v uuidgen)" ]]; then
sudo apt-get update
sudo apt-get install -y uuid-runtime
fi
# Check for Vagrant
@@ -193,14 +186,6 @@ if [[ "${1}" == docker && -f /etc/debian_version && -z "$(command -v docker)" ]]
display_alert "Docker not installed." "Installing" "Info"
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/${codeid} ${codename} stable" > /etc/apt/sources.list.d/docker.list
# minimal set of utilities that are needed for prep
packages=("curl" "gnupg")
for i in "${packages[@]}"
do
[[ ! $(command -v "${i}") ]] && install_packages+=${i}" "
done
[[ -z "${install_packages}" ]] && apt-get update;apt-get install -y -qq --no-install-recommends ${install_packages}
curl -fsSL "https://download.docker.com/linux/${codeid}/gpg" | apt-key add -qq - > /dev/null 2>&1
export DEBIAN_FRONTEND=noninteractive
apt-get update