From 7c72d2d4e0c0ef28fc6df73d73da6e51b075331a Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Mon, 31 Dec 2018 20:56:53 +0000
Subject: [PATCH] Remove packages to free up space during image creation

---
 src/freedombone-utils-search | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/freedombone-utils-search b/src/freedombone-utils-search
index 380d07dbf..b0e07bd7e 100755
--- a/src/freedombone-utils-search
+++ b/src/freedombone-utils-search
@@ -679,6 +679,12 @@ function webadmin_install_search {
     fi
 
     if [ "$rootdir" ]; then
+        # remove downloaded packages
+        # shellcheck disable=SC2086
+        chroot "$rootdir" $REMOVE_UNUSED_PACKAGES
+        # shellcheck disable=SC2086
+        chroot "$rootdir" $CLEAN_PACKAGES
+
         # shellcheck disable=SC2086
         chroot "$rootdir" $INSTALL_PACKAGES python-pip libyaml-dev python-werkzeug python-babel python-lxml
         # shellcheck disable=SC2086
@@ -689,11 +695,23 @@ function webadmin_install_search {
         chroot "$rootdir" $INSTALL_PACKAGES python-service-identity python-ndg-httpsclient
         # shellcheck disable=SC2086
         chroot "$rootdir" $REMOVE_PACKAGES_PURGE apache2-bin*
+
+        # remove downloaded packages
+        # shellcheck disable=SC2086
+        chroot "$rootdir" $REMOVE_UNUSED_PACKAGES
+        # shellcheck disable=SC2086
+        chroot "$rootdir" $CLEAN_PACKAGES
     else
         $INSTALL_PACKAGES python-pip libyaml-dev python-werkzeug python-babel python-lxml
         $INSTALL_PACKAGES git build-essential libxslt-dev python-dev python-virtualenv zlib1g-dev uwsgi uwsgi-plugin-python imagemagick
         $INSTALL_PACKAGES apache2-utils python-setuptools
         $INSTALL_PACKAGES python-service-identity python-ndg-httpsclient
+
+        # remove downloaded packages
+        # shellcheck disable=SC2086
+        $REMOVE_UNUSED_PACKAGES
+        # shellcheck disable=SC2086
+        $CLEAN_PACKAGES
     fi
 
     cat >> "$rootdir/usr/bin/install_searx" <<EOF
-- 
GitLab