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.

75 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-create-tree
  6. # Copyright (C) 2008 - 2009 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: Creates a new OpenSDE working tree
  16. [ -n "$SDEROOT" ] ||
  17. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  18. . "$SDEROOT/lib/libsde.in"
  19. create_usage() {
  20. local progname=$(echo ${0##*/} | tr '-' ' ')
  21. echo "Usage: $progname <dirname>"
  22. }
  23. create_origin()
  24. {
  25. if [ -d "$SDEROOT/.git/" ]; then
  26. GIT_DIR="$SDEROOT/.git" git config remote.origin.url
  27. fi
  28. }
  29. shortopts=''
  30. longopts=''
  31. options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
  32. if [ $? -ne 0 ]; then
  33. create_usage
  34. exit -1
  35. fi
  36. # load new arguments list
  37. eval set -- "$options"
  38. while [ $# -gt 0 ]; do
  39. case "$1" in
  40. --) shift; break ;;
  41. esac
  42. shift
  43. done
  44. # dirname
  45. if [ $# -ne 1 ]; then
  46. create_usage
  47. exit 1
  48. fi
  49. here=$(pwd -P)
  50. if [ "$SDEROOT" = "$here" ] || expr "$here" : "$SDEROOT/" > /dev/null; then
  51. echo_abort 1 "Already inside a working tree."
  52. fi
  53. origin=$(create_origin)
  54. origin="${origin:-git://git.opensde.net/opensde/opensde-nopast.git}"
  55. target="$1"
  56. echo_info "Cloning $origin"
  57. if git clone "$origin" "$target"; then
  58. cd "$target"
  59. export SDEROOT="$(pwd -P)"
  60. exec sde up
  61. fi