setup.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. show_br_commit () {
  3. local path="$1"; shift
  4. local branch
  5. local commit
  6. local repo
  7. (
  8. cd $path
  9. path=$(readlink -f $path 2>/dev/null || pwd)
  10. repo=$(basename -s .git `git config --get remote.origin.url`)
  11. commit=$(git rev-parse --verify HEAD | sed -e "s%^heads/%%" |cut -c 1-8)
  12. branch=$(git rev-parse --abbrev-ref HEAD |sed -e "s%^heads/%%")
  13. echo "repo: $repo; branch: $branch; commit: $commit; path: $path"
  14. )
  15. }
  16. echo "🗃 Initializing git repository..."
  17. DEFAULT_GIT_PREFIX="https://github.com/yunionio"
  18. BRANCH=$(git rev-parse --abbrev-ref HEAD)
  19. if [ $DEV_SETUP ]
  20. then
  21. read -p "Please enter git prefix: " DEFAULT_GIT_PREFIX
  22. fi
  23. echo $DEFAULT_GIT_PREFIX
  24. echo $BRANCH
  25. if [ ! -d "./src" ]; then
  26. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-common.git src
  27. fi
  28. if [ ! -d "./containers" ]; then
  29. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-cloudenv.git containers/Cloudenv
  30. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-compute.git containers/Compute
  31. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-network.git containers/Network
  32. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-dashboard.git containers/Dashboard
  33. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-storage.git containers/Storage
  34. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-db.git containers/DB
  35. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-k8s.git containers/K8S
  36. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-helm.git containers/Helm
  37. git clone -b $BRANCH $DEFAULT_GIT_PREFIX/dashboard-module-monitor.git containers/Monitor
  38. fi
  39. echo
  40. echo "show branch infor under Dashboard... "
  41. for repo in src containers/*
  42. do
  43. show_br_commit $repo
  44. done
  45. echo
  46. echo "🗃 Done"