From 35d70e38f60ff4f2004df453f581a7ad604ed4f4 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Fri, 29 Nov 2024 20:14:19 +0100 Subject: [PATCH] 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 Tested-by: Adrien 'neox' Bourmault Acked-by: Adrien 'neox' Bourmault --- resources/dependencies/trisquel | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/dependencies/trisquel b/resources/dependencies/trisquel index 784889e..588832a 100755 --- a/resources/dependencies/trisquel +++ b/resources/dependencies/trisquel @@ -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