summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-09-29 10:53:03 +0200
committerAaron Griffin <aaron@archlinux.org>2006-09-29 10:53:03 +0200
commit8ac392f4272b59cd612231a4d66d28e6c00d5686 (patch)
treee6dc45ed3646b642f2a2b49bc31f1d42a2faa9e3
parent9782feacddb5655f7f0d21b643c088074a7af9c1 (diff)
downloadmkinitcpio-8ac392f4272b59cd612231a4d66d28e6c00d5686.tar.gz
mkinitcpio-8ac392f4272b59cd612231a4d66d28e6c00d5686.tar.xz
Added proper cleanup for /tmp/lib/modules
git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@169 880c04e9-e011-0410-abf7-b926e227c9cd
-rw-r--r--mkinitcpio9
1 files changed, 8 insertions, 1 deletions
diff --git a/mkinitcpio b/mkinitcpio
index fb53086..b55648a 100644
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -175,7 +175,14 @@ if [ "x$GENIMG" != "x" ]; then
else
echo ":: Dry run complete, use -g IMAGE to generate a real image"
fi
+
+#cleanup - we should probably trap this...
+isempty () { [ $(ls -1 "${1}" | wc -l) -eq 0 ]; }
[ -e "${MODULE_FILE}" ] && rm "${MODULE_FILE}"
-[ -e "/tmp/${MODULEDIR}/" ] && rm -rf /tmp/${MODULEDIR}/
+if [ -d /tmp/lib/modules/${KERNELVERSION} ]; then
+ rm -rf /tmp/lib/modules/${KERNELVERSION}
+ isempty /tmp/lib/modules && rm -rf /tmp/lib/modules
+ isempty /tmp/lib && rm -rf /tmp/lib
+fi
exit $status
#vim:set ft=sh ts=4 sw=4 noet: