OpenSDE Framework (without history before r20070)
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.

56 lines
1.6 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: bin/sde-install
  6. # Copyright (C) 2006 - 2008 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. #Description: Install the `sde` wrapper on $HOME/bin/
  16. set -e
  17. [ -n "$SDEROOT" ] ||
  18. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  19. . $SDEROOT/lib/libsde.in
  20. install_usage() {
  21. cat <<EOT
  22. Usage: sde install
  23. Installs a symlink of the sde wrapper at \$HOME/bin/,
  24. which is supposed to be on \$PATH
  25. EOT
  26. }
  27. if [ -n "$SUDO_USER" -a "$SUDO_USER" != "$USER" ]; then
  28. BINDIR="/usr/local/bin"
  29. else
  30. BINDIR="$HOME/bin"
  31. fi
  32. # what action was requested?
  33. if [ $# -ne 0 ]; then
  34. install_usage
  35. elif [ -L "$BINDIR/sde" ]; then
  36. if [ "$( readlink -f $BINDIR/sde )" = "$SDEROOT/bin/sde" ]; then
  37. echo_warning "the same sde wrapper is already installed, skip."
  38. else
  39. echo_warning "sde wrapper already installed [$( readlink -f $BINDIR/sde )]"
  40. ln -sf "$SDEROOT/bin/sde" "$BINDIR/sde"
  41. echo_info "sde wrapper reinstalled at $BINDIR/"
  42. fi
  43. elif [ -e "$BINDIR/sde" ]; then
  44. echo_abort 1 "Something is already at '$BINDIR/sde', this is not supported."
  45. else
  46. mkdir -p "$BINDIR/"
  47. ln -s "$SDEROOT/bin/sde" "$BINDIR/sde"
  48. echo_info "sde wrapper installed at $BINDIR/"
  49. fi