self updater

This commit is contained in:
2022-04-29 12:43:27 +03:00
parent 628e5365bf
commit 7417be1b5c

8
bake
View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
## VERSION 22.4.2 ## VERSION 22.4.3
## BASH-MAKE ========================================================== ## BASH-MAKE ==========================================================
## Utility to mimick some of GNU Make behavior, but run in a single ## Utility to mimick some of GNU Make behavior, but run in a single
## bash shell. This executable can be used as the Bakefile, too, ## bash shell. This executable can be used as the Bakefile, too,
@@ -101,10 +101,14 @@ _source_bakefile() {
fi fi
. "$BAKEFILE" . "$BAKEFILE"
fi; } fi; }
_update_self() {
curl -S -f -o "$0" -z "$0" \
"https://raw.githubusercontent.com/moonq/bake/main/bake"
}
for (( i=1; i<=$#; i++ )); do for (( i=1; i<=$#; i++ )); do
if [[ $i -eq 1 ]]; then if [[ $i -eq 1 ]]; then
if [[ "${!i}" = "__list__" ]]; then _flines | sed 's/().*//'; exit; fi if [[ "${!i}" = "__list__" ]]; then _flines | sed 's/().*//'; exit; fi
if [[ "${!i}" = "__update__" ]]; then _update_self; exit; fi
fi fi
j=$(( i + 1 )) j=$(( i + 1 ))
if [[ "${!i}" = "-m" ]]; then _smenu; exit; fi if [[ "${!i}" = "-m" ]]; then _smenu; exit; fi