From 755901b6c58441aa039ba0d4b0df49f76e694833 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 19 May 2025 18:46:21 +0200 Subject: [PATCH] evolving --- distros.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/distros.sh b/distros.sh index 39790dd..2cf1476 100755 --- a/distros.sh +++ b/distros.sh @@ -127,6 +127,32 @@ silentexec() { "$@" >/dev/null 2>&1 } +source_script() { + local url="$1" + local import="$(mktemp)" + + # ─< if $1 is a local file, source this one instead >───────────────────────────────────── + if [ -f "$url" ]; then + source "$url" + sleep 0.1 + return 0 + else + # ─< if $1 is a url, grab it and source it, also deletes afterwards >───────────────────── + if command_exists curl; then + curl -fsSL $url -o $import + elif command_exists wget; then + wget -o $import $url + else + echo "curl/wget is required, but missing.." + exit 69 + fi + + source "$import" + sleep 0.1 + rm -f "$import" + fi +} + run() { if $silent; then silentexec "$@"