chroot-wrapper 402 B

1234567891011121314
  1. #!/bin/sh
  2. # preserve only some variables (like LANG) for some crappy tools.
  3. unset $(printenv | grep -v '^\$' | egrep -v '^(HOME|LOGNAME|PATH|SHELL|TERM|USER|LANG)=' | sed -r 's/^([^=]+)=.*$/\1/' | xargs)
  4. BASENAME="$(basename "${0}")"
  5. case "${BASENAME}" in
  6. npm|bower|grunt|gulp|yarn)
  7. export HOME=${HOME}/tmp
  8. ;;
  9. esac
  10. schroot -c "$(schroot -l | tail -n 1)" -- "${BASENAME}" "${@}"