Compare commits
No commits in common. "01cb3798ed16e01f2f27001baa1a510aa1c19e86" and "e179df0b48046f72542f7c7dcfba2e677da41f43" have entirely different histories.
01cb3798ed
...
e179df0b48
|
@ -1,8 +1,4 @@
|
||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
||||||
USER_HOME=$HOME
|
|
||||||
[[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")"
|
|
||||||
|
|
||||||
BASE_0="$(basename ${0#-})"
|
BASE_0="$(basename ${0#-})"
|
||||||
BASE_SHELL="$(basename "$SHELL")"
|
BASE_SHELL="$(basename "$SHELL")"
|
||||||
if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
||||||
|
@ -44,7 +40,7 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
||||||
. <( kubectl cnpg completion ${SHELL##*/} )
|
. <( kubectl cnpg completion ${SHELL##*/} )
|
||||||
fi
|
fi
|
||||||
if [[ -z "$(type -t 'kubectl-cnpg')" || -n "$UPGRADE" ]]; then
|
if [[ -z "$(type -t 'kubectl-cnpg')" || -n "$UPGRADE" ]]; then
|
||||||
DL_VER=1.22.0
|
DL_VER=1.21.1
|
||||||
GH_URL=https://github.com/cloudnative-pg/cloudnative-pg
|
GH_URL=https://github.com/cloudnative-pg/cloudnative-pg
|
||||||
DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb"
|
DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb"
|
||||||
URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE}
|
URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE}
|
||||||
|
@ -55,7 +51,7 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$(type -t 'kubetui')" || -n "$UPGRADE" ]]; then
|
if [[ -z "$(type -t 'kubetui')" || -n "$UPGRADE" ]]; then
|
||||||
DL_VER=1.5.0
|
DL_VER=1.4.2
|
||||||
GH_URL=https://github.com/sarub0b0/kubetui
|
GH_URL=https://github.com/sarub0b0/kubetui
|
||||||
DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls
|
DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls
|
||||||
URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE}
|
URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE}
|
||||||
|
@ -84,7 +80,6 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
elif [[ "$1" == '-' ]]; then
|
elif [[ "$1" == '-' ]]; then
|
||||||
printf '%s\n' "SCRIPT_FULL_PATH='$SCRIPT_DIR/$BASE_0'"
|
|
||||||
cat "${BASH_SOURCE[0]}"
|
cat "${BASH_SOURCE[0]}"
|
||||||
else
|
else
|
||||||
SCRIPT_NAME="$BASE_0"
|
SCRIPT_NAME="$BASE_0"
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
#! /usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [[ $# -lt 1 ]]; then
|
|
||||||
MYNAME="$(basename $0)"
|
|
||||||
cat - <<USAGE
|
|
||||||
$MYNAME
|
|
||||||
Grab dns-ingress tls certs from local k3s secrets and copy over to
|
|
||||||
szdocker's adguard
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
$MYNAME <app-name> [<secret-name> [cmdline with \$FILE receiving content]]
|
|
||||||
|
|
||||||
Example:
|
|
||||||
$MYNAME dns-ingress external-service-tls-0 '{
|
|
||||||
echo /opt/adguardhome/conf/\$FILE;
|
|
||||||
ssh szdocker@szdocker.lan sudo tee /srv/containeriszed/0.local/adguardhome/conf/\$FILE > /dev/null;
|
|
||||||
}'
|
|
||||||
|
|
||||||
Arguments
|
|
||||||
app-name - name of the ix-app
|
|
||||||
secret-name - name of the secret, when ommitted, a sorted list of
|
|
||||||
secrets will be listed
|
|
||||||
cmdline... - Command to run on the secret, \$FILE will be the
|
|
||||||
secret name, where stdin will contain the content of
|
|
||||||
the secret
|
|
||||||
|
|
||||||
USAGE
|
|
||||||
false
|
|
||||||
else
|
|
||||||
APPNAME="${1}"
|
|
||||||
NS="--namespace=ix-${APPNAME:?Appname was not specified}"
|
|
||||||
if [[ -z "${2}" ]]; then
|
|
||||||
# shellcheck disable=SC2086 # ${NS} unqouted on purpose
|
|
||||||
k3s kubectl get secrets ${NS} | sort
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
SECRETNAME="${APPNAME}-${2}"
|
|
||||||
PIPECMD="${*:3}"
|
|
||||||
PIPECMD="${PIPECMD:-cat -}"
|
|
||||||
# shellcheck disable=SC2086 # ${NS} unqouted on purpose
|
|
||||||
mapfile -t FILES < <(k3s kubectl get secrets ${NS} "${SECRETNAME}" --output=json | jq -r '.data | keys[]')
|
|
||||||
for FILE in "${FILES[@]}"; do
|
|
||||||
# shellcheck disable=SC2086 # ${NS} and $PIPECMD unqouted on purpose
|
|
||||||
k3s kubectl get secrets ${NS} "${SECRETNAME}" --output=json | jq -r '.data["'"${FILE}"'"] | @base64d' | eval $PIPECMD
|
|
||||||
done
|
|
||||||
fi
|
|
|
@ -1,34 +0,0 @@
|
||||||
#! /usr/bin/env bash
|
|
||||||
|
|
||||||
res() {
|
|
||||||
|
|
||||||
old=$(stty -g)
|
|
||||||
stty raw -echo min 0 time 5
|
|
||||||
|
|
||||||
printf '\0337\033[r\033[999;999H\033[6n\0338' > /dev/tty
|
|
||||||
IFS='[;R' read -r _ rows cols _ < /dev/tty
|
|
||||||
|
|
||||||
stty "$old"
|
|
||||||
|
|
||||||
# echo "cols:$cols"
|
|
||||||
# echo "rows:$rows"
|
|
||||||
stty cols "$cols" rows "$rows"
|
|
||||||
}
|
|
||||||
|
|
||||||
res2() {
|
|
||||||
|
|
||||||
old=$(stty -g)
|
|
||||||
stty raw -echo min 0 time 5
|
|
||||||
|
|
||||||
printf '\033[18t' > /dev/tty
|
|
||||||
IFS=';t' read -r _ rows cols _ < /dev/tty
|
|
||||||
|
|
||||||
stty "$old"
|
|
||||||
|
|
||||||
# echo "cols:$cols"
|
|
||||||
# echo "rows:$rows"
|
|
||||||
stty cols "$cols" rows "$rows"
|
|
||||||
}
|
|
||||||
|
|
||||||
stty cols 80
|
|
||||||
cat /dev/vcs
|
|
Loading…
Reference in New Issue