pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/mksandbox



Module Name:    pkgsrc
Committed By:   agc
Date:           Tue Dec  5 20:45:27 UTC 2023

Modified Files:
        pkgsrc/pkgtools/mksandbox: Makefile
        pkgsrc/pkgtools/mksandbox/files: mksandbox

Log Message:
pkgtools/mksandbox - update to version 1.11

+ Don't allow mounting of already mounted sandboxes, or unmounting of
unmounted sandboxes.

+ Also, add an extra "ismounted" case label to be able to tell if a
sandbox is mounted. A df(1) invocation should continue to work just
as well :)

No objections on tech-pkg@

Addresses the first part of PR pkg/51992 from Paul Goyette


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 pkgsrc/pkgtools/mksandbox/Makefile
cvs rdiff -u -r1.18 -r1.19 pkgsrc/pkgtools/mksandbox/files/mksandbox

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/mksandbox/Makefile
diff -u pkgsrc/pkgtools/mksandbox/Makefile:1.18 pkgsrc/pkgtools/mksandbox/Makefile:1.19
--- pkgsrc/pkgtools/mksandbox/Makefile:1.18     Thu Aug 31 20:14:35 2023
+++ pkgsrc/pkgtools/mksandbox/Makefile  Tue Dec  5 20:45:27 2023
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.18 2023/08/31 20:14:35 triaxx Exp $
+# $NetBSD: Makefile,v 1.19 2023/12/05 20:45:27 agc Exp $
 
-PKGNAME=       mksandbox-1.10
+PKGNAME=       mksandbox-1.11
 CATEGORIES=    pkgtools
 
 MAINTAINER=    agc%NetBSD.org@localhost

Index: pkgsrc/pkgtools/mksandbox/files/mksandbox
diff -u pkgsrc/pkgtools/mksandbox/files/mksandbox:1.18 pkgsrc/pkgtools/mksandbox/files/mksandbox:1.19
--- pkgsrc/pkgtools/mksandbox/files/mksandbox:1.18      Fri Jan 22 11:59:52 2021
+++ pkgsrc/pkgtools/mksandbox/files/mksandbox   Tue Dec  5 20:45:27 2023
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mksandbox,v 1.18 2021/01/22 11:59:52 jperkin Exp $
+# $NetBSD: mksandbox,v 1.19 2023/12/05 20:45:27 agc Exp $
 
 # Copyright (c) 2002,2012 Alistair Crooks <agc%NetBSD.org@localhost>
 # All rights reserved.
@@ -26,8 +26,9 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-# Usage: mksandbox [--mounthost=host] [--rodirs=dir1,...] [--rwdirs=dir1,...]
-#                 [--pkgsrc=dir] [--src=srcdir] [--xsrc=xsrcdir]
+# Usage: mksandbox [--mounthost=host] [--pkgsrc=dir]
+#                 [--rodirs=dir1,...] [--rwdirs=dir1,...]
+#                 [--src=srcdir] [--xsrc=xsrcdir]
 #                 [--without-src] [--without-pkgsrc] [--without-xsrc]
 #                 [--without-x] [--verbose] sandbox-dir
 #
@@ -418,10 +419,15 @@ if [ -n "$rwdirs" ]; then
        done
 fi
 
+date > $sandbox/.sandbox_mounted
+
 cat >> $sandbox_script <<EOS
 "
 case x\$1 in
 xmount)
+       if [ -s \$sandbox/.sandbox_mounted ]; then
+               echo \$sandbox already mounted && exit 1
+       fi
        set dummy \$fses
        shift
        while [ \$# -ge 3 ]; do
@@ -446,8 +452,12 @@ xmount)
                $mountprog -F fd fd \$sandbox/dev/fd
                ;;
        esac
+       date > \$sandbox/.sandbox_mounted
        ;;
 xumount)
+       if [ ! -s \$sandbox/.sandbox_mounted ]; then
+               echo \$sandbox not mounted && exit 1
+       fi
        set dummy \`r3 \$fses\`
        shift
        while [ \$# -ge 3 ]; do
@@ -469,8 +479,12 @@ xumount)
                umount \$sandbox/dev
                ;;
        esac
+       rm -f \$sandbox/.sandbox_mounted
        ;;
 xchroot)
+       if [ ! -s \$sandbox/.sandbox_mounted ]; then
+               echo \$sandbox not mounted && exit 1
+       fi
        case x\$2 in
        x)      rootshell=/bin/ksh ;;
        *)      rootshell="\$2" ;;
@@ -482,6 +496,13 @@ xchroot)
        ENV=/etc/shrc chroot \$sandbox /tmp/\`basename \$script\`
        rm -f \$script
        ;;
+xismounted)
+       if [ -s \$sandbox/.sandbox_mounted ]; then
+               echo \$sandbox is mounted && exit 0
+       else
+               echo \$sandbox is not mounted && exit 1
+       fi
+       ;;
 *)
        if [ \$# -eq 0 ]; then
                set dummy /bin/sh



Home | Main Index | Thread Index | Old Index