You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

63 lines
2.2 KiB

  1. #!/bin/sh
  2. # GNU Guix --- Functional package management for GNU
  3. # Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
  4. #
  5. # This file is part of GNU Guix.
  6. #
  7. # GNU Guix is free software; you can redistribute it and/or modify it
  8. # under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # GNU Guix is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. # Usage: ./pre-inst-env COMMAND ARG...
  20. #
  21. # Run COMMAND in a pre-installation environment. Typical use is
  22. # "./pre-inst-env guix-build hello".
  23. # By default we may end up with absolute directory names that contain '..',
  24. # which get into $GUILE_LOAD_PATH, leading to '..' in the module file names
  25. # recorded by Guile. To avoid that, make sure we get a real absolute
  26. # directory name.
  27. abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd`"
  28. abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`"
  29. GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
  30. GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH"
  31. export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
  32. # Define $PATH so that `guix' and friends are easily found.
  33. PATH="$abs_top_builddir/scripts:$abs_top_builddir:$PATH"
  34. export PATH
  35. # Daemon helpers.
  36. NIX_ROOT_FINDER="$abs_top_builddir/nix/scripts/list-runtime-roots"
  37. NIX_SUBSTITUTERS="$abs_top_builddir/nix/scripts/substitute-binary"
  38. NIX_SETUID_HELPER="$abs_top_builddir/nix-setuid-helper"
  39. export NIX_ROOT_FINDER NIX_SETUID_HELPER NIX_SUBSTITUTERS
  40. # The following variables need only be defined when compiling Guix
  41. # modules, but we define them to be on the safe side in case of
  42. # auto-compilation.
  43. NIX_HASH="@NIX_HASH@"
  44. export NIX_HASH
  45. # Define $GUIX_UNINSTALLED to prevent `guix' from
  46. # prepending @guilemoduledir@ to the Guile load paths.
  47. GUIX_UNINSTALLED=1
  48. export GUIX_UNINSTALLED
  49. exec "$@"