Compare commits
4 Commits
eb821d0bdb
...
39cef1a802
Author | SHA1 | Date |
---|---|---|
Lockszmith | 39cef1a802 | |
Lockszmith | e227daa453 | |
Lockszmith | 489050ee7e | |
Lockszmith | 3c31041ca9 |
23
fix-kubectl
23
fix-kubectl
|
@ -38,41 +38,41 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
|||
|
||||
if [[ -n "$(type -t 'kubectl-cnpg')" ]]; then
|
||||
. <( kubectl cnpg completion ${SHELL##*/} )
|
||||
else
|
||||
DL_VER=v1.21.1
|
||||
fi
|
||||
if [[ -z "$(type -t 'kubectl-cnpg')" || -n "$UPGRADE" ]]; then
|
||||
DL_VER=1.21.1
|
||||
GH_URL=https://github.com/cloudnative-pg/cloudnative-pg
|
||||
DL_FILE="kubectl-cnpg_${DL_VER}_linux_x86_64.deb"
|
||||
URL=${GH_URL}/releases/download/${DL_VER}/${DL_FILE}
|
||||
URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE}
|
||||
printf '%s\n' \
|
||||
'To download and install cnpg kubectl plugin, run:' \
|
||||
" curl -sSLO ${URL}" \
|
||||
" sudo dpkg -i $DL_FILE"
|
||||
|
||||
fi
|
||||
|
||||
if [[ -z "$(type -t 'kubetui')" ]]; then
|
||||
DL_VER='v1.4.2'
|
||||
if [[ -z "$(type -t 'kubetui')" || -n "$UPGRADE" ]]; then
|
||||
DL_VER=1.4.2
|
||||
GH_URL=https://github.com/sarub0b0/kubetui
|
||||
DL_FILE=kubetui-x86_64-unknown-linux-musl-rustls
|
||||
URL=${GH_URL}/releases/download/${DL_VER}/${DL_FILE}
|
||||
URL=${GH_URL}/releases/download/v${DL_VER}/${DL_FILE}
|
||||
printf '%s\n' \
|
||||
'To download and install kubetui, run:' \
|
||||
" curl -sSL ${URL} > ~/bin/kubetui" \
|
||||
" chmod +x ~/bin/kubetui"
|
||||
fi
|
||||
|
||||
if [[ -z "$(type -t 'k3s')" ]]; then
|
||||
if [[ -z "$(type -t 'k9s')" || -n "$UPGRADE" ]]; then
|
||||
printf '%s\n' \
|
||||
'To download and install k3s, run:' \
|
||||
'To download and install k9s, run:' \
|
||||
" curl -sS https://webinstall.dev/k9s | bash"
|
||||
fi
|
||||
|
||||
if [[ -n "$(type -t 'k3s')" ]]; then
|
||||
. <( k3s completion ${SHELL##*/} )
|
||||
. <( k3s completion "${SHELL##*/}" )
|
||||
fi
|
||||
|
||||
if [[ -n "$(type -t 'helm')" ]]; then
|
||||
. <( helm completion ${SHELL##*/} 2>/dev/null )
|
||||
. <( helm completion "${SHELL##*/}" 2>/dev/null )
|
||||
fi
|
||||
|
||||
kg() {
|
||||
|
@ -80,7 +80,6 @@ if [[ -z "${BASE_0}" || "${BASE_0}" == "$BASE_SHELL" ]]; then
|
|||
}
|
||||
fi
|
||||
elif [[ "$1" == '-' ]]; then
|
||||
printf "SCRIPT_FULL_PATH='%s'\n" "${BASH_SOURCE[0]}"
|
||||
cat "${BASH_SOURCE[0]}"
|
||||
else
|
||||
SCRIPT_NAME="$BASE_0"
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
#! /usr/bin/env bash
|
||||
k3s crictl pods --namespace ix -s Ready \
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
USER_HOME=$HOME
|
||||
[[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")"
|
||||
. ${SHRC_D:-$SCRIPT_DIR}/01_util.functions
|
||||
|
||||
set -e
|
||||
|
||||
k3s kubectl pods --namespace ix -s Ready \
|
||||
| sed 1d | grep -v svclb- \
|
||||
| sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//' \
|
||||
| awk '{ print $4 }' \
|
||||
| sed 's/^ix-//' | sort -u
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
k3s kubectl get pvc -A --output name \
|
||||
| grep cnpg-main \
|
||||
| sed -e 's|^.*/||; s|-cnpg-main-.*$||;' \
|
||||
| sort --unique
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
#! /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}")"
|
||||
. ${SHRC_D:-$SCRIPT_DIR}/01_util.functions
|
||||
|
||||
set -e
|
||||
|
||||
[[ -n $(type -p heavyscript) ]] \
|
||||
|| curl -s https://raw.githubusercontent.com/Heavybullets8/heavy_script/main/functions/deploy.sh | bash
|
||||
|
||||
if [[ $USER == "$(sudo bash -c "echo \$SUDO_USER")" ]]; then
|
||||
|
||||
if [[ -z "$(type -p apt)" || -n "$UPGRADE" ]]; then
|
||||
echo "sudo action section begins..."
|
||||
[[ -z $(type -p heavyscript) ]] && echo "heavyscript isn't installed!" \
|
||||
|| sudo heavyscript enable --apt
|
||||
|
||||
sudo update-alternatives --remove vim.tiny /usr/bin/vim.tiny || true
|
||||
sudo apt update
|
||||
sudo apt remove vim-tiny
|
||||
sudo apt install fzf neovim fd-find ripgrep
|
||||
sudo apt install atool caca-utils figlet zip
|
||||
sudo apt install --yes mediainfo exiftool mupdf-tools cmigemo dict dict-wn dictd libsixel-bin xsel
|
||||
# sudo apt install w3m-el xdg-utils unoconv
|
||||
sudo apt install --yes ranger
|
||||
echo "sudo section done."
|
||||
fi
|
||||
else
|
||||
printf '%s\n' \
|
||||
"sudo failed to run, please make sure user $USER is allowed to run sudo and run again." \
|
||||
'continuing to non-sudo actions...'
|
||||
fi
|
||||
|
||||
echo 'Normalizing git config...'
|
||||
git_config() {
|
||||
local SCOPE="${SCOPE:-global}"
|
||||
[[ -n "$(git config "${1}")" ]] \
|
||||
|| git config "--${SCOPE}" "${@}"
|
||||
}
|
||||
git_config core.editor nvim
|
||||
git_config pull.ff only
|
||||
git config --list --show-origin
|
||||
|
||||
[[ -n "$(type -p 'webi')" ]] || curl -sS https://webi.sh/ | sh
|
||||
|
||||
cat << LOADENVMAN > ~/.config/envman/load.sh
|
||||
if [ -z "\$ENVMAN_LOADED" ]; then
|
||||
ENVMAN_LOADED=1
|
||||
|
||||
# Generated for envman. Do not edit.
|
||||
for x in ~/.config/envman/*.env; do
|
||||
my_basename="\$(basename "\${x}")"
|
||||
if [ "*.env" = "\${my_basename}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ -n "\${DBG}" ]]; then
|
||||
echo "Loading \${x}..."
|
||||
\${DBG/^1/:}
|
||||
fi
|
||||
# shellcheck source=/dev/null
|
||||
. "\${x}"
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
OLDPATH="\$PATH"; NEWPATH=""; colon=""
|
||||
while [ "\${OLDPATH#*:}" != "\$OLDPATH" ]; do
|
||||
entry="\${OLDPATH%%:*}"; search=":\${OLDPATH#*:}:"
|
||||
[ "\${search#*:\$entry:}" == "\$search" ] && NEWPATH="\$NEWPATH\$colon\$entry" && colon=:
|
||||
OLDPATH="\${OLDPATH#*:}"
|
||||
done
|
||||
NEWPATH="\$NEWPATH:\$OLDPATH"
|
||||
export PATH="\$NEWPATH"
|
||||
unset NEWPATH OLDPATH colon entry search
|
||||
LOADENVMAN
|
||||
|
||||
cat << ADDPATH > ~/.config/envman/PATH_truestuff.env
|
||||
PATH="$SCRIPT_DIR:\$PATH"
|
||||
ADDPATH
|
||||
|
||||
cat << SHELLREFRESH > ~/.config/envman/shell-refresh.env
|
||||
alias _r="exec \$SHELL -l "
|
||||
SHELLREFRESH
|
||||
|
||||
printf '%s\n' '' '' \
|
||||
"$(basename "$0") is a user envrionment initialization script for TrueNAS SCALE" \
|
||||
'' \
|
||||
'Initialization done, ready to reload your shell' \
|
||||
'' \
|
||||
'Run the following:' \
|
||||
"exec \$SHELL -l "
|
||||
|
Loading…
Reference in New Issue