From 4b02efbead4169bbc960872e5e5d7b671bf5be9f Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Wed, 21 Aug 2013 15:45:57 -0500
Subject: [PATCH] bare image: run deborphan: 157M

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 bare_image.sh     |  2 ++
 base_image.sh     |  2 ++
 build_image.sh    |  2 ++
 scripts/chroot.sh | 13 +++++++++++++
 4 files changed, 19 insertions(+)

diff --git a/bare_image.sh b/bare_image.sh
index 8add18d60..9c9a3c8d0 100755
--- a/bare_image.sh
+++ b/bare_image.sh
@@ -70,6 +70,7 @@ minimal_armel () {
 		include_firmware="${include_firmware}"
 
 		chroot_enable_localepurge="${chroot_enable_localepurge}"
+		chroot_enable_deborphan="${chroot_enable_deborphan}"
 		chroot_no_lsb_release="${chroot_no_lsb_release}"
 		chroot_no_sudo="${chroot_no_sudo}"
 		chroot_no_aptitude="${chroot_no_aptitude}"
@@ -150,6 +151,7 @@ is_debian () {
 
 	pkg_list
 	chroot_enable_localepurge="enable"
+	chroot_enable_deborphan="enable"
 	chroot_no_lsb_release="Debian"
 	chroot_no_sudo="enable"
 	chroot_no_aptitude="enable"
diff --git a/base_image.sh b/base_image.sh
index 8b45b9a90..292ab3cbf 100755
--- a/base_image.sh
+++ b/base_image.sh
@@ -70,6 +70,7 @@ minimal_armel () {
 		include_firmware="${include_firmware}"
 
 		chroot_enable_localepurge="${chroot_enable_localepurge}"
+		chroot_enable_deborphan="${chroot_enable_deborphan}"
 		chroot_no_lsb_release="${chroot_no_lsb_release}"
 		chroot_no_sudo="${chroot_no_sudo}"
 		chroot_no_aptitude="${chroot_no_aptitude}"
@@ -150,6 +151,7 @@ is_debian () {
 
 	pkg_list
 #	chroot_enable_localepurge="enable"
+#	chroot_enable_deborphan="enable"
 #	chroot_no_lsb_release="Debian"
 #	chroot_no_sudo="enable"
 #	chroot_no_aptitude="enable"
diff --git a/build_image.sh b/build_image.sh
index 9d92c6f60..3477f6390 100755
--- a/build_image.sh
+++ b/build_image.sh
@@ -83,6 +83,7 @@ minimal_armel () {
 		include_firmware="${include_firmware}"
 
 		chroot_enable_localepurge="${chroot_enable_localepurge}"
+		chroot_enable_deborphan="${chroot_enable_deborphan}"
 		chroot_no_lsb_release="${chroot_no_lsb_release}"
 		chroot_no_sudo="${chroot_no_sudo}"
 		chroot_no_aptitude="${chroot_no_aptitude}"
@@ -199,6 +200,7 @@ is_debian () {
 
 	pkg_list
 #	chroot_enable_localepurge="enable"
+#	chroot_enable_deborphan="enable"
 #	chroot_no_lsb_release="Debian"
 #	chroot_no_sudo="enable"
 #	chroot_no_aptitude="enable"
diff --git a/scripts/chroot.sh b/scripts/chroot.sh
index b9fed1d08..6b814b502 100755
--- a/scripts/chroot.sh
+++ b/scripts/chroot.sh
@@ -368,6 +368,16 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 		fi
 	}
 
+	run_deborphan () {
+		packages="deborphan"
+		for pkg in \${packages} ; do check_n_install ; done
+
+		deborphan | xargs apt-get -y remove --purge
+
+		apt-get -y remove deborphan dialog gettext-base libasprintf0c2 --purge
+		apt-get clean
+	}
+
 	dl_pkg_src () {
 		mkdir -p /tmp/pkg_src/
 		cd /tmp/pkg_src/
@@ -535,6 +545,9 @@ cat > ${DIR}/chroot_script.sh <<-__EOF__
 		for pkg in \${packages} ; do check_n_install ; done
 	fi
 	set_locale
+	if [ "x${chroot_enable_deborphan}" = "xenable" ] ; then
+		run_deborphan
+	fi
 	add_user
 
 	if [ "x${chroot_rcnee_startup_scripts}" = "xenable" ] ; then
-- 
GitLab