Compare commits
No commits in common. "4ef6f591f6a5e045587fe6c128d1cfee5f92ad51" and "f26c5b3cc29d3e2cbb7429cf1ca15605457d3f0d" have entirely different histories.
4ef6f591f6
...
f26c5b3cc2
|
@ -4,29 +4,23 @@
|
||||||
# - uneeded, as this checked whether script is sourced
|
# - uneeded, as this checked whether script is sourced
|
||||||
# SC1090 Can't follow non-constant source
|
# SC1090 Can't follow non-constant source
|
||||||
|
|
||||||
# Use basename instead of ${0:##*/} to be POSIX compliant
|
# User basename instead of ${0:##*/} to be POSIX compliant
|
||||||
# Some shells return -<name> in $0 when sourced, ${0#-} drops that initial dash
|
BASE_0=${BASE_0:-$(basename ${0#-})}
|
||||||
BASE_0=${BASE_0:-$(basename -- "${0#-}")}
|
|
||||||
SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"}
|
SCRIPT_DIR=${SCRIPT_DIR:-"$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )"}
|
||||||
BASE_SHELL=$(basename "$SHELL")
|
BASE_SHELL=$(basename "$SHELL")
|
||||||
|
|
||||||
# Helper function
|
# Helper function
|
||||||
is_sourced() {
|
is_sourced() {
|
||||||
DBG_="$(
|
|
||||||
printf '\n\t\t%-12s%s' '$0:' "$0" BASE_0: "$BASE_0" BASE_SHELL: "$BASE_SHELL"
|
|
||||||
)"
|
|
||||||
if [ -n "$ZSH_VERSION" ]; then
|
if [ -n "$ZSH_VERSION" ]; then
|
||||||
case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac
|
case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac
|
||||||
else
|
else
|
||||||
case "$(basename -- "${0}")" in $BASE_SHELL|-$BASE_SHELL) return 0;; esac
|
# case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac
|
||||||
|
case "${BASE_0}" in $BASE_SHELL|-$BASE_SHELL) return 0;; esac
|
||||||
fi
|
fi
|
||||||
return 1; # NOT sourced.
|
return 1; # NOT sourced.
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$1" == '-' ]]; then
|
if is_sourced; then
|
||||||
printf 'BASE_0="%s"\nSCRIPT_DIR=%s\n' "${BASE_0}" "${SCRIPT_DIR}"
|
|
||||||
cat "${BASH_SOURCE[0]}"
|
|
||||||
elif is_sourced; then
|
|
||||||
# This part is sourced, and might run in a non-bash shell
|
# This part is sourced, and might run in a non-bash shell
|
||||||
DBG_="Is Sourced"
|
DBG_="Is Sourced"
|
||||||
USER_HOME=$HOME
|
USER_HOME=$HOME
|
||||||
|
@ -113,6 +107,9 @@ elif is_sourced; then
|
||||||
kubectl get "${NS:+--namespace=}${NS:---all-namespaces}" "${@:-pods}" | { sed -u 1q; sort; }
|
kubectl get "${NS:+--namespace=}${NS:---all-namespaces}" "${@:-pods}" | { sed -u 1q; sort; }
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$1" == '-' ]]; then
|
||||||
|
printf 'BASE_0="%s"\nSCRIPT_DIR=%s\n' "${BASE_0}" "${SCRIPT_DIR}"
|
||||||
|
cat "${BASH_SOURCE[0]}"
|
||||||
else
|
else
|
||||||
SCRIPT_NAME="$BASE_0"
|
SCRIPT_NAME="$BASE_0"
|
||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/mnt/wolfpack/data/apps.docker/runtipi/user-config/_bin/runtipictl
|
|
Loading…
Reference in New Issue