aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-10-11 23:54:25 +0000
committerMattia Rizzolo <mattia@mapreri.org>2015-10-11 23:54:25 +0000
commit524cde2e544f40dc2056d2a4c4265ddc4160784d (patch)
treef1d45cde3bae3d94b8e576fbb014eae6c250fd59
parenta2d1f4d2a6cb4acbab5c299e4ccc6d8c8ffc8603 (diff)
downloadpbuilder-524cde2e544f40dc2056d2a4c4265ddc4160784d.tar
pbuilder-524cde2e544f40dc2056d2a4c4265ddc4160784d.tar.gz
modules: mount correctly selinux: bindmount from the host, and in the same place (/sys/fs/selinux >= wheezy, /selinux < wheezy)
Thanks: ChangZhuo Chen (陳昌倬) <czchen@gmail.com> for the patch. Closes: #734193, #734454
-rw-r--r--pbuilder-modules10
1 files changed, 6 insertions, 4 deletions
diff --git a/pbuilder-modules b/pbuilder-modules
index cd61f89..a983e62 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -214,7 +214,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"
@@ -295,9 +295,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"
+ local 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
if [ "$DEB_BUILD_ARCH_OS" = "hurd" ]; then
# /dev and /servers might have already been mounted at