diff --git a/docker.sh b/docker.sh index 823b262..e4b4a0c 100644 --- a/docker.sh +++ b/docker.sh @@ -18,37 +18,47 @@ command_exists() { # This only wokrs for generic package names, like neovim, or vim, or tmux etc.. # not every package packagemanager has the same packagenames for their packages.. getImports() { - i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh" - import="$(mktemp)" - echo "importing $i into $import" - if command_exists curl; then - curl -fsSL $i -o $import - elif command_exists wget; then - wget $i -o $import + 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 - echo "curl/wget is required, but missing.." - exit 1 + # ─< 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" + echo_info "Sourcing external script:${NC} $url" + sleep 0.1 + rm -f "$import" fi - - source "$import" - - sleep 0.3 - - rm "$import" && - echo_warning "cleaned $import" } init_docker() { if command_exists docker; then - echo_info "Docker was installed correctly. Do you want to add $(whoami) to the docker group? (y/n)" - read -r dgroup ─────────────────────────────────────────────────────────────────── unset PACKAGE