From 25de715a123871f98cd5ba21150e0cc3b4b7099d Mon Sep 17 00:00:00 2001 From: John Mertz Date: Mon, 12 Dec 2022 22:44:24 -0500 Subject: [PATCH] Clean up distrobox errors --- bash/bash_aliases | 4 ++-- bash/bash_login | 2 +- bash/bash_login.distrobox | 1 - bash/bash_logout | 2 +- bash/bash_profile | 2 +- bash/bashrc | 3 ++- bash/bashrc.distrobox | 3 +++ bash/bashrc.host | 1 + bash/path | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bash/bash_aliases b/bash/bash_aliases index 2ea3b529c..bf8552a0c 100644 --- a/bash/bash_aliases +++ b/bash/bash_aliases @@ -49,9 +49,9 @@ alias blc="${HOME}/scripts/thinkpad/blc.pl --notify" alias mpv="flatpak run io.mpv.Mpv" # Detect if I'm in a toolbox -alias istoolbox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv' +alias isdistrobox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv' -if [ $(istoolbox) ]; then +if [ $(isdistrobox) ]; then source $HOME/.dotfiles/bash/bash_aliases.distrobox else source $HOME/.dotfiles/bash/bash_aliases.host diff --git a/bash/bash_login b/bash/bash_login index 77a980ddc..2289b092a 100644 --- a/bash/bash_login +++ b/bash/bash_login @@ -26,7 +26,7 @@ if [ ! -e ${HOME}/.spool/last_login_gui ]; then echo "Use 'startsway' or 'starti3' to launch a GUI" fi -if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then +if [ -f "/run/.containerenv" ]; then source $HOME/.dotfiles/bash/bash_login.distrobox else source $HOME/.dotfiles/bash/bash_login.host diff --git a/bash/bash_login.distrobox b/bash/bash_login.distrobox index e28ccef48..e69de29bb 100644 --- a/bash/bash_login.distrobox +++ b/bash/bash_login.distrobox @@ -1 +0,0 @@ -export SWAYSOCK="${HOME}/.spool/sway-ipc.sock" diff --git a/bash/bash_logout b/bash/bash_logout index 19ba47d98..db9dac378 100644 --- a/bash/bash_logout +++ b/bash/bash_logout @@ -1,6 +1,6 @@ # vim: ft=sh -if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then +if [ -f "/run/.containerenv" ]; then source $HOME/.dotfiles/bash/bash_logout.distrobox else source $HOME/.dotfiles/bash/bash_logout.host diff --git a/bash/bash_profile b/bash/bash_profile index 0a196003f..07603a0e8 100644 --- a/bash/bash_profile +++ b/bash/bash_profile @@ -16,7 +16,7 @@ PERL_LOCAL_LIB_ROOT="${HOME}/perl5${PERL_LOCAL_LIB_ROOT:+:${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 +if [ -f "/run/.containerenv" ]; then source $HOME/.dotfiles/bash/bash_profile.distrobox else source $HOME/.dotfiles/bash/bash_profile.host diff --git a/bash/bashrc b/bash/bashrc index e84c20b24..68aef450e 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -22,6 +22,7 @@ export EDITOR="flatpak run io.neovim.nvim" # don't put duplicate lines or lines starting with space in the history. shopt -s histappend HISTCONTROL=ignoreboth +HISTFILE=${HOME}/.spool/bash_history # append to the history file, don't overwrite it # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) @@ -92,7 +93,7 @@ export TERM="xterm" # Set initial title echo -e -n "\033]2;Welcome to Bash\007" -if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then +if [ -f "/run/.containerenv" ]; then source $HOME/.dotfiles/bash/bashrc.distrobox else source $HOME/.dotfiles/bash/bashrc.host diff --git a/bash/bashrc.distrobox b/bash/bashrc.distrobox index e69de29bb..fbbd52196 100644 --- a/bash/bashrc.distrobox +++ b/bash/bashrc.distrobox @@ -0,0 +1,3 @@ +export DISTROBOX=`grep -oP "(?<=name=\")[^\";]+" /run/.containerenv` +HISTFILE=${HISTFILE}.$DISTROBOX +neofetch diff --git a/bash/bashrc.host b/bash/bashrc.host index 51945a405..d5e6b91a8 100644 --- a/bash/bashrc.host +++ b/bash/bashrc.host @@ -10,3 +10,4 @@ if [ -z $SSH_AGENT_PID ]; then fi fi +echo "This is the host OS. You probably want to open a Distrobox." diff --git a/bash/path b/bash/path index ec7e8900e..f3dcabbaa 100644 --- a/bash/path +++ b/bash/path @@ -30,7 +30,7 @@ fi # Perl PATH="${HOME}/perl5/bin:$PATH" -if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then +if [ -f "/run/.containerenv" ]; then source $HOME/.dotfiles/bash/path.distrobox else source $HOME/.dotfiles/bash/path.host