96 lines
6.4 KiB
YAML
96 lines
6.4 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: htmx-patterns-66bfd987d7-98sw7-krayt-1744164311
|
|
namespace: htmx-patterns
|
|
labels:
|
|
app: krayt
|
|
annotations:
|
|
pvcs: none
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: krayt
|
|
spec:
|
|
containers:
|
|
- name: inspector
|
|
image: alpine:latest
|
|
command:
|
|
- sh
|
|
- -c
|
|
- "mkdir -p /etc/krayt\ncat <<'KRAYT_INIT_SH_EOF' >/etc/krayt/init.sh\ndetect_package_manager_and_install_command()\
|
|
\ {\n\tif [ $# -eq 0 ]; then\n\t\techo \"Usage: detect_package_manager_and_install_command\
|
|
\ <package1> [package2] [...]\"\n\t\treturn 1\n\tfi\n\n\tif command -v apt\
|
|
\ >/dev/null 2>&1; then\n\t\tPKG_MANAGER=\"apt\"\n\t\tUPDATE_CMD=\"apt update\
|
|
\ &&\"\n\t\tINSTALL_CMD=\"apt install -y\"\n\telif command -v dnf >/dev/null\
|
|
\ 2>&1; then\n\t\tPKG_MANAGER=\"dnf\"\n\t\tUPDATE_CMD=\"\"\n\t\tINSTALL_CMD=\"\
|
|
dnf install -y\"\n\telif command -v yum >/dev/null 2>&1; then\n\t\tPKG_MANAGER=\"\
|
|
yum\"\n\t\tUPDATE_CMD=\"\"\n\t\tINSTALL_CMD=\"yum install -y\"\n\telif command\
|
|
\ -v pacman >/dev/null 2>&1; then\n\t\tPKG_MANAGER=\"pacman\"\n\t\tUPDATE_CMD=\"\
|
|
\"\n\t\tINSTALL_CMD=\"pacman -Sy --noconfirm\"\n\telif command -v zypper\
|
|
\ >/dev/null 2>&1; then\n\t\tPKG_MANAGER=\"zypper\"\n\t\tUPDATE_CMD=\"\"\
|
|
\n\t\tINSTALL_CMD=\"zypper install -y\"\n\telif command -v apk >/dev/null\
|
|
\ 2>&1; then\n\t\tPKG_MANAGER=\"apk\"\n\t\tUPDATE_CMD=\"\"\n\t\tINSTALL_CMD=\"\
|
|
apk add\"\n\telse\n\t\techo \"No supported package manager found.\"\n\t\t\
|
|
return 2\n\tfi\n\n\tPACKAGES=\"$*\"\n\n\tif [ -n \"$UPDATE_CMD\" ]; then\n\
|
|
\t\techo \"$UPDATE_CMD\n echo $INSTALL_CMD $PACKAGES\"\n\t\t$UPDATE_CMD\n\
|
|
\t\t$INSTALL_CMD $PACKAGES\n\n\telse\n\t\techo \"$INSTALL_CMD $PACKAGES\"\
|
|
\n\t\t$INSTALL_CMD $PACKAGES\n\tfi\n}\n\ndetect_package_manager_and_install_command\
|
|
\ ripgrep exa ncdu dust file hexyl jq yq bat fd fzf htop bottom difftastic\
|
|
\ mtr bind-tools aws-cli sqlite sqlite-dev sqlite-libs bash neovim starship\n\
|
|
\ncat <<EOF >/etc/motd\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\
|
|
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\
|
|
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\
|
|
\u2500\u2500\u2500\u2500\u2510\n\u2502Krayt Dragon's Lair \
|
|
\ \u2502\n\u2502A safe haven for volume inspection \u2502\n\u2514\u2500\
|
|
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\
|
|
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\
|
|
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\"\
|
|
Inside every volume lies a pearl of wisdom waiting to be discovered.\"\n\
|
|
\nAdditional Packages:\n- ripgrep\n- exa\n- ncdu\n- dust\n- file\n- hexyl\n\
|
|
- jq\n- yq\n- bat\n- fd\n- fzf\n- htop\n- bottom\n- difftastic\n- mtr\n\
|
|
- bind-tools\n- aws-cli\n- sqlite\n- sqlite-dev\n- sqlite-libs\n- bash\n\
|
|
- neovim\n- starship\n\nEOF\nKRAYT_MARKER_START=\"# >>> Added by krayt-inject\
|
|
\ <<<\"\nKRAYT_MARKER_END='# <<< End krayt-inject >>>'\nKRAYT_BLOCK='\n\
|
|
if [ -t 1 ] && [ -f /etc/motd ] && [ -z \"$MOTD_SHOWN\" ]; then\n cat\
|
|
\ /etc/motd\n export MOTD_SHOWN=1\nfi\n\n# fix $SHELL, not set in some\
|
|
\ distros like alpine\nif [ -n \"$BASH_VERSION\" ]; then\n export SHELL=/bin/bash\n\
|
|
elif [ -n \"$ZSH_VERSION\" ]; then\n export SHELL=/bin/zsh\nelse\n \
|
|
\ export SHELL=/bin/sh\nfi\n\n# krayt ENVIRONMENT\nexport KRAYT_ADDITIONAL_PACKAGES=\"\
|
|
ripgrep exa ncdu dust file hexyl jq yq bat fd fzf htop bottom difftastic\
|
|
\ mtr bind-tools aws-cli sqlite sqlite-dev sqlite-libs bash neovim starship\"\
|
|
\n# Universal shell initializers\n\n# Prompt\nif command -v starship >/dev/null\
|
|
\ 2>&1; then\n\teval \"$(starship init \"$(basename \"$SHELL\")\")\"\nfi\n\
|
|
\n# Smarter cd\nif command -v zoxide >/dev/null 2>&1; then\n\teval \"$(zoxide\
|
|
\ init \"$(basename \"$SHELL\")\")\"\nfi\n\n# Smarter shell history\nif\
|
|
\ command -v atuin >/dev/null 2>&1; then\n\teval \"$(atuin init \"$(basename\
|
|
\ \"$SHELL\")\")\"\nfi\n\nif command -v mcfly >/dev/null 2>&1; then\n\t\
|
|
eval \"$(mcfly init \"$(basename \"$SHELL\")\")\"\nfi\n\n# Directory-based\
|
|
\ environment\nif command -v direnv >/dev/null 2>&1; then\n\teval \"$(direnv\
|
|
\ hook \"$(basename \"$SHELL\")\")\"\nfi\n\nif command -v fzf >/dev/null\
|
|
\ 2>&1; then\n case \"$(basename \"$SHELL\")\" in\n bash|zsh|fish)\n\
|
|
\ eval \"$(fzf --$(basename \"$SHELL\"))\"\n ;;\n\
|
|
\ *)\n # shell not supported for fzf init\n \
|
|
\ ;;\n esac\nfi\n# \"Did you mean...?\" for mistyped commands\nif command\
|
|
\ -v thefuck >/dev/null 2>&1; then\n\teval \"$(thefuck --alias)\"\nfi\n\
|
|
'\ncat <<EOF >/etc/.kraytrc\n$KRAYT_MARKER_START\n$KRAYT_BLOCK\n$KRAYT_MARKER_END\n\
|
|
EOF\n\nKRAYT_RC_SOURCE='\nif [ -f /etc/.kraytrc ]; then\n . /etc/.kraytrc\n\
|
|
fi\n'\n\n# List of common rc/profile files to patch\nRC_FILES=\"\n/etc/profile\n\
|
|
/etc/bash.bashrc\n/etc/bash/bashrc\n/etc/bashrc\n/etc/ashrc\n/etc/zsh/zshrc\n\
|
|
/etc/zsh/zprofile\n/etc/shinit\n/etc/fish/config.fish\n\"\n\necho \"Searching\
|
|
\ for rc files...\"\n\nfor rc_file in $RC_FILES; do\n\tif [ -f \"$rc_file\"\
|
|
\ ]; then\n\t\techo \"* Found $rc_file\"\n\n\t\t# Check if already patched\n\
|
|
\t\tif grep -q \"$KRAYT_MARKER_START\" \"$rc_file\"; then\n\t\t\techo \"\
|
|
- $rc_file already has krayt block. Skipping.\"\n\t\telse\n\t\t\techo \"\
|
|
+ Patching $rc_file\"\n\t\t\techo \"\" >>\"$rc_file\"\n\t\t\techo \"$KRAYT_MARKER_START\"\
|
|
\ >>\"$rc_file\"\n\t\t\techo \"$KRAYT_RC_SOURCE\" >>\"$rc_file\"\n\t\t\t\
|
|
echo \"$KRAYT_MARKER_END\" >>\"$rc_file\"\n\t\tfi\n\tfi\ndone\necho \"Krayt\
|
|
\ environment ready. Sleeping forever...\"\ntrap \"echo 'Received SIGTERM.\
|
|
\ Exiting...'; exit 0\" TERM\ntail -f /dev/null &\nwait\nKRAYT_INIT_SH_EOF\n\
|
|
\nchmod +x /etc/krayt/init.sh\n/etc/krayt/init.sh"
|
|
env: []
|
|
volumeMounts: []
|
|
volumes: []
|
|
restartPolicy: Never
|
|
|