check already loaded variables, remove costly docker check in alias

This commit is contained in:
Tykayn 2024-02-14 17:04:44 +01:00 committed by tykayn
parent 67d5953c38
commit 4189bbaf8b
5 changed files with 128 additions and 110 deletions

View File

@ -4,6 +4,5 @@
# done for my blog http://www.cipherbliss.com
#
# load variables
echo " chargement de bash aliases"
source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh
source $WORKFLOW_PATH_PUBLIC/install/.bash_custom_aliases
source ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
source $WORKFLOW_PATH/install/.bash_custom_aliases

View File

@ -14,7 +14,11 @@ alias work="cd $www_folder/scripts/mapping_geojson_to_osm_tags"
########## lieux ###########
alias dok="docker-compose"
alias dc="docker-compose"
alias dckill="docker container kill $(docker container ls -q)"
# tuer tous les conteneurs docker
function dckill() {
docker container kill $(docker container ls -q)
}
alias gow="cd $WORKFLOW_PATH" # go to folder of nextcloud where i store my scripts
###### lieux locaux
@ -169,19 +173,35 @@ source $WORKFLOW_PATH/install/functions_sync.sh
source $WORKFLOW_PATH/install/functions_tk.sh
export HISTTIMEFORMAT="%d/%m/%y %T "
#!/bin/bash
if command -v nvm &> /dev/null
then
echo "nvm chargé"
else
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi
#gowork
# ------------------- work stuff
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
nvm use stable
# export DOTNET_ROOT=$HOME/.dotnet
# export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
#!/bin/bash
if [ "$(pwd)" = "/var/www/html/" ] || [ "$(pwd)" = "/var/www/html/*" ]; then
echo "chargement de node version stable"
nvm use stable
fi
#echo "loading zfs keys"
#!/bin/bash
# lancer le montage seulement si on est root
if [ "$(id -u)" = 0 ]; then
zfs load-key poule/encrypted
zfs mount -a
echo "root: partition ZFS déchiffrée et montée"
fi

View File

@ -23,3 +23,4 @@
defaultRemote = origin
[core]
editor = gedit
excludesFile = ~/.gitignore

View File

@ -75,12 +75,6 @@ plugins=(git cp colored-man-pages colorize command-not-found composer symfony2 p
source $ZSH/oh-my-zsh.sh
# User configuration
if [ -f ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh ]; then
. ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
else
echo "/!\\ bashrc: fichier de variables workflow_nextcloud non trouvé:"
echo "~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh"
fi
# export MANPATH="/usr/local/man:$MANPATH"
@ -106,9 +100,4 @@ if [[ -n $SSH_CONNECTION ]]; then
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
if [ "$debug" = true ]; then
echo "chargement des aliases ~/.bash_aliases"
fi
source ~/.bash_aliases

View File

@ -4,7 +4,12 @@
# source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh
#
#
export load_only_once=true
#!/bin/bash
export debug=true
if [ -z ${load_only_once+x} ]; then
echo "premier chargement"
if [ "$debug" = true ]; then
echo "# chargement des variables de workflow"
fi
@ -92,3 +97,7 @@ if [ "$debug" = true ]; then
fi
source $WORKFLOW_PATH_PUBLIC/variables.sh
else
echo "pas premier chargement"
fi