|
@@ -1,10 +1,20 @@
|
1
|
1
|
#!/usr/bin/env bash
|
|
2
|
+#
|
|
3
|
+# use_example_configs [repo:]configpath
|
|
4
|
+#
|
|
5
|
+# Examples:
|
|
6
|
+# use_example_configs Creality/CR-10/CrealityV1
|
|
7
|
+# use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1
|
|
8
|
+#
|
|
9
|
+# If a configpath has spaces (or quotes) escape them or enquote the path
|
|
10
|
+#
|
2
|
11
|
|
3
|
|
-BRANCH=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
|
|
12
|
+CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
|
|
13
|
+[[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x
|
4
|
14
|
|
5
|
15
|
IFS=: read -r PART1 PART2 <<< "$@"
|
6
|
|
-[ -n "${PART2}" ] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \
|
7
|
|
- || { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; }
|
|
16
|
+[[ -n $PART2 ]] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \
|
|
17
|
+ || { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; }
|
8
|
18
|
EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples"
|
9
|
19
|
|
10
|
20
|
which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot'
|
|
@@ -14,6 +24,8 @@ restore_configs
|
14
|
24
|
|
15
|
25
|
cd Marlin
|
16
|
26
|
|
|
27
|
+echo "Fetching $RDIR configurations from $REPO..."
|
|
28
|
+
|
17
|
29
|
$TOOL "$EXAMPLES/$RDIR/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
18
|
30
|
$TOOL "$EXAMPLES/$RDIR/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h
|
19
|
31
|
$TOOL "$EXAMPLES/$RDIR/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h
|