Sun Sep 20 10:24:00 2009 UTC ()
Avoid hardcoding sandbox location in a shell script.


(wiz)
diff -r1.51 -r1.52 pkgsrc/mk/bulk/mksandbox

cvs diff -r1.51 -r1.52 pkgsrc/mk/bulk/Attic/mksandbox (expand / switch to unified diff)

--- pkgsrc/mk/bulk/Attic/mksandbox 2009/09/06 19:43:18 1.51
+++ pkgsrc/mk/bulk/Attic/mksandbox 2009/09/20 10:24:00 1.52
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#! /bin/sh 1#! /bin/sh
2 2
3# $NetBSD: mksandbox,v 1.51 2009/09/06 19:43:18 wiz Exp $ 3# $NetBSD: mksandbox,v 1.52 2009/09/20 10:24:00 wiz Exp $
4# 4#
5# 5#
6# Copyright (c) 2002 Alistair G. Crooks. All rights reserved. 6# Copyright (c) 2002 Alistair G. Crooks. All rights reserved.
7# 7#
8# Redistribution and use in source and binary forms, with or without 8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions 9# modification, are permitted provided that the following conditions
10# are met: 10# are met:
11# 1. Redistributions of source code must retain the above copyright 11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer. 12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright 13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the 14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution. 15# documentation and/or other materials provided with the distribution.
16# 3. All advertising materials mentioning features or use of this software 16# 3. All advertising materials mentioning features or use of this software
@@ -350,27 +350,27 @@ case x\$1 in @@ -350,27 +350,27 @@ case x\$1 in
350 shift 350 shift
351 while [ \$# -ge 3 ]; do 351 while [ \$# -ge 3 ]; do
352 fs=\$1; shift 352 fs=\$1; shift
353 mntpoint=\$1; shift 353 mntpoint=\$1; shift
354 dummy=\$1; shift 354 dummy=\$1; shift
355 umount \$sandbox/\$mntpoint 355 umount \$sandbox/\$mntpoint
356 done 356 done
357 ;; 357 ;;
358 xchroot) 358 xchroot)
359 case x\$2 in 359 case x\$2 in
360 x) rootshell=/bin/ksh ;; 360 x) rootshell=/bin/ksh ;;
361 *) rootshell="\$2" ;; 361 *) rootshell="\$2" ;;
362 esac 362 esac
363 script="$sandbox/tmp/script.\$\$" 363 script="\$sandbox/tmp/script.\$\$"
364 echo "#!/bin/sh" > \$script 364 echo "#!/bin/sh" > \$script
365 echo "ENV=/etc/shrc \$rootshell" >> \$script 365 echo "ENV=/etc/shrc \$rootshell" >> \$script
366 chmod +x \$script 366 chmod +x \$script
367 ENV=/etc/shrc chroot \$sandbox /tmp/\`basename \$script\` 367 ENV=/etc/shrc chroot \$sandbox /tmp/\`basename \$script\`
368 rm -f \$script 368 rm -f \$script
369 ;; 369 ;;
370 *) 370 *)
371 if [ \$# -eq 0 ]; then 371 if [ \$# -eq 0 ]; then
372 set dummy /bin/sh 372 set dummy /bin/sh
373 shift 373 shift
374 fi 374 fi
375 chroot \$sandbox "\$@" 375 chroot \$sandbox "\$@"
376 ;; 376 ;;