Skip to contentSkip to conversation

opkg-utils: clear update-alternatives database on uninstall

PATCH New André Draszik 1 participant 1 message Nov 10, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opkg-utils: clear update-alternatives database on uninstall

From: André Draszik <[email protected]>

When uninstalling update-alternatives, it doesn't seem to make much sense to keep the update-alternatives database around.
In particular when removing packaging data, e.g. due to read-only rootfs, update-alternatives is removed from the target file system. Leaving its database around serves no purpose in that case as there is no way to use it afterwards anyway.

This frees close to 700KB of (uncompressed) space in a busybox based environment.

---
 meta/recipes-devtools/opkg-utils/opkg-utils_git.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/opkg-utils/opkg-utils_git.bb +5 -0
index a7aec45..19a852e 100644
@@ -43,4 +43,9 @@ RPROVIDES_update-alternatives-opkg = "update-alternatives update-alternatives-cw
 RREPLACES_update-alternatives-opkg = "update-alternatives-cworth"
 RCONFLICTS_update-alternatives-opkg = "update-alternatives-cworth"
 
+pkg_postrm_update-alternatives-opkg() {
+	rm -rf $OPKG_OFFLINE_ROOT${nonarch_libdir}/opkg/alternatives
+	rmdir --ignore-fail-on-non-empty $OPKG_OFFLINE_ROOT${nonarch_libdir}/opkg
+}
+
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.10.2