From a4545751b50e66610722b5a58d717887c3c9144d Mon Sep 17 00:00:00 2001
From: Karim Doumaz <karim.doumaz@ubicast.eu>
Date: Fri, 14 Oct 2016 15:41:45 +0200
Subject: [PATCH] Test if testing package is already installed + clean
 repository, update #18895

---
 tests/test_apt.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/test_apt.sh b/tests/test_apt.sh
index b9aa3879..3c185764 100755
--- a/tests/test_apt.sh
+++ b/tests/test_apt.sh
@@ -1,7 +1,18 @@
 #!/bin/bash
 source /root/envsetup/envsetup.conf
 
-set -e
-
 echo "Testing apt-get upgrade"
+
+echo "Clean repository"
+apt-get clean
+
+#Testing if sl package exists and remove it
+dpkg -l | awk '{print $2}' | grep '^sl$'
+
+if [ "$?" -eq "0" ]; then
+   echo "Removing already installed testing package"
+   apt-get -y remove sl
+fi 
+
+# Installation testing package sl
 apt-get update && apt-get -y install sl && apt-get -y remove sl
-- 
GitLab