Prepare to split out Distrobox and Host configs

This commit is contained in:
John Mertz 2022-12-12 14:29:13 -05:00
parent 9ceb5cf6db
commit e08678ffea
18 changed files with 33 additions and 12 deletions

View File

@ -51,5 +51,8 @@ alias mpv="flatpak run io.mpv.Mpv"
# Detect if I'm in a toolbox
alias istoolbox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv'
# Script to restore toolbox after it was replaced with distrobox and removed the default 'toolbox' name
alias toolbox="$HOME/scripts/toolbox.sh"
if [ $(istoolbox) ]; then
source $HOME/.dotfiles/bash/bash_aliases.distrobox
else
source $HOME/.dotfiles/bash/bash_aliases.host
fi

View File

@ -0,0 +1,2 @@
# Already in a toolbox
alias toolbox="echo You are already in a toolbox"

2
bash/bash_aliases.host Normal file
View File

@ -0,0 +1,2 @@
# Script to restore toolbox after it was replaced with distrobox and removed the default 'toolbox' name
alias toolbox="$HOME/scripts/toolbox.sh"

View File

@ -42,10 +42,8 @@ if [ ! -e ${HOME}/.spool/last_login_gui ]; then
echo "Use 'startsway' or 'starti3' to launch a GUI"
fi
# Distrobox only
if [ -f "/run/.containerenv" ]; then
:
# Host only
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
source $HOME/.dotfiles/bash/bash_login.distrobox
else
:
source $HOME/.dotfiles/bash/bash_login.host
fi

View File

0
bash/bash_login.host Normal file
View File

View File

@ -11,3 +11,9 @@ fi
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
source $HOME/.dotfiles/bash/bash_logout.distrobox
else
source $HOME/.dotfiles/bash/bash_logout.host
fi

View File

0
bash/bash_logout.host Normal file
View File

View File

@ -15,3 +15,9 @@ PERL5LIB="${HOME}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="${HOME}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
source $HOME/.dotfiles/bash/bash_profile.distrobox
else
source $HOME/.dotfiles/bash/bash_profile.host
fi

View File

0
bash/bash_profile.host Normal file
View File

View File

@ -104,10 +104,8 @@ if [ -z $SSH_AGENT_PID ]; then
fi
fi
# Distrobox only
if [ -f "/run/.containerenv" ]; then
:
# Host only
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
source $HOME/.dotfiles/bash/bashrc.distrobox
else
:
source $HOME/.dotfiles/bash/bashrc.host
fi

0
bash/bashrc.distrobox Normal file
View File

0
bash/bashrc.host Normal file
View File

View File

@ -30,5 +30,11 @@ fi
# Perl
PATH="${HOME}/perl5/bin:$PATH"
if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then
source $HOME/.dotfiles/bash/path.distrobox
else
source $HOME/.dotfiles/bash/path.host
fi
# Export PATH
export PATH="$PATH"

0
bash/path.distrobox Normal file
View File

0
bash/path.host Normal file
View File