🔨 Add mftest --default flag
This commit is contained in:
parent
e616542c89
commit
78fc5acca9
|
@ -30,6 +30,7 @@ OPTIONS
|
||||||
-u --autoupload PIO Upload using the MOTHERBOARD environment.
|
-u --autoupload PIO Upload using the MOTHERBOARD environment.
|
||||||
-v --verbose Extra output for debugging.
|
-v --verbose Extra output for debugging.
|
||||||
-s --silent Silence build output from PlatformIO.
|
-s --silent Silence build output from PlatformIO.
|
||||||
|
-d --default Restore to defaults before applying configs.
|
||||||
|
|
||||||
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
||||||
"
|
"
|
||||||
|
@ -44,6 +45,7 @@ shopt -s extglob nocasematch
|
||||||
|
|
||||||
# Matching patterns
|
# Matching patterns
|
||||||
ISNUM='^[0-9]+$'
|
ISNUM='^[0-9]+$'
|
||||||
|
ISRST='^(restore)_'
|
||||||
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
||||||
ISEXEC='^exec_'
|
ISEXEC='^exec_'
|
||||||
ISCONT='\\ *$'
|
ISCONT='\\ *$'
|
||||||
|
@ -53,9 +55,10 @@ TESTENV='-'
|
||||||
CHOICE=0
|
CHOICE=0
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
|
|
||||||
while getopts 'abhmrsuvyn:t:-:' OFLAG; do
|
while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
|
||||||
case "${OFLAG}" in
|
case "${OFLAG}" in
|
||||||
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
||||||
|
d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
||||||
h) EXIT_USAGE=1 ;;
|
h) EXIT_USAGE=1 ;;
|
||||||
m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
||||||
n) case "$OPTARG" in
|
n) case "$OPTARG" in
|
||||||
|
@ -88,6 +91,7 @@ while getopts 'abhmrsuvyn:t:-:' OFLAG; do
|
||||||
silent) SILENT_FLAG="-s" ;;
|
silent) SILENT_FLAG="-s" ;;
|
||||||
make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
||||||
debug|verbose) DEBUG=1 ; bugout "Debug ON" ;;
|
debug|verbose) DEBUG=1 ; bugout "Debug ON" ;;
|
||||||
|
default) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
||||||
build) case "$OVAL" in
|
build) case "$OVAL" in
|
||||||
''|y|yes) BUILD_YES='Y' ;;
|
''|y|yes) BUILD_YES='Y' ;;
|
||||||
n|no) BUILD_YES='N' ;;
|
n|no) BUILD_YES='N' ;;
|
||||||
|
@ -282,6 +286,11 @@ if [[ $CHOICE == 0 ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Restore to defaults if requested
|
||||||
|
#
|
||||||
|
((DL_DEFAULTS)) && use_example_configs
|
||||||
|
|
||||||
#
|
#
|
||||||
# Run the specified test lines
|
# Run the specified test lines
|
||||||
#
|
#
|
||||||
|
@ -303,6 +312,7 @@ echo "$OUT" | {
|
||||||
}
|
}
|
||||||
((IND == CHOICE)) && {
|
((IND == CHOICE)) && {
|
||||||
GOTX=1
|
GOTX=1
|
||||||
|
[[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs"
|
||||||
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' )
|
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' )
|
||||||
[[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; }
|
[[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,27 +9,35 @@
|
||||||
# If a configpath has spaces (or quotes) escape them or enquote the path
|
# If a configpath has spaces (or quotes) escape them or enquote the path
|
||||||
#
|
#
|
||||||
|
|
||||||
|
which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot'
|
||||||
|
which wget >/dev/null && TOOL='wget -q -O wgot'
|
||||||
|
|
||||||
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
|
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
|
||||||
[[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x
|
[[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x
|
||||||
|
|
||||||
IFS=: read -r PART1 PART2 <<< "$@"
|
REPO=$BRANCH
|
||||||
[[ -n $PART2 ]] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \
|
|
||||||
|| { REPO=$BRANCH ; RDIR="${PART1// /%20}" ; }
|
|
||||||
EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples"
|
|
||||||
|
|
||||||
which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot'
|
if [[ $# > 0 ]]; then
|
||||||
which wget >/dev/null && TOOL='wget -q -O wgot'
|
IFS=: read -r PART1 PART2 <<< "$@"
|
||||||
|
[[ -n $PART2 ]] && { UDIR="$PART2" ; REPO="$PART1" ; } \
|
||||||
|
|| { UDIR="$PART1" ; }
|
||||||
|
RDIR="${UDIR// /%20}"
|
||||||
|
echo "Fetching $UDIR configurations from $REPO..."
|
||||||
|
EXAMPLES="examples/$RDIR"
|
||||||
|
else
|
||||||
|
EXAMPLES="default"
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIGS="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/${EXAMPLES}"
|
||||||
|
|
||||||
restore_configs
|
restore_configs
|
||||||
|
|
||||||
cd Marlin
|
cd Marlin
|
||||||
|
|
||||||
echo "Fetching $RDIR configurations from $REPO..."
|
$TOOL "$CONFIGS/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
||||||
|
$TOOL "$CONFIGS/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h
|
||||||
$TOOL "$EXAMPLES/$RDIR/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
$TOOL "$CONFIGS/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h
|
||||||
$TOOL "$EXAMPLES/$RDIR/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h
|
$TOOL "$CONFIGS/_Statusscreen.h" >/dev/null 2>&1 && mv wgot _Statusscreen.h
|
||||||
$TOOL "$EXAMPLES/$RDIR/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h
|
|
||||||
$TOOL "$EXAMPLES/$RDIR/_Statusscreen.h" >/dev/null 2>&1 && mv wgot _Statusscreen.h
|
|
||||||
|
|
||||||
rm -f wgot
|
rm -f wgot
|
||||||
cd - >/dev/null
|
cd - >/dev/null
|
||||||
|
|
Loading…
Reference in a new issue