[pbuilder] 01/01: pbuilder-modules: Use /run/shm as the real tmpfs on kfreebsd

Mattia Rizzolo mattia at debian.org
Sun Mar 12 15:28:43 UTC 2017


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch wip/kbsd-shm
in repository pbuilder.

commit 739ea553c342920f5e6c31e8b61a2a3323e45216
Author: James Clarke <jrtc27 at debian.org>
Date:   Fri Feb 3 15:53:53 2017 +0000

    pbuilder-modules: Use /run/shm as the real tmpfs on kfreebsd
    
    /dev is always a devfs, which does not allow mkdir, but allows symlinks.
---
 pbuilder-modules | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/pbuilder-modules b/pbuilder-modules
index 00300b8..f90dbeb 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -287,8 +287,12 @@ function umountproc () {
     if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ] || [ "$USEDEVFS" = "yes" ]; then
         umount_one "dev"
     fi
-    if [ "$DEB_BUILD_ARCH_OS" != "hurd" ] && [ "$USESHM" = "yes" ]; then
-        umount_one "dev/shm"
+    if [ "$USESHM" = "yes" ]; then
+        if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ]; then
+            umount_one "run/shm"
+        elif [ "$DEB_BUILD_ARCH_OS" != "hurd" ]; then
+            umount_one "dev/shm"
+        fi
     fi
     if [ "$USEPROC" = "yes" ]; then
         if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ -e "$BUILDPLACE/proc/sys/fs/binfmt_misc/status" ]; then
@@ -324,6 +328,7 @@ function umountproc () {
 function mountproc () {
     local -a mounted
     local mnt mntpoint
+    local primary_shm secondary_shm
     if [ "$USEPROC" = "yes" ]; then
         log.i "mounting /proc filesystem"
         mkdir -p "$BUILDPLACE/proc"
@@ -368,19 +373,26 @@ function mountproc () {
     fi
     if [ "$USESHM" = "yes" ]; then
         log.i "creating /{dev,run}/shm"
-        rm -df "$BUILDPLACE/dev/shm" "$BUILDPLACE/run/shm"
-        mkdir -p "$BUILDPLACE/dev/shm"
-        chmod 1777 "$BUILDPLACE/dev/shm"
+        if [ "$DEB_BUILD_ARCH_OS" = "kfreebsd" ]; then
+            primary_shm="run/shm"
+            secondary_shm="dev/shm"
+        else
+            primary_shm="dev/shm"
+            secondary_shm="run/shm"
+        fi
+        rm -df "$BUILDPLACE/$primary_shm" "$BUILDPLACE/$secondary_shm"
+        mkdir -p "$BUILDPLACE/$primary_shm"
+        chmod 1777 "$BUILDPLACE/$primary_shm"
         # old releases might not have /run.  We create it nonetheless, can't harm
-        mkdir -p "$BUILDPLACE/run"
-        ln -s /dev/shm "$BUILDPLACE/run/shm"
+        mkdir -p "$BUILDPLACE/$(dirname "$secondary_shm")"
+        ln -s "/$primary_shm" "$BUILDPLACE/$secondary_shm"
         # /dev gets bind-mounted on hurd. In theory this is before that, but
         # debootstrap will already have mounted it during chroot creation.
         # This seems to cause /hurd/tmpfs to crash, but we can just use the
         # host's /dev/shm.
         if [ "$DEB_BUILD_ARCH_OS" != "hurd" ]; then
-            mount -t tmpfs tmpfs "$BUILDPLACE/dev/shm"
-            mounted[${#mounted[@]}]="$BUILDPLACE/dev/shm"
+            mount -t tmpfs tmpfs "$BUILDPLACE/$primary_shm"
+            mounted[${#mounted[@]}]="$BUILDPLACE/$primary_shm"
         fi
     fi
     if [ "$DEB_BUILD_ARCH_OS" = "linux" ] && [ "$USEDEVPTS" = "yes" ]; then

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/pbuilder.git



More information about the Pbuilder-maint mailing list