dchroot-exec 596 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # Very simple wrapper around the DSA version of dchroot
  3. # on the Debian porter boxes. dchroot only accepts one command
  4. # as argument, nothing else. This wrapper creates a temporary script
  5. # which will be executed then.
  6. # This file is Copyright (c) 2010 by the GPSD project
  7. # BSD terms apply: see the file COPYING in the distribution root for details.
  8. dchroot="$1"
  9. shift
  10. command="$1"
  11. shift
  12. arguments="$@"
  13. tmpfile=`mktemp $HOME/XXXXXXXXX.tmp`
  14. cat > $tmpfile << _EOF_
  15. #!/bin/bash
  16. exec $command $arguments
  17. _EOF_
  18. chmod 755 $tmpfile
  19. /usr/bin/dchroot $dchroot $tmpfile
  20. rm -f $tmpfile