Fix scripts using gawk and wget
This commit is contained in:
parent
069993e880
commit
cae4c76b56
|
@ -1,18 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
IFS=: read -r PART1 PART2 <<< "$@"
|
||||
[ -n "${PART2}" ] && { REPO="$PART1" ; RDIR="$PART2" ; } \
|
||||
|| { REPO=bugfix-2.0.x ; RDIR="$PART1" ; }
|
||||
[ -n "${PART2}" ] && { REPO="$PART1" ; RDIR="${PART2// /%20}" ; } \
|
||||
|| { REPO=bugfix-2.0.x ; 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'
|
||||
which wget >/dev/null && TOOL='wget -q -O wgot'
|
||||
|
||||
restore_configs
|
||||
|
||||
cd Marlin
|
||||
|
||||
wget -q "$EXAMPLES/$RDIR/Configuration.h" -O wgot && mv wgot Configuration.h
|
||||
wget -q "$EXAMPLES/$RDIR/Configuration_adv.h" -O wgot && mv wgot Configuration_adv.h
|
||||
wget -q "$EXAMPLES/$RDIR/_Bootscreen.h" -O wgot && mv wgot _Bootscreen.h
|
||||
wget -q "$EXAMPLES/$RDIR/_Statusscreen.h" -O wgot && mv wgot _Statusscreen.h
|
||||
rm -f wgot
|
||||
$TOOL "$EXAMPLES/$RDIR/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
||||
$TOOL "$EXAMPLES/$RDIR/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
||||
$TOOL "$EXAMPLES/$RDIR/_Bootscreen.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
||||
$TOOL "$EXAMPLES/$RDIR/_Statusscreen.h" >/dev/null 2>&1 && mv wgot Configuration.h
|
||||
|
||||
rm -f wgot
|
||||
cd - >/dev/null
|
||||
|
|
|
@ -139,11 +139,14 @@ BEGIN {
|
|||
}
|
||||
EOF
|
||||
|
||||
which awk >/dev/null && AWK=awk
|
||||
which gawk >/dev/null && AWK=gawk
|
||||
|
||||
grep -Hrn _UxGT . | grep '"' \
|
||||
| sed 's/_UxGT("/\n&/g;s/[^\n]*\n_UxGT("\([^"]*\)[^\n]*/\1 /g;s/.$//' \
|
||||
| ${EXEC_GENPAGES} \
|
||||
| sort -k 1n -k 2n | uniq \
|
||||
| gawk -v EXEC_PREFIX=${DN_EXEC} -f "proc.awk" \
|
||||
| "$AWK" -v EXEC_PREFIX=${DN_EXEC} -f "proc.awk" \
|
||||
| while read PAGE BEGIN END UTF8BEGIN UTF8END; do \
|
||||
if [ ! -f ${DN_DATA}/fontpage_${PAGE}_${BEGIN}_${END}.h ]; then \
|
||||
${EXEC_BDF2U8G} -u ${PAGE} -b ${BEGIN} -e ${END} ${FN_FONT} fontpage_${PAGE}_${BEGIN}_${END} ${DN_DATA}/fontpage_${PAGE}_${BEGIN}_${END}.h > /dev/null 2>&1 ;
|
||||
|
|
|
@ -13,14 +13,17 @@ case "$1" in
|
|||
-[Hh]) TYPE=HTTPS ; MATCH="git@" ; FORMULA="$GH_SSH/$GH_HTTPS" ;;
|
||||
-[Ss]) TYPE=SSH ; MATCH="https:" ; FORMULA="$GH_HTTPS/$GH_SSH" ;;
|
||||
*)
|
||||
echo "usage: `basename $0` -h | -s" 1>&2
|
||||
echo "Usage: `basename $0` -h | -s" 1>&2
|
||||
echo -e " \e[0;92m-h\e[0m to switch to HTTPS" 1>&2
|
||||
echo -e " \e[0;92m-s\e[0m to switch to SSH" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
REMOTES=$(git remote -v | egrep "\t$MATCH" | gawk '{print $1 " " $2}' | sort -u | sed "s/$FORMULA/")
|
||||
which awk >/dev/null && AWK=awk
|
||||
which gawk >/dev/null && AWK=gawk
|
||||
|
||||
REMOTES=$(git remote -v | egrep "\t$MATCH" | "$AWK" '{print $1 " " $2}' | sort -u | sed "s/$FORMULA/")
|
||||
|
||||
if [[ -z $REMOTES ]]; then
|
||||
echo "Nothing to do." ; exit
|
||||
|
@ -29,5 +32,5 @@ fi
|
|||
echo "$REMOTES" | xargs -n2 git remote set-url
|
||||
|
||||
echo -n "Remotes set to $TYPE: "
|
||||
echo "$REMOTES" | gawk '{printf "%s ", $1}'
|
||||
echo "$REMOTES" | "$AWK" '{printf "%s ", $1}'
|
||||
echo
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
# Great way to clean up your branches after messing around a lot
|
||||
#
|
||||
|
||||
which awk >/dev/null && AWK=awk
|
||||
which gawk >/dev/null && AWK=gawk
|
||||
|
||||
KEEP="RC|RCBugFix|dev|master|bugfix-1|bugfix-2"
|
||||
|
||||
echo "Fetching latest upstream and origin..."
|
||||
|
@ -18,7 +21,7 @@ git branch --merged | egrep -v "^\*|$KEEP" | xargs -n 1 git branch -d
|
|||
echo
|
||||
|
||||
echo "Pruning Remotely-deleted Branches..."
|
||||
git branch -vv | egrep -v "^\*|$KEEP" | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D
|
||||
git branch -vv | egrep -v "^\*|$KEEP" | grep ': gone]' | "$AWK" '{print $1}' | xargs -n 1 git branch -D
|
||||
echo
|
||||
|
||||
# List fork branches that don't match local branches
|
||||
|
|
Loading…
Reference in a new issue