Browse Source

Redefine HOME while invoking some tools (npm, bower) from the chroot

Emmanuel Bouthenot 8 years ago
parent
commit
500c7a8a02
1 changed files with 9 additions and 1 deletions
  1. 9 1
      tools/web/chroot-wrapper

+ 9 - 1
tools/web/chroot-wrapper

@@ -3,4 +3,12 @@
 # preserve only some variables (like LANG) for some crappy tools.
 unset $(printenv | grep -v '^\$' | egrep -v '^(HOME|LOGNAME|PATH|SHELL|TERM|USER|LANG)=' | sed -r 's/^([^=]+)=.*$/\1/' | xargs)
 
-schroot -c "$(schroot -l | head -1)" -- "$(basename "${0}")" "${@}"
+BASENAME="$(basename "${0}")"
+
+case "${BASENAME}" in
+    npm|bower)
+        export HOME=${HOME}/tmp
+        ;;
+esac
+
+schroot -c "$(schroot -l | head -1)" -- "${BASENAME}" "${@}"