dependencies: trisquel: obtimize apt calls.

This makes sure that there is only one apt command that is called.

Since this change results in the some package names (like 'git') being
passed twice to apt install, this situation was tested with 'apt
install sl sl' on Trisquel 10 (nabia), Trisquel 11 (aramo) and also
PureOS 10 (byzantium) in case the trisquel and pureos dependencies are
merged later on, and it worked fine.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Tested-by: Adrien 'neox' Bourmault <neox@gnu.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2024-11-29 20:14:19 +01:00 committed by Adrien 'neox' Bourmault
parent 3e4eb2b9eb
commit 35d70e38f6
Signed by: neox
GPG Key ID: 57BC26A3687116F6
1 changed files with 5 additions and 6 deletions

View File

@ -26,10 +26,9 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
to_install=""
install_packages()
{
to_install=""
for package in $@ ; do
if dpkg -l "${package}" | grep "^ii" 2>&1>/dev/null ; then
continue
@ -37,10 +36,6 @@ install_packages()
to_install="${to_install} ${package}"
fi
done
if [ -n "${to_install}" ] ; then
apt install -y ${to_install}
fi
}
if [ $EUID -ne 0 ]; then
@ -137,3 +132,7 @@ install_packages gawk git grep lzip make sed tar xz-utils # u-boot-libre
install_packages \
pandoc \
graphviz
if [ -n "${to_install}" ] ; then
apt install -y ${to_install}
fi