Control: tag -1 + patch

Hi,

I just wrote a patch as Laurent Bigonville's suggestion. It works in sid
+ selinux permissive mode. Please help to see if it is suitable to merge
to official pbuilder, thanks.

-- 
ChangZhuo Chen (陳昌倬) <czc...@gmail.com>
http://czchen.info/
Key fingerprint = EC9F 905D 866D BE46 A896  C827 BE0C 9242 03F4 552D
commit ed38b6f5644222c912bd60b8f8438d5a3dec8240
Author: ChangZhuo Chen (陳昌倬) <czc...@gmail.com>
Date:   Fri May 9 12:52:51 2014 +0800

    Use /proc/mounts to determine selinuxfs location
    
    Closes: #734193, #734454

diff --git a/pbuilder-modules b/pbuilder-modules
index 055d611..2a0f9f8 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -213,7 +213,7 @@ function umountproc () {
 	umount_one "$mnt"
     done
     if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
-	umount_one "selinux"
+	umount_one "$(grep -m 1 ^selinuxfs /proc/mounts | cut -d ' ' -f 2)"
     fi
     if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ "$USEDEVPTS" = "yes" ]; then
 	umount_one "dev/pts"
@@ -275,9 +275,11 @@ function mountproc () {
     fi
     if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
 	log "I: mounting selinux filesystem"
-	mkdir -p $BUILDPLACE/selinux
-	mount -t selinuxfs /selinux "$BUILDPLACE/selinux"
-	mounted[${#mounted[@]}]="$BUILDPLACE/selinux"
+	SELINUX="$(grep -m 1 ^selinuxfs /proc/mounts | cut -d ' ' -f 2)"
+	mkdir -p $BUILDPLACE/$SELINUX
+	mount --bind $SELINUX "$BUILDPLACE/$SELINUX"
+	mount -o remount,ro,bind "$BUILDPLACE/$SELINUX"
+	mounted[${#mounted[@]}]="$BUILDPLACE/$SELINUX"
     fi
     MOUNTPARAMS="-obind"
     [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ] && MOUNTPARAMS="-t nullfs"

Attachment: signature.asc
Description: Digital signature

Reply via email to