From 67fed76c689451442208a6dc7872bc93675cdf7c Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Fri, 21 Jun 2024 22:35:59 +0200 Subject: [PATCH] Add faster group-detection in autoinstall (dynamic groups are now impossible) Allow for absolute paths in autoinstall exe Add timer in run.sh --- autoinstall/file_command.sh | 2 +- autoinstall/run_command.sh | 24 +++++++++++------------- run.sh | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/autoinstall/file_command.sh b/autoinstall/file_command.sh index 08e9519..f145fab 100644 --- a/autoinstall/file_command.sh +++ b/autoinstall/file_command.sh @@ -5,7 +5,7 @@ completions=${args[--completions]:-} target=${args[target]:?} url=${args[url]:?} -if [ "${action:-file}" = "exe" ] +if [ "${action:-file}" = "exe" ] && ! echo "$target" | grep -q "/" then if [ -x "$(command -v "$target")" ] then diff --git a/autoinstall/run_command.sh b/autoinstall/run_command.sh index b3b77b6..5ea6714 100644 --- a/autoinstall/run_command.sh +++ b/autoinstall/run_command.sh @@ -47,29 +47,18 @@ _handle_entry() { AUTOINSTALL_ITEM_TARGET \ AUTOINSTALL_ITEM_HOOK \ AUTOINSTALL_ITEM_PIPE \ - AUTOINSTALL_ITEM_COMPLETIONS \ - AUTOINSTALL_ITEM_GROUPS + AUTOINSTALL_ITEM_COMPLETIONS eval "$1" # check if we have the required vars if [[ -z "${AUTOINSTALL_ITEM_TYPE:-}" \ || -z "${AUTOINSTALL_ITEM_SOURCE:-}" \ - || -z "${AUTOINSTALL_ITEM_TARGET:-}" \ - || -z "${AUTOINSTALL_ITEM_GROUPS:-}" ]] + || -z "${AUTOINSTALL_ITEM_TARGET:-}" ]] then return fi - if [[ "$group" != "all" ]] - then - # check if group is in groups - if [[ ! "${AUTOINSTALL_ITEM_GROUPS}" =~ (^|,)$group(,|$) ]] - then - return - fi - fi - _install_entry "$AUTOINSTALL_ITEM_TYPE" "$AUTOINSTALL_ITEM_SOURCE" \ "$AUTOINSTALL_ITEM_TARGET" "${AUTOINSTALL_ITEM_HOOK:-}" "${AUTOINSTALL_ITEM_PIPE:-}" "${AUTOINSTALL_ITEM_COMPLETIONS:-}" @@ -86,5 +75,14 @@ while [[ $line -lt $file_lines ]]; do continue fi + if [[ "$group" != "all" ]] + then + # check if group is in groups + if ! echo "$entry" | grep -qE "^AUTOINSTALL_ITEM_GROUPS=\"(.*,)?$group(,.*)?\"$" + then + continue + fi + fi + _handle_entry "$entry" || true # ignore errors done diff --git a/run.sh b/run.sh index 7cb49dc..155b243 100755 --- a/run.sh +++ b/run.sh @@ -8,4 +8,4 @@ make generate printf "\nBuild complete. Running...\n==========================\n\n" -"./output/$target" "$@" +time "./output/$target" "$@"