pre-inst-env.in 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. # pre-inst-env --- Pre-installation environment for Guile-Daemon
  3. # Copyright (C) 2016 Alex Kost <alezost@gmail.com>
  4. # This file is part of Guile-Daemon.
  5. # Guile-Daemon is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # Guile-Daemon is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with Guile-Daemon. If not, see <http://www.gnu.org/licenses/>.
  17. usage () {
  18. echo 'Usage: '"$0"' COMMAND ARG...
  19. Run COMMAND in a pre-installation environment.
  20. This script allows you to run "guile-daemon", or to use (daemon ...)
  21. modules in a Guile REPL. See the manual for details.'
  22. }
  23. set_env () {
  24. src_modules="@abs_top_srcdir@/modules"
  25. build_modules="@abs_top_builddir@/modules"
  26. GUILE_DAEMON_UNINSTALLED=1
  27. export GUILE_DAEMON_UNINSTALLED
  28. PATH="@abs_top_builddir@/scripts:$PATH"
  29. export PATH
  30. GUILE_LOAD_COMPILED_PATH="${build_modules}${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
  31. GUILE_LOAD_PATH="${src_modules}:${build_modules}${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
  32. export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
  33. }
  34. case "$1" in
  35. -h | --help)
  36. usage
  37. exit 0 ;;
  38. *)
  39. set_env
  40. exec "$@" ;;
  41. esac
  42. # pre-inst-env ends here