added chromium and vscode modules used to launch them in a more controlled way from specific locations

brew: append home path if it exists
python adding support for pyenv and alternative pipx location
trantor
Kebler Network System Administrator 2021-01-30 11:45:46 -08:00
parent e1822f681e
commit 803e1fab5e
4 changed files with 85 additions and 2 deletions

View File

@ -1 +1,2 @@
[[ -d "/opt/brew" ]] && path_append /opt/brew/bin || path_append /home/linuxbrew/.linuxbrew/bin
[[ -d "/opt/brew" ]] && path_append /opt/brew/bin
[[ -d /home/linuxbrew/.linuxbrew/bin ]] && path_append /home/linuxbrew/.linuxbrew/bin

View File

@ -1,5 +1,6 @@
#!/bin/bash
alias python3="python3.8"
# TODO make alias generating function for versions of python
alias python3x="sudo -H python3.8 -m"
alias spip="sudo -H python3.8 -m pip"
alias spipi="sudo -H python3.8 -m pip install"
alias spipiu="sudo -H python3.8 -m pip install -U"
@ -13,6 +14,20 @@ alias pipi="pipx install"
alias pipl="pipx list"
alias piplv="pipx list --verbose"
# pyenv environment
path_append "/opt/python/bin"
# eval "$(pyenv init -)"
# eval "$(pyenv virtualenv-init -)"
export PYENV_ROOT="/opt/python/pyenv"
export PYENV_VERSION=3.8.7
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
path_append "/opt/python/apps/bin"
export PIPX_HOME=/opt/python/apps
export PIPX_BIN_DIR=$PIPX_HOME/bin
spipua () {

43
all/modules/chromium.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
function mv_chromium () {
local _ch
local ch
_ch=$(command -v _chromium)
if [[ $_ch ]]; then
ch=$(dirname "$_ch")/chromium
## if chromium exits probably an update to so move again
[[ -f $ch ]] && sudo mv "${ch}" "$_ch" && echo chromium updated: $($_ch --version)
else
# echo no _chromium
ch=$(command -v chromium)
[[ $ch ]] && sudo mv "${ch}" "$(dirname "$ch")/_chromium" || return 1
fi
return 0
}
function chromium_ () {
local user
local dir
mv_chromium
[[ $? -ne 0 ]] && echo chromium not installed && return 1
# echo chromium executable available and moved to $(command -v _chromium)
user=${CHROME_USER:-$1}
user=${user:-$USER}
dir=${CHROME_CONFIG_HOME:-"$HOME/.config/chromium"}
[[ $user == "$USER" ]] && dir="$HOME/.config/chromium"
exe=$(command -v _chromium)
echo "$exe --user-data-dir=$dir/$user"
$exe --user-data-dir=$dir/$user
}
# # if script was executed then call the function
(return 0 2>/dev/null) || chromium_ $@

24
all/modules/vscode.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
command -v code >/dev/null 2>&1 || exit
vscode () {
home=${VSCODE_HOME:-$1}
home=${home:-$HOME}
echo $home
exts=${home}/extensions
user=${home}/user
exe=$(command -v code)
$exe --user-data-dir=$user --extensions-dir=$exts
}
# # if script was executed then call the function
(return 0 2>/dev/null) || vscode $@