bbb-pre-install.sh: first install aptitude..

This commit is contained in:
2025-11-23 18:10:40 +01:00
parent 6776742b72
commit e69d35c393

View File

@@ -187,11 +187,15 @@ DEFAULT_FQDN_HOSTNAME="$(hostname -f)"
declare -a needed_debian_package_arr=()
NEEDED_DEBIAN_PACKAGES="
figlet
mc
vim
haveged
apt-utils
apt-transport-https
ca-certificates
curl
lsb-release
software-properties-common
"
@@ -324,37 +328,6 @@ echo -e " \033[32mInstall missing Debian packages\033[m"
echo -e " \033[1m---\033[m"
echo ""
_error=false
: > $log_file
echononl "Check if needed packages are installed.."
for _pkg in $NEEDED_DEBIAN_PACKAGES ; do
if aptitude search "$_pkg" | grep " $_pkg " | grep -e "^i" >> "$log_file" 2>&1 ; then
continue
else
needed_debian_package_arr+=("$_pkg")
fi
[[ $? -gt 0 ]] && _error=true
done
if $_error ; then
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
else
echo_ok
fi
if [[ ${#needed_debian_package_arr[@]} -gt 0 ]]; then
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
@@ -390,6 +363,57 @@ if [[ ${#needed_debian_package_arr[@]} -gt 0 ]]; then
[[ $OK = "yes" ]] || fatal "Interrupted by user."
echononl "Install package 'aptitude'.."
DEBIAN_FRONTEND=noninteractive apt-get -y install aptitude > "$log_file" 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
_error=false
: > $log_file
echononl "Check if needed packages are installed.."
for _pkg in $NEEDED_DEBIAN_PACKAGES ; do
if aptitude search "$_pkg" | grep " $_pkg " | grep -e "^i" >> "$log_file" 2>&1 ; then
continue
else
needed_debian_package_arr+=("$_pkg")
fi
[[ $? -gt 0 ]] && _error=true
done
if $_error ; then
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
else
echo_ok
fi
if [[ ${#needed_debian_package_arr[@]} -gt 0 ]]; then
for _debian_pkg in ${needed_debian_package_arr[@]} ; do
echononl "Installing $_debian_pkg .."