From cc63cae32cbdb996d4a088269049fc3f26abc078 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Tue, 20 Jan 2015 11:22:30 -0600
Subject: [PATCH] chroot: deborphan: run manually and add pkg list to
 chroot_manual_deborphan_list

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 configs/eewiki_bare_debian_stable_armel.conf |  2 ++
 configs/eewiki_bare_debian_stable_armhf.conf |  2 ++
 scripts/chroot.sh                            | 12 +++++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/configs/eewiki_bare_debian_stable_armel.conf b/configs/eewiki_bare_debian_stable_armel.conf
index 6e702b05d..f7409c192 100644
--- a/configs/eewiki_bare_debian_stable_armel.conf
+++ b/configs/eewiki_bare_debian_stable_armel.conf
@@ -32,5 +32,7 @@ rfs_console_user_pass="enable"
 rfs_ssh_banner=""
 rfs_ssh_user_pass=""
 ##
+chroot_not_reliable_deborphan="enable"
+chroot_manual_deborphan_list=""
 chroot_very_small_image="enable"
 chroot_tarball="enable"
diff --git a/configs/eewiki_bare_debian_stable_armhf.conf b/configs/eewiki_bare_debian_stable_armhf.conf
index 596863d27..226c4d7e5 100644
--- a/configs/eewiki_bare_debian_stable_armhf.conf
+++ b/configs/eewiki_bare_debian_stable_armhf.conf
@@ -36,5 +36,7 @@ rfs_ssh_user_pass=""
 repo_rcnee="enable"
 repo_rcnee_pkg_list=""
 ##
+chroot_not_reliable_deborphan="enable"
+chroot_manual_deborphan_list=""
 chroot_very_small_image="enable"
 chroot_tarball="enable"
diff --git a/scripts/chroot.sh b/scripts/chroot.sh
index 3274c8390..b5c4d123e 100755
--- a/scripts/chroot.sh
+++ b/scripts/chroot.sh
@@ -508,6 +508,7 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 	}
 
 	run_deborphan () {
+		echo "Log: (chroot): deborphan is not reliable, run manual and add pkg list to: [chroot_manual_deborphan_list]"
 		apt-get -y --force-yes install deborphan
 
 		# Prevent deborphan from removing explicitly required packages
@@ -523,6 +524,14 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 		apt-get clean
 	}
 
+	manual_deborphan () {
+		if [ ! "x${chroot_manual_deborphan_list}" = "x" ] ; then
+			echo "Log: (chroot): cleanup: [${chroot_manual_deborphan_list}]"
+			apt-get -y remove ${chroot_manual_deborphan_list} --purge
+			apt-get clean
+		fi
+	}
+
 	dl_kernel () {
 		wget --no-verbose --directory-prefix=/tmp/ \${kernel_url}
 
@@ -759,9 +768,10 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 	install_pkgs
 	system_tweaks
 	set_locale
-	if [ "x${chroot_very_small_image}" = "xenable" ] ; then
+	if [ "x${chroot_not_reliable_deborphan}" = "xenable" ] ; then
 		run_deborphan
 	fi
+	manual_deborphan
 	add_user
 
 	mkdir -p /opt/source || true
-- 
GitLab