diff --git a/toolboxes/bluefin-cli/Containerfile.bluefin-cli b/toolboxes/bluefin-cli/Containerfile.bluefin-cli index 15dbb28..b71073b 100644 --- a/toolboxes/bluefin-cli/Containerfile.bluefin-cli +++ b/toolboxes/bluefin-cli/Containerfile.bluefin-cli @@ -20,8 +20,7 @@ RUN apk update && \ rm /toolbox-packages # Patch /usr/bin/entrypoint -RUN sed -i '/missing_packages=0/,/# Workaround for when sudo is missing,/ s/^/#/' /usr/bin/entrypoint && \ - sed -i '/elif command -v apt-get/,/# Set SHELL to the install path inside the container/ s/^/#/' /usr/bin/entrypoint && \ +RUN sed -i '/missing_packages=0/,/# Set SHELL to the install path inside the container/ s/^/#/' /usr/bin/entrypoint && \ sed -i '/# Set SHELL to the install path inside the container/a touch /.containersetupdone' /usr/bin/entrypoint # Use and configure bash, retrieve bash-prexec diff --git a/toolboxes/bluefin-cli/files/etc/bashrc b/toolboxes/bluefin-cli/files/etc/bashrc index e228152..5e95f6e 100644 --- a/toolboxes/bluefin-cli/files/etc/bashrc +++ b/toolboxes/bluefin-cli/files/etc/bashrc @@ -49,11 +49,13 @@ if [ -z "$BASHRCSOURCED" ]; then export STARSHIP_CONFIG eval "$(starship init $SHELL)" - # Enable atuin and ble.sh + # Enable atuin and bash-prexec source /usr/share/bash-prexec eval "$(atuin init bash)" -fi + # Enable zoxide + eval "$(zoxide init bash --cmd cd)" +fi # vim:ts=4:sw=4 diff --git a/toolboxes/bluefin-cli/files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh b/toolboxes/bluefin-cli/files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh index 5119ed3..3d7fb9f 100644 --- a/toolboxes/bluefin-cli/files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh +++ b/toolboxes/bluefin-cli/files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh @@ -6,29 +6,41 @@ if test "$(id -u)" -gt "0"; then export HOMEBREW_REPOSITORY if test ! -f /etc/linuxbrew.firstrun; then printf "\nBluefin-CLI First Run Setup\n\n" - printf "Setting up sudo for ${bold}${USER}${normal}...\t\t\t " + printf "Setting up sudo for %s%s%s...\t\t\t " "${bold}" "${USER}" "${normal}" echo "#${UID} ALL = (root) NOPASSWD:ALL" | su-exec root tee -a /etc/sudoers > /dev/null - printf "${green}[ OK ]${normal}\n" + printf "%s[ OK ]%s\n" "${green}" "${normal}" fi if test ! -d /home/linuxbrew/.linuxbrew; then + name="" + test -f /run/.containerenv && . /run/.containerenv + test -f /run/.dockerenv && . /run/.dockerenv + linuxbrew_home="${XDG_DATA_HOME:-$HOME/.local/share}"/bluefin-cli/"${name}" printf "Setting up Linuxbrew...\t\t\t\t " - if test ! -d "${XDG_DATA_HOME:-$HOME/.local/share}"/bluefin-cli; then - mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}"/bluefin-cli + if test ! -d "${linuxbrew_home}"; then + mkdir -p "${linuxbrew_home}" + if test -d "${XDG_DATA_HOME:-$HOME/.local/share}"/bluefin-cli/.linuxbrew; then + mv "${XDG_DATA_HOME:-$HOME/.local/share}"/bluefin-cli/.linuxbrew "${linuxbrew_home}"/.linuxbrew + fi fi if test ! -d /home/linuxbrew; then su-exec root mkdir -p /home/linuxbrew fi - su-exec root mount --bind "${XDG_DATA_HOME:-$HOME/.local/share}"/bluefin-cli /home/linuxbrew + su-exec root mount --bind "${linuxbrew_home}" /home/linuxbrew su-exec root cp -R /home/homebrew/.linuxbrew /home/linuxbrew/ su-exec root chown -R $UID /home/linuxbrew - printf "${green}[ OK ]${normal}\n" + unset linuxbrew_home + printf "%s[ OK ]%s\n" "${green}" "${normal}" fi + if test ! -d /usr/local/share/bash-completion/completions; then printf "Setting up Tab-Completions...\t\t\t " su-exec root mkdir -p /usr/local/share/bash-completion su-exec root mount --bind /run/host/usr/share/bash-completion /usr/local/share/bash-completion - printf "${green}[ OK ]${normal}\n" + if test -x /run/host/usr/bin/ujust; then + su-exec root ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/ujust + fi + printf "%s[ OK ]%s\n" "${green}" "${normal}" fi if test ! -f /etc/linuxbrew.firstrun; then diff --git a/toolboxes/bluefin-cli/files/etc/profile.d/bash_completion.sh b/toolboxes/bluefin-cli/files/etc/profile.d/bash_completion.sh index aed9e98..caaf563 100644 --- a/toolboxes/bluefin-cli/files/etc/profile.d/bash_completion.sh +++ b/toolboxes/bluefin-cli/files/etc/profile.d/bash_completion.sh @@ -1,4 +1,4 @@ -# shellcheck shell=sh disable=SC1091,SC2039,SC2166 +# shellcheck shell=sh disable=SC1090,SC1091,SC2039,SC2166,SC2268 # Check for interactive bash and that we haven't already been sourced. if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then diff --git a/toolboxes/bluefin-cli/files/etc/profile.d/colors.sh b/toolboxes/bluefin-cli/files/etc/profile.d/colors.sh deleted file mode 100644 index 0b1a297..0000000 --- a/toolboxes/bluefin-cli/files/etc/profile.d/colors.sh +++ /dev/null @@ -1,13 +0,0 @@ -# LS Colors via Eza -alias ll='eza -l --icons=auto --group-directories-first' 2>/dev/null -alias l.='eza -d .*' 2>/dev/null -alias ls='eza' 2>/dev/null -alias l1='eza -1' - -# Grep Colors -alias grep='grep --color=auto' 2>/dev/null -alias egrep='grep -E --color=auto' 2>/dev/null -alias fgrep='grep -F --color=auto' 2>/dev/null -alias xzgrep='xzgrep --color=auto' 2>/dev/null -alias xzegrep='xzegrep --color=auto' 2>/dev/null -alias xzfgrep='xzfgrep --color=auto' 2>/dev/null \ No newline at end of file diff --git a/toolboxes/bluefin-cli/files/etc/profile.d/modern-unix.sh b/toolboxes/bluefin-cli/files/etc/profile.d/modern-unix.sh new file mode 100644 index 0000000..c499244 --- /dev/null +++ b/toolboxes/bluefin-cli/files/etc/profile.d/modern-unix.sh @@ -0,0 +1,19 @@ +# Eza for ls +alias ll='eza -l --icons=auto --group-directories-first' 2>/dev/null +alias l.='eza -d .*' 2>/dev/null +alias ls='eza' 2>/dev/null +alias l1='eza -1' + +# Ripgrep for grep +alias grep='rg' 2>/dev/null +alias egrep='rg' 2>/dev/null +alias fgrep='rg -F' 2>/dev/null +alias xzgrep='rg -z' 2>/dev/null +alias xzegrep='rg -z' 2>/dev/null +alias xzfgrep='rg -z -F' 2>/dev/null + +# Zoxide is handling cd +alias cd='cd' 2>/dev/null + +# Fd for find +alias find='fd' 2>/dev/null \ No newline at end of file diff --git a/toolboxes/bluefin-cli/packages.bluefin-cli b/toolboxes/bluefin-cli/packages.bluefin-cli index c64c83b..5f0e6c7 100644 --- a/toolboxes/bluefin-cli/packages.bluefin-cli +++ b/toolboxes/bluefin-cli/packages.bluefin-cli @@ -2,6 +2,10 @@ atuin brew gawk eza +fd +fzf +ripgrep sed starship sudo-rs +zoxide diff --git a/toolboxes/wolfi-toolbox/Containerfile.wolfi b/toolboxes/wolfi-toolbox/Containerfile.wolfi index aba64d1..3ed64e5 100644 --- a/toolboxes/wolfi-toolbox/Containerfile.wolfi +++ b/toolboxes/wolfi-toolbox/Containerfile.wolfi @@ -41,3 +41,10 @@ RUN mkdir -p /usr/local/bin && \ # Change root shell to BASH RUN sed -i -e '/^root/s/\/bin\/ash/\/bin\/bash/' /etc/passwd + +# Setup su-exec and fake sudo +RUN [ -e /sbin/su-exec ] && \ + chmod u+s /sbin/su-exec && \ + [ ! -e /usr/bin/sudo ] && \ + printf "%s\n%s" '#!/bin/sh' '/sbin/su-exec root "$@"' > /usr/bin/sudo && \ + chmod +x /usr/bin/sudo \ No newline at end of file