Compare commits
20 Commits
3085ead539
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a18dfd678a | |||
| 696bacb597 | |||
| 109bf0f93b | |||
| 844c10948b | |||
| 28f98a23d6 | |||
| 16194ce20f | |||
| 524bdf030d | |||
| 88ccccdb50 | |||
| f2f34750ac | |||
| 8e5ea523b2 | |||
| 4b2490c4aa | |||
| 2fd7a84165 | |||
| 771c7d5fe6 | |||
| 78afb43678 | |||
| 926ac8baa0 | |||
| 5f2e74623b | |||
| c5f1be3006 | |||
| 2fcda19a40 | |||
|
be2e175976
|
|||
| 7d81e68049 |
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
BASE_IMAGE=$(git config get toolbox-dev-env.base-image.name)
|
||||
if git config get toolbox-dev-env.base-image.version-script &>/dev/null; then
|
||||
BASE_IMAGE_VERSION=$(eval $(git config get toolbox-dev-env.base-image.version-script))
|
||||
else
|
||||
BASE_IMAGE_VERSION=$(git config get toolbox-dev-env.base-image.version)
|
||||
fi
|
||||
BUILD_NONCE=$(git rev-parse HEAD)
|
||||
|
||||
ENV_NAME=$(git config get toolbox-dev-env.name)
|
||||
|
||||
podman build . \
|
||||
--tag "localhost/${ENV_NAME}:latest" \
|
||||
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
|
||||
--build-arg BASE_IMAGE_VERSION="${BASE_IMAGE_VERSION}" \
|
||||
--build-arg BUILD_NONCE="${BUILD_NONCE}" \
|
||||
--build-arg ENV_NAME="${ENV_NAME}"
|
||||
36
Makefile
Normal file
36
Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
BUILD_COMMIT = $(shell git rev-parse HEAD)
|
||||
BASE_IMAGE = registry.fedoraproject.org/fedora-toolbox
|
||||
BASE_IMAGE_VERSION = $(shell cat /etc/os-release | grep VERSION_ID | cut -d = -f 2)
|
||||
REPOSITORY = localhost/toolbox-dev-env
|
||||
STARSHIP_COLOR = $(shell cat starship.$(HOSTNAME).color)
|
||||
|
||||
.PHONY: container
|
||||
container:
|
||||
podman build ./container/ --tag $(REPOSITORY):$(BUILD_COMMIT) --build-arg BASE_IMAGE="$(BASE_IMAGE)" --build-arg BASE_IMAGE_VERSION="$(BASE_IMAGE_VERSION)" --build-arg BUILD_COMMIT="$(BUILD_COMMIT)"
|
||||
podman tag $(REPOSITORY):$(BUILD_COMMIT) $(REPOSITORY):latest
|
||||
|
||||
.PHONY: container
|
||||
scripts:
|
||||
mkdir --parents ~/.local/share/fonts/
|
||||
curl -sSLo ~/.local/share/fonts/nerdfont.zip https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/AdwaitaMono.zip
|
||||
unzip -o ~/.local/share/fonts/nerdfont.zip -d ~/.local/share/fonts/
|
||||
rm ~/.local/share/fonts/nerdfont.zip
|
||||
fc-cache -f -v
|
||||
|
||||
mkdir --parents ~/.local/bin
|
||||
curl -sSo /tmp/starship.sh https://starship.rs/install.sh
|
||||
sh /tmp/starship.sh --yes --bin-dir=$(HOME)/.local/bin
|
||||
|
||||
mkdir --parents ~/.config/bashrc.d
|
||||
cp scripts.d/*.sh ~/.config/bashrc.d/
|
||||
|
||||
mkdir --parents ~/.config/completions.d
|
||||
cp completions.d/*.completion ~/.config/completions.d/
|
||||
|
||||
cp bashrc.sh ~/.bashrc
|
||||
cp inputrc ~/.inputrc
|
||||
cp starship.toml ~/.config/starship.toml
|
||||
sed -i "s/#XXXXXX/$(STARSHIP_COLOR)/g" ~/.config/starship.toml
|
||||
|
||||
install: container scripts;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# toolbox dev env
|
||||
|
||||
A base development environment for building [Toolbox](https://containertoolbx.org/) containers from
|
||||
My personal development environment for using [Toolbox](https://containertoolbx.org/) containers.
|
||||
|
||||
For initial repo setup, be certain to run `./setup.sh`. After initial setup, use `./configure.sh`
|
||||
To install, run `make install`. To update the image use `make build` and then recreate any running toolbox containers.
|
||||
|
||||
35
bashrc.sh
Normal file
35
bashrc.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
# .bashrc
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
if [ -f '/run/.toolboxenv' ]; then
|
||||
export LOCATION="Toolbox: $(cat /run/.containerenv | grep name | cut -d '=' -f 2 | tr -d '"')"
|
||||
else
|
||||
export LOCATION="Host: $(hostname)"
|
||||
fi
|
||||
|
||||
export HISTFILE="$HOME/.bash_history"
|
||||
export PYTHON_HISTORY="$HOME/.python_history"
|
||||
|
||||
# User specific environment
|
||||
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
|
||||
then
|
||||
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
|
||||
fi
|
||||
export PATH
|
||||
|
||||
# Uncomment the following line if you don't like systemctl's auto-paging feature:
|
||||
# export SYSTEMD_PAGER=
|
||||
|
||||
# Basically this is here to support the nonsense I'm doing with toolbox alt-home
|
||||
# locations. This determines the current path of the current script so that we
|
||||
# don't need to hardcode paths
|
||||
currdir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
||||
|
||||
for b in ${currdir}/.config/bashrc.d/*.sh; do source $b; done
|
||||
for c in ${currdir}/.config/completions.d/*.completion; do source $c; done
|
||||
|
||||
unset currdir
|
||||
6
completions.d/dev.completion
Normal file
6
completions.d/dev.completion
Normal file
@@ -0,0 +1,6 @@
|
||||
function _dev_completion() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]};
|
||||
COMPREPLY=( $(compgen -W "$(command ls $PROJECTS_PATH)" -- $cur) );
|
||||
}
|
||||
complete -F _dev_completion dev
|
||||
complete -F _dev_completion gg
|
||||
@@ -1,5 +0,0 @@
|
||||
cp .post-commit-hook .git/hooks/post-commit
|
||||
git config set toolbox-dev-env.name voyager-base
|
||||
git config set toolbox-dev-env.base-image.name registry.fedoraproject.org/fedora-toolbox
|
||||
git config set toolbox-dev-env.base-image.version-script 'cat /etc/os-release | grep VERSION_ID | cut -d = -f 2'
|
||||
git config unset toolbox-dev-env.base-image.version
|
||||
@@ -3,16 +3,12 @@ ARG BASE_IMAGE_VERSION
|
||||
|
||||
FROM ${BASE_IMAGE}:${BASE_IMAGE_VERSION}
|
||||
|
||||
ARG BUILD_NONCE
|
||||
ARG ENV_NAME
|
||||
ARG BUILD_COMMIT
|
||||
|
||||
ENV TOOLBOX_ENV=${ENV_NAME}
|
||||
LABEL local.build.commit=${BUILD_COMMIT}
|
||||
|
||||
LABEL local.${ENV_NAME}.nonce=${BUILD_NONCE}
|
||||
|
||||
ADD load-user-bashrc.sh /etc/profile.d/99-load-user-bashrc.sh
|
||||
ADD google-cloud-sdk.repo /etc/yum.repos.d/google-cloud-sdk.repo
|
||||
ADD kubernetes.repo /etc/yum.repos.d/kubernetes.repo
|
||||
ADD static-repos/google-cloud-sdk.repo /etc/yum.repos.d/google-cloud-sdk.repo
|
||||
ADD static-repos/kubernetes.repo /etc/yum.repos.d/kubernetes.repo
|
||||
ADD https://rpm.releases.hashicorp.com/fedora/hashicorp.repo /etc/yum.repos.d/hashicorp.repo
|
||||
ADD https://cli.github.com/packages/rpm/gh-cli.repo /etc/yum.repos.d/github-cli.repo
|
||||
ADD https://download.docker.com/linux/fedora/docker-ce.repo /etc/yum.repos.d/docker-ce.repo
|
||||
@@ -45,7 +41,6 @@ RUN dnf install --assumeyes \
|
||||
pinentry \
|
||||
podman-remote \
|
||||
postgresql \
|
||||
powerline \
|
||||
python3-devel \
|
||||
python3.10 \
|
||||
python3.10-devel \
|
||||
@@ -60,10 +55,13 @@ RUN dnf install --assumeyes \
|
||||
virt-install \
|
||||
xxhash-devel
|
||||
|
||||
ADD install-rpms.bash /tmp/install-rpms.bash
|
||||
RUN bash /tmp/install-rpms.bash && rm -rf /tmp/install-rpms.bash
|
||||
ADD github-install.bash /tmp/github-install.bash
|
||||
RUN bash /tmp/github-install.bash && \
|
||||
rm -rf /tmp/github-install.bash && \
|
||||
curl -sSLo /tmp/starship.sh https://starship.rs/install.sh && \
|
||||
sh /tmp/starship.sh --yes && \
|
||||
rm -rf /tmp/starship.sh
|
||||
|
||||
ADD install-bins.bash /tmp/install-bins.bash
|
||||
RUN bash /tmp/install-bins.bash && rm -rf /tmp/install-bins.bash
|
||||
ADD profile.d/*.sh /etc/profile.d/
|
||||
|
||||
RUN ln -s /usr/bin/podman-remote /usr/bin/podman
|
||||
75
container/github-install.bash
Executable file
75
container/github-install.bash
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
function get_latest() {
|
||||
local repo="${1}"
|
||||
echo $(curl -sSL "https://api.github.com/repos/${repo}/releases/latest" | jq -r '.tag_name')
|
||||
}
|
||||
|
||||
function do_install() {
|
||||
local name
|
||||
name="${1}"
|
||||
|
||||
local url
|
||||
url="${2}"
|
||||
|
||||
local working
|
||||
working=$(mktemp -d)
|
||||
|
||||
local current
|
||||
current=$(pwd)
|
||||
|
||||
echo "Downloading ${name} from ${url}"
|
||||
|
||||
if [[ "${url}" == *.tar.gz ]]; then
|
||||
curl --fail-with-body -sSLo "${working}/${name}.tar.gz" "${url}"
|
||||
cd "${working}"
|
||||
tar -xf "${name}.tar.gz"
|
||||
elif [[ "${url}" == *.zip ]]; then
|
||||
curl --fail-with-body -sSLo "${working}/${name}.zip" "${url}"
|
||||
cd "${working}"
|
||||
unzip "${name}.zip"
|
||||
elif [[ "${url}" == *.rpm ]]; then
|
||||
curl --fail-with-body -sSLo "${working}/${name}.rpm" "${url}"
|
||||
else
|
||||
curl --fail-with-body -sSLo "${working}/${name}" "${url}"
|
||||
fi
|
||||
|
||||
if [[ "${url}" == *.rpm ]]; then
|
||||
dnf install --assumeyes "${working}/${name}.rpm"
|
||||
else
|
||||
mv "${working}/${name}" "/usr/local/bin/${name}"
|
||||
chmod +x "/usr/local/bin/${name}"
|
||||
fi
|
||||
|
||||
cd "${current}"
|
||||
rm -rf "${working}"
|
||||
}
|
||||
|
||||
doctl=$(get_latest digitalocean/doctl)
|
||||
do_install "doctl" "https://github.com/digitalocean/doctl/releases/download/${doctl}/doctl-${doctl:1}-linux-amd64.tar.gz"
|
||||
|
||||
tflint=$(get_latest terraform-linters/tflint)
|
||||
do_install "tflint" "https://github.com/terraform-linters/tflint/releases/download/${tflint}/tflint_linux_amd64.zip"
|
||||
|
||||
butane=$(get_latest coreos/butane)
|
||||
do_install "butane" "https://github.com/coreos/butane/releases/download/${butane}/butane-x86_64-unknown-linux-gnu"
|
||||
|
||||
act=$(get_latest nektos/act)
|
||||
do_install "act" "https://github.com/nektos/act/releases/download/${act}/act_Linux_x86_64.tar.gz"
|
||||
|
||||
hadolint=$(get_latest hadolint/hadolint)
|
||||
do_install "hadolint" "https://github.com/hadolint/hadolint/releases/download/${hadolint}/hadolint-Linux-x86_64"
|
||||
|
||||
tenv=$(get_latest tofuutils/tenv)
|
||||
do_install "tenv" "https://github.com/tofuutils/tenv/releases/download/${tenv}/tenv_${tenv}_amd64.rpm"
|
||||
|
||||
sops=$(get_latest getsops/sops)
|
||||
do_install "sops" "https://github.com/getsops/sops/releases/download/${sops}/sops-${sops:1}-1.x86_64.rpm"
|
||||
|
||||
cosign=$(get_latest sigstore/cosign)
|
||||
do_install cosign "https://github.com/sigstore/cosign/releases/download/${cosign}/cosign-${cosign:1}-1.x86_64.rpm"
|
||||
|
||||
codium=$(get_latest VSCodium/vscodium)
|
||||
do_install codium "https://github.com/VSCodium/vscodium/releases/download/${codium}/codium-${codium}-el8.x86_64.rpm"
|
||||
13
container/profile.d/99-aliases.sh
Normal file
13
container/profile.d/99-aliases.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
alias dnf='echo "WARNING: Package installs should require a toolbox rebuild, use dnf-local to override"'
|
||||
alias dnf-local='command dnf'
|
||||
|
||||
alias prun="poetry run"
|
||||
alias psync="poetry install --sync"
|
||||
alias code='codium'
|
||||
alias ssh='ssh -F ~/.ssh/config'
|
||||
|
||||
alias bk='cd -'
|
||||
alias fuck='sudo $(history -p \!\!)'
|
||||
alias cls='clear'
|
||||
@@ -15,6 +15,3 @@ fi
|
||||
if [ -f "${HOME}"/.bashrc ]; then
|
||||
source "${HOME}/.bashrc";
|
||||
fi
|
||||
|
||||
alias dnf='echo "WARNING: Package installs should require a toolbox rebuild, use dnf-local to override"'
|
||||
alias dnf-local='command dnf'
|
||||
87
container/profile.d/toolbox.sh
Normal file
87
container/profile.d/toolbox.sh
Normal file
@@ -0,0 +1,87 @@
|
||||
# This is a patched version of the default toolbox.sh that
|
||||
# comes with default toolbox images. The only thing I modified
|
||||
# is removing the mucking about with PS1 since I'm using starship
|
||||
# for that
|
||||
|
||||
# shellcheck shell=sh
|
||||
|
||||
# shellcheck disable=SC2153
|
||||
[ "${BASH_VERSION:-}" != "" ] || [ "${ZSH_VERSION:-}" != "" ] || return 0
|
||||
[ "$PS1" != "" ] || return 0
|
||||
|
||||
toolbox_config="$HOME/.config/toolbox"
|
||||
host_welcome_stub="$toolbox_config/host-welcome-shown"
|
||||
toolbox_welcome_stub="$toolbox_config/toolbox-welcome-shown"
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck disable=SC2046
|
||||
eval $(
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
else
|
||||
. /usr/lib/os-release
|
||||
fi
|
||||
|
||||
echo ID="$ID"
|
||||
echo PRETTY_NAME="\"$PRETTY_NAME\""
|
||||
echo VARIANT_ID="$VARIANT_ID"
|
||||
)
|
||||
|
||||
if [ -f /run/ostree-booted ] \
|
||||
&& ! [ -f "$host_welcome_stub" ] \
|
||||
&& [ "${ID}" = "fedora" ] \
|
||||
&& { [ "${VARIANT_ID}" = "workstation" ] \
|
||||
|| [ "${VARIANT_ID}" = "silverblue" ] \
|
||||
|| [ "${VARIANT_ID}" = "kinoite" ] \
|
||||
|| [ "${VARIANT_ID}" = "sericea" ]; }; then
|
||||
echo ""
|
||||
echo "Welcome to ${PRETTY_NAME:-Linux}."
|
||||
echo ""
|
||||
echo "This terminal is running on the host system. You may want to try"
|
||||
echo "out the Toolbx for a directly mutable environment that allows "
|
||||
echo "package installation with DNF."
|
||||
echo ""
|
||||
printf "For more information, see the "
|
||||
# shellcheck disable=SC1003
|
||||
printf '\033]8;;https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/\033\\documentation\033]8;;\033\\'
|
||||
printf ".\n"
|
||||
echo ""
|
||||
|
||||
mkdir -p "$toolbox_config"
|
||||
touch "$host_welcome_stub"
|
||||
fi
|
||||
|
||||
if [ -f /run/.containerenv ] \
|
||||
&& [ -f /run/.toolboxenv ]; then
|
||||
if ! [ -f /etc/profile.d/vte.sh ] && [ -z "$PROMPT_COMMAND" ] && [ "${VTE_VERSION:-0}" -ge 3405 ]; then
|
||||
case "$TERM" in
|
||||
xterm*|vte*)
|
||||
[ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND=" "
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "$TERM" != "" ]; then
|
||||
error_message="Error: terminfo entry not found for $TERM"
|
||||
term_without_first_character="${TERM#?}"
|
||||
term_just_first_character="${TERM%"$term_without_first_character"}"
|
||||
terminfo_sub_directory="$term_just_first_character/$TERM"
|
||||
|
||||
if [ "$TERMINFO" = "" ]; then
|
||||
! [ -e "/usr/share/terminfo/$terminfo_sub_directory" ] \
|
||||
&& ! [ -e "/lib/terminfo/$terminfo_sub_directory" ] \
|
||||
&& ! [ -e "$HOME/.terminfo/$terminfo_sub_directory" ] \
|
||||
&& echo "$error_message" >&2
|
||||
else
|
||||
! [ -e "$TERMINFO/$terminfo_sub_directory" ] \
|
||||
&& echo "$error_message" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
unset ID
|
||||
unset PRETTY_NAME
|
||||
unset VARIANT_ID
|
||||
unset toolbox_config
|
||||
unset host_welcome_stub
|
||||
unset toolbox_welcome_stub
|
||||
2
container/static-repos/README.md
Normal file
2
container/static-repos/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
These repository files have no canonical home online so need to be statically
|
||||
saved and directly added to the container.
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
latest_doctl=$(curl -sSL https://api.github.com/repos/digitalocean/doctl/releases/latest | jq -r '.tag_name')
|
||||
latest_tflint=$(curl -sSL https://api.github.com/repos/terraform-linters/tflint/releases/latest | jq -r '.tag_name')
|
||||
latest_butane=$(curl -sSL https://api.github.com/repos/coreos/butane/releases/latest | jq -r '.tag_name')
|
||||
latest_act=$(curl -sSL https://api.github.com/repos/nektos/act/releases/latest | jq -r '.tag_name')
|
||||
latest_hadolint=$(curl -sSL https://api.github.com/repos/hadolint/hadolint/releases/latest | jq -r '.tag_name')
|
||||
|
||||
mkdir -p /tmp/bins
|
||||
|
||||
working=$(mktemp -d)
|
||||
doctl_url="https://github.com/digitalocean/doctl/releases/download/${latest_doctl}/doctl-${latest_doctl:1}-linux-amd64.tar.gz"
|
||||
echo "Downloading doctl-${latest_doctl}: ${doctl_url}"
|
||||
curl --fail-with-body -sSLo "${working}/doctl.tar.gz" "${doctl_url}"
|
||||
cd "${working}"
|
||||
tar -xf doctl.tar.gz
|
||||
mv "${working}/doctl" /tmp/bins/doctl
|
||||
chmod +x /tmp/bins/doctl
|
||||
cd ~
|
||||
rm -rf "${working}"
|
||||
|
||||
working=$(mktemp -d)
|
||||
tflint_url="https://github.com/terraform-linters/tflint/releases/download/${latest_tflint}/tflint_linux_amd64.zip"
|
||||
echo "Downloading tflint-${latest_tflint}: ${tflint_url}"
|
||||
curl --fail-with-body -sSLo "${working}/tflint.zip" "${tflint_url}"
|
||||
cd "${working}"
|
||||
unzip tflint.zip
|
||||
mv tflint /tmp/bins/tflint
|
||||
chmod +x /tmp/bins/tflint
|
||||
cd ~
|
||||
rm -rf "${working}"
|
||||
|
||||
butane_url="https://github.com/coreos/butane/releases/download/${latest_butane}/butane-x86_64-unknown-linux-gnu"
|
||||
echo "Downloading butane-${latest_butane}: ${butane_url}"
|
||||
curl --fail-with-body -sSLo "/tmp/bins/butane" "${butane_url}"
|
||||
chmod +x /tmp/bins/butane
|
||||
|
||||
working=$(mktemp -d)
|
||||
act_url="https://github.com/nektos/act/releases/download/${latest_act}/act_Linux_x86_64.tar.gz"
|
||||
echo "Downloading act-${latest_act}: ${act_url}"
|
||||
curl --fail-with-body -sSLo "${working}/act.tar.gz" "${act_url}"
|
||||
cd "${working}"
|
||||
tar -xf act.tar.gz
|
||||
mv "${working}/act" /tmp/bins/act
|
||||
chmod +x /tmp/bins/act
|
||||
cd ~
|
||||
rm -rf "${working}"
|
||||
|
||||
hadolint_url="https://github.com/hadolint/hadolint/releases/download/${latest_hadolint}/hadolint-Linux-x86_64"
|
||||
echo "Downloading hadolint-${latest_hadolint}: ${hadolint_url}"
|
||||
curl --fail-with-body -sSLo "/tmp/bins/hadolint" "${hadolint_url}"
|
||||
chmod +x /tmp/bins/hadolint
|
||||
|
||||
mv /tmp/bins/* /usr/local/bin/
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
latest_tenv=$(curl -sSL https://api.github.com/repos/tofuutils/tenv/releases/latest | jq -r '.tag_name')
|
||||
latest_sops=$(curl -sSL https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name')
|
||||
latest_cosign=$(curl -sSL https://api.github.com/repos/sigstore/cosign/releases/latest | jq -r '.tag_name')
|
||||
latest_codium=$(curl -sSL https://api.github.com/repos/VSCodium/vscodium/releases/latest | jq -r '.tag_name')
|
||||
|
||||
mkdir -p /tmp/rpms
|
||||
|
||||
tenv_url="https://github.com/tofuutils/tenv/releases/download/${latest_tenv}/tenv_${latest_tenv}_amd64.rpm"
|
||||
echo "Downloading tenv-${latest_tenv}: ${tenv_url}"
|
||||
curl --fail-with-body -sSLo /tmp/rpms/tenv.rpm "${tenv_url}"
|
||||
|
||||
sops_url="https://github.com/getsops/sops/releases/download/${latest_sops}/sops-${latest_sops:1}-1.x86_64.rpm"
|
||||
echo "Downloading sops-${latest_sops}: ${sops_url}"
|
||||
curl --fail-with-body -sSLo /tmp/rpms/sops.rpm "${sops_url}"
|
||||
|
||||
cosign_url="https://github.com/sigstore/cosign/releases/download/${latest_cosign}/cosign-${latest_cosign:1}-1.x86_64.rpm"
|
||||
echo "Downloading cosign-${latest_cosign}: ${cosign_url}"
|
||||
curl --fail-with-body -sSLo /tmp/rpms/cosign.rpm "${cosign_url}"
|
||||
|
||||
codium_url="https://github.com/VSCodium/vscodium/releases/download/${latest_codium}/codium-${latest_codium}-el8.x86_64.rpm"
|
||||
echo "Downloading vscodium-${latest_codium}: ${codium_url}"
|
||||
curl -sSLo /tmp/rpms/codium.rpm "${codium_url}"
|
||||
|
||||
dnf install --assumeyes /tmp/rpms/*.rpm
|
||||
|
||||
rm -rf /tmp/rpms
|
||||
3
scripts.d/00-directories.sh
Normal file
3
scripts.d/00-directories.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
export rc="$HOME/.bashrc"
|
||||
export rcr="$HOME/.config/bashrc.d"
|
||||
export PROJECTS_PATH="$HOME/Projects"
|
||||
18
scripts.d/01-aliases.sh
Normal file
18
scripts.d/01-aliases.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
alias fuck='sudo $(history -p \!\!)'
|
||||
alias cls='clear'
|
||||
alias ls='/usr/bin/ls -lshF --color --group-directories-first --time-style=long-iso'
|
||||
alias gmtime='/usr/bin/date -u --iso-8601=seconds'
|
||||
alias date='/usr/bin/date --iso-8601=seconds'
|
||||
alias whatismyip='curl https://icanhazip.com/'
|
||||
alias uuid="python3 -c 'import uuid; print(uuid.uuid4());'"
|
||||
alias epoch="python3 -c 'import time; print(time.time());'"
|
||||
alias uptime="command uptime --pretty"
|
||||
alias doc='cd ~/Documents'
|
||||
alias dn='cd ~/Downloads'
|
||||
alias pic='cd ~/Pictures'
|
||||
alias prun="poetry run"
|
||||
alias psync="poetry install --sync"
|
||||
alias code='codium'
|
||||
alias ssh='ssh -F ~/.ssh/config'
|
||||
alias whereami='echo $LOCATION'
|
||||
alias gg='dev'
|
||||
3
scripts.d/02-direnv.sh
Normal file
3
scripts.d/02-direnv.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
if direnv --version &>/dev/null; then
|
||||
eval "$(direnv hook bash)";
|
||||
fi
|
||||
12
scripts.d/10-cardstat.sh
Normal file
12
scripts.d/10-cardstat.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
cardstat() {
|
||||
local workdir="${GNUPGHOME:-$HOME/.gnupg}"
|
||||
|
||||
if ! gpg --card-status &>/dev/null; then
|
||||
systemctl restart pcscd;
|
||||
fi
|
||||
touch "${workdir}/unlock.txt";
|
||||
gpg --sign "${workdir}/unlock.txt";
|
||||
rm -f "${workdir}/unlock.txt.gpg";
|
||||
rm -f "${workdir}/unlock.txt";
|
||||
gpg --card-status;
|
||||
}
|
||||
8
scripts.d/10-random.sh
Normal file
8
scripts.d/10-random.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
function random() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
num=32
|
||||
else
|
||||
num=$1
|
||||
fi
|
||||
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $num | head -n 1
|
||||
}
|
||||
11
scripts.d/10-starship.sh
Normal file
11
scripts.d/10-starship.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
function set_window_title() {
|
||||
if [[ "${PWD}" == $PROJECTS_PATH/* ]]; then
|
||||
echo -ne "\033]0; Project: $(basename ${PWD}) \007"
|
||||
else
|
||||
echo -ne "\033]0; $LOCATION \007"
|
||||
fi
|
||||
}
|
||||
|
||||
starship_precmd_user_func="set_window_title"
|
||||
|
||||
eval "$(starship init bash)"
|
||||
1
scripts.d/10-up.sh
Normal file
1
scripts.d/10-up.sh
Normal file
@@ -0,0 +1 @@
|
||||
function up() { cd $(eval printf '../'%.0s {1..$1}); }
|
||||
55
scripts.d/50-dev.sh
Normal file
55
scripts.d/50-dev.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
DEVENV_IMAGE='localhost/toolbox-dev-env:latest'
|
||||
|
||||
function dev() {
|
||||
if [ ${#} -lt 1 ]; then
|
||||
echo "WARNING: Missing project name";
|
||||
project=""
|
||||
else
|
||||
project="${1}"
|
||||
fi
|
||||
|
||||
if [ -f '/run/.toolboxenv' ]; then
|
||||
cd "${PROJECTS_PATH}/${project}";
|
||||
|
||||
if [ -f "${PWD}/ansible.cfg" ]; then
|
||||
export ANSIBLE_CONFIG="${PWD}/ansible.cfg";
|
||||
export ANSIBLE_COLLECTIONS_PATH="${PWD}/.ansible"
|
||||
fi
|
||||
|
||||
if [ -f "${PWD}/pyproject.toml" ]; then
|
||||
poetry_venv=$(poetry env info --path)
|
||||
|
||||
if [ ! -z "${poetry_venv}" ] && [ -f "${poetry_venv}/bin/activate" ]; then
|
||||
source "${poetry_venv}/bin/activate";
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ ! -d "${PROJECTS_PATH}/${project}" ]; then
|
||||
echo "ERROR: Project path ${PROJECTS_PATH}/${project} does not exist";
|
||||
return 1
|
||||
fi
|
||||
|
||||
local slug=$(random 8)
|
||||
local container_name="toolbox-${project:-generic}-${slug}"
|
||||
|
||||
toolbox create --image="${DEVENV_IMAGE}" "${container_name}" &>/dev/null || return 1
|
||||
|
||||
local current=$(pwd)
|
||||
cd "${PROJECTS_PATH}/${project}"
|
||||
echo ">>> Loading project: ${project}"
|
||||
echo ">>> ${PWD}"
|
||||
toolbox enter "${container_name}"
|
||||
echo ">>> Exited: ${container_name}"
|
||||
cd "${current}"
|
||||
|
||||
podman container stop "${container_name}" &>/dev/null
|
||||
podman container rm --force "${container_name}" &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f '/run/.toolboxenv' ]; then
|
||||
if [[ "${PWD}" == $PROJECTS_PATH/* ]]; then
|
||||
dev $(basename "${PWD}")
|
||||
fi
|
||||
fi
|
||||
|
||||
1
starship.discovery.color
Normal file
1
starship.discovery.color
Normal file
@@ -0,0 +1 @@
|
||||
#893937
|
||||
49
starship.toml
Normal file
49
starship.toml
Normal file
@@ -0,0 +1,49 @@
|
||||
add_newline = false
|
||||
|
||||
format = '[ ](bold fg:#000000 bg:#XXXXXX)${custom.toolbox}${custom.localhost}[](bold fg:#XXXXXX bg:#444444)$directory$python$git_branch$git_status$status$character'
|
||||
|
||||
[directory]
|
||||
format = "[$read_only]($read_only_style)[$path ]($style)[](fg:#444444 bg:#000000)"
|
||||
style = "fg:bright-white bg:#444444"
|
||||
read_only = ' '
|
||||
read_only_style = "bold fg:red bg:#444444"
|
||||
truncation_symbol = ' '
|
||||
home_symbol = '~'
|
||||
[directory.substitutions]
|
||||
'/' = ' '
|
||||
'~ ' = ''
|
||||
|
||||
[character]
|
||||
success_symbol = '[](bold fg:#000000)'
|
||||
error_symbol = '[](bold fg:#6d0505)'
|
||||
|
||||
[status]
|
||||
disabled = false
|
||||
symbol = ''
|
||||
pipestatus = true
|
||||
style = "bold fg:bright-white bg:#6d0505"
|
||||
format = '[](bold fg:#000000 bg:#6d0505)[ $status ]($style)'
|
||||
|
||||
[git_branch]
|
||||
symbol = ''
|
||||
format = '[](bold fg:#000000 bg:#44b240)[$symbol $branch]($style)[](bold bg:#000000 fg:#44b240)'
|
||||
style = 'bold bg:#44b240 fg:black'
|
||||
|
||||
[git_status]
|
||||
style = "bold fg:black bg:#f4862c"
|
||||
format = '([](bold fg:#000000 bg:#f4862c)[$all_status$ahead_behind]($style)[](bold bg:#000000 fg:#f4862c))'
|
||||
|
||||
[python]
|
||||
style = 'bold bg:#fcf52a fg:black'
|
||||
symbol = ''
|
||||
format = '([](bold fg:#000000 bg:#fcf52a)[$virtualenv]($style)[](bold bg:#000000 fg:#fcf52a))'
|
||||
|
||||
[custom.toolbox]
|
||||
style = "bold bg:#XXXXXX fg:bright-white"
|
||||
command = "echo -ne ' toolbox'"
|
||||
when = '[ -f /run/.toolboxenv ]'
|
||||
|
||||
[custom.localhost]
|
||||
style = "bold bg:#XXXXXX fg:bright-white"
|
||||
command = 'echo -ne " $HOSTNAME"'
|
||||
when = '[ ! -f /run/.toolboxenv ]'
|
||||
1
starship.voyager.color
Normal file
1
starship.voyager.color
Normal file
@@ -0,0 +1 @@
|
||||
#01568e
|
||||
Reference in New Issue
Block a user