diff --git a/compile.sh b/compile.sh index f3544c4ee..8cfed7b69 100755 --- a/compile.sh +++ b/compile.sh @@ -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 diff --git a/lib/general.sh b/lib/general.sh index 082f52afc..472aed11c 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -968,22 +968,26 @@ wait_for_package_manager() - # prepare_host_basic # # * installs only basic packages # prepare_host_basic() { - # wait until package manager finishes possible system maintanace - wait_for_package_manager + # the checklist includes a list of package names separated by a space + local checklist="dialog psmisc acl uuid-runtime curl gnupg gawk" - # need to install dialog if person is starting with a interactive mode + # Don't use this function here. + # wait_for_package_manager + # + # The `psmisk` package is not installed yet. + + # We will check one package and install the entire list. if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' dialog 2>/dev/null) != *ii* ]]; then - display_alert "Installing package" "dialog" - apt-get -q update && apt-get install -q -y --no-install-recommends dialog + display_alert "Installing basic packages" "$checklist" + apt-get -qq update && \ + apt-get install -qq -y --no-install-recommends $checklist fi - } @@ -1092,7 +1096,7 @@ prepare_host() grep -q i386 <(dpkg --print-foreign-architectures) || dpkg --add-architecture i386 # build aarch64 fi - + if systemd-detect-virt -q -c; then display_alert "Running in container" "$(systemd-detect-virt)" "info" # disable apt-cacher unless NO_APT_CACHER=no is not specified explicitly diff --git a/lib/main.sh b/lib/main.sh index da08ed2b6..c6c5b16c4 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -151,26 +151,6 @@ fi - -if [ "$OFFLINE_WORK" == "yes" ]; then - - echo -e "\n" - display_alert "* " "You are working offline." - display_alert "* " "Sources, time and host will not be checked" - echo -e "\n" - sleep 3s - -else - - # we need dialog to display the menu in case not installed. Other stuff gets installed later - prepare_host_basic - -fi - - - - - # if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu if [[ -z $KERNEL_ONLY ]]; then