My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env bash
  2. #
  3. # mfinfo
  4. #
  5. # Provide the following info about the working directory:
  6. #
  7. # - Remote (upstream) Org name (MarlinFirmware)
  8. # - Remote (origin) Org name (your Github username)
  9. # - Repo Name (Marlin, MarlinDocumentation)
  10. # - PR Target branch (bugfix-1.1.x, bugfix-2.0.x, dev-2.1.x, etc.)
  11. # - Branch Arg (the branch argument or current branch)
  12. # - Current Branch
  13. #
  14. usage() {
  15. echo "Usage: `basename $0` [1|2] [branch]" 1>&2
  16. }
  17. CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
  18. [[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; }
  19. [[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; }
  20. REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
  21. [[ -z $REPO ]] && { echo "`basename $0`: No 'upstream' remote found. (Did you run mfinit?)" 1>&2 ; exit 1; }
  22. ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
  23. [[ $ORG == MarlinFirmware ]] || { echo "`basename $0`: Not a Marlin repository." 1>&2 ; exit 1; }
  24. FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
  25. # Defaults if no arguments given
  26. BRANCH=$CURR
  27. INDEX=1
  28. while [[ $# -gt 0 ]]; do
  29. opt="$1" ; shift ; val="$1"
  30. IFS='=' read -a PARTS <<<"$opt"
  31. [[ "${PARTS[1]}" != "" ]] && { EQUALS=1 ; opt="${PARTS[0]}" ; val="${PARTS[1]}" ; }
  32. GOODVAL=1
  33. if [[ "$val" =~ ^-{1,2}.* || ! "$opt" =~ ^-{1,2}.* ]]; then
  34. GOODVAL=0
  35. val=""
  36. fi
  37. case "$opt" in
  38. -*|--*) MORE="$MORE$opt " ; [[ $EQUALS == 1 ]] && MORE="$MORE=$val" ;;
  39. 1|2|3) INDEX=$opt ;;
  40. *) BRANCH="$opt" ;;
  41. esac
  42. done
  43. case "$REPO" in
  44. Marlin ) TARG=bugfix-1.1.x ; [[ $INDEX == 2 ]] && TARG=bugfix-2.0.x ; [[ $INDEX == 3 ]] && TARG=dev-2.1.x ;;
  45. MarlinDocumentation ) TARG=master ;;
  46. esac
  47. [[ $BRANCH =~ ^[123]$ ]] && USAGE=1
  48. [[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3] [branch]" 1>&2 ; exit 1 ; }
  49. echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE"