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 # done for my blog http://www.cipherbliss.com
# #
# load variables # load variables
echo " chargement de bash aliases" source ~/Nextcloud/ressources/workflow_nextcloud/workflow_variables.sh
source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh source $WORKFLOW_PATH/install/.bash_custom_aliases
source $WORKFLOW_PATH_PUBLIC/install/.bash_custom_aliases

View File

@ -14,7 +14,11 @@ alias work="cd $www_folder/scripts/mapping_geojson_to_osm_tags"
########## lieux ########### ########## lieux ###########
alias dok="docker-compose" alias dok="docker-compose"
alias dc="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 alias gow="cd $WORKFLOW_PATH" # go to folder of nextcloud where i store my scripts
###### lieux locaux ###### lieux locaux
@ -169,19 +173,35 @@ source $WORKFLOW_PATH/install/functions_sync.sh
source $WORKFLOW_PATH/install/functions_tk.sh source $WORKFLOW_PATH/install/functions_tk.sh
export HISTTIMEFORMAT="%d/%m/%y %T " export HISTTIMEFORMAT="%d/%m/%y %T "
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
#!/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 # ------------------- work stuff
export DOTNET_ROOT=$HOME/.dotnet # export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools # export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
nvm use stable
#!/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" #echo "loading zfs keys"
zfs load-key poule/encrypted
zfs mount -a
#!/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 defaultRemote = origin
[core] [core]
editor = gedit 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 source $ZSH/oh-my-zsh.sh
# User configuration # 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" # export MANPATH="/usr/local/man:$MANPATH"
@ -106,9 +100,4 @@ if [[ -n $SSH_CONNECTION ]]; then
# alias zshconfig="mate ~/.zshrc" # alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh" # alias ohmyzsh="mate ~/.oh-my-zsh"
if [ "$debug" = true ]; then
echo "chargement des aliases ~/.bash_aliases"
fi
source ~/.bash_aliases source ~/.bash_aliases

View File

@ -4,91 +4,100 @@
# source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh # source ~/Nextcloud/ressources/workflow_nextcloud/public_workflow/workflow_variables.sh
# #
# #
export load_only_once=true
#!/bin/bash
export debug=true export debug=true
if [ "$debug" = true ]; then if [ -z ${load_only_once+x} ]; then
echo "premier chargement"
if [ "$debug" = true ]; then
echo "# chargement des variables de workflow" echo "# chargement des variables de workflow"
fi fi
export main_user="tykayn" export main_user="tykayn"
export main_archive_source_ssh_lan="tykayn@192.168.1.14" export main_archive_source_ssh_lan="tykayn@192.168.1.14"
export backup_laptop_archive_path="/home/poule/backup/encrypted" export backup_laptop_archive_path="/home/poule/backup/encrypted"
export WORKFLOW_PATH=~/Nextcloud/ressources/workflow_nextcloud export WORKFLOW_PATH=~/Nextcloud/ressources/workflow_nextcloud
export WORKFLOW_PATH_PUBLIC=~/Nextcloud/ressources/workflow_nextcloud/public_workflow export WORKFLOW_PATH_PUBLIC=~/Nextcloud/ressources/workflow_nextcloud/public_workflow
export WORKFLOW_PATH_ROOT=/home/$main_user/Nextcloud/ressources/workflow_nextcloud export WORKFLOW_PATH_ROOT=/home/$main_user/Nextcloud/ressources/workflow_nextcloud
export ALIASES_PATH=$WORKFLOW_PATH/install/.bash_custom_aliases export ALIASES_PATH=$WORKFLOW_PATH/install/.bash_custom_aliases
# fichiers orgmode, wiki personnel # fichiers orgmode, wiki personnel
export orgmode_path=~/Nextcloud/textes/orgmode export orgmode_path=~/Nextcloud/textes/orgmode
export inbox_orgmode=$orgmode_path/incoming_inbox.org export inbox_orgmode=$orgmode_path/incoming_inbox.org
export orgroam_path=~/Nextcloud/textes/orgmode/org-roam export orgroam_path=~/Nextcloud/textes/orgmode/org-roam
export backup_texts_folder=~/archives/backup_automatique export backup_texts_folder=~/archives/backup_automatique
export HOME_OF_SCRIPTS=$www_folder/scripts export HOME_OF_SCRIPTS=$www_folder/scripts
# archives dans un pool zfs nommé poule # archives dans un pool zfs nommé poule
export stockage_syncable_folder=/home/poule/encrypted/stockage-syncable export stockage_syncable_folder=/home/poule/encrypted/stockage-syncable
# dossier où stocker les projets de dev # dossier où stocker les projets de dev
export www_folder=$stockage_syncable_folder/www/development/html export www_folder=$stockage_syncable_folder/www/development/html
export node_version_expected=20 export node_version_expected=20
export today=`date` # to log current time export today=`date` # to log current time
export ARCHIVE_SYNCABLE=$stockage_syncable_folder # place where we have our things sorted, other than home export ARCHIVE_SYNCABLE=$stockage_syncable_folder # place where we have our things sorted, other than home
export BORG_PASSCOMMAND="cat $ARCHIVE_SYNCABLE/.tk-borg-passphrase-light" # get the borg repo pass export BORG_PASSCOMMAND="cat $ARCHIVE_SYNCABLE/.tk-borg-passphrase-light" # get the borg repo pass
export a_dispatcher="$ARCHIVE_SYNCABLE/photos/a_dispatcher" # dossier où sont stockées les photos en provenance du smartphone export a_dispatcher="$ARCHIVE_SYNCABLE/photos/a_dispatcher" # dossier où sont stockées les photos en provenance du smartphone
export PHOTOS_TO_DISPATCH="$a_dispatcher" export PHOTOS_TO_DISPATCH="$a_dispatcher"
export PHOTOS_FOLDER="$ARCHIVE_SYNCABLE/photos/" export PHOTOS_FOLDER="$ARCHIVE_SYNCABLE/photos/"
export SPACESHIP_BORG_REPO="/home/poule/borg_archives/backup_land4to" export SPACESHIP_BORG_REPO="/home/poule/borg_archives/backup_land4to"
export SPACESHIP_NEW_BORG_REPO="/home/poule/borg_archives/borg2" export SPACESHIP_NEW_BORG_REPO="/home/poule/borg_archives/borg2"
export BORG_REPO=$SPACESHIP_NEW_BORG_REPO export BORG_REPO=$SPACESHIP_NEW_BORG_REPO
export LOG_FILE_BACKUP="$ARCHIVE_SYNCABLE/www/backup/log_backup.log" export LOG_FILE_BACKUP="$ARCHIVE_SYNCABLE/www/backup/log_backup.log"
# log dates of execution of the script # log dates of execution of the script
export LOG_FILE_BACKUP_DATES="$ARCHIVE_SYNCABLE/www/backup/summary_log_backup.log" export LOG_FILE_BACKUP_DATES="$ARCHIVE_SYNCABLE/www/backup/summary_log_backup.log"
export main_archive_source_sftop_spaceship="/mnt/spaceship_poule" export main_archive_source_sftop_spaceship="/mnt/spaceship_poule"
export IP_DU_NAS="/mnt/spaceship_poule" export IP_DU_NAS="/mnt/spaceship_poule"
export CURRENT_YEAR=$(date +%Y) export CURRENT_YEAR=$(date +%Y)
# add custom workflow scripts # add custom workflow scripts
export PATH=$WORKFLOW_PATH:$PATH export PATH=$WORKFLOW_PATH:$PATH
########## colors for logging ######### ########## colors for logging #########
# https://wiki.archlinux.org/title/Bash/Prompt_customization#List_of_colors_for_prompt_and_Bash # https://wiki.archlinux.org/title/Bash/Prompt_customization#List_of_colors_for_prompt_and_Bash
# #
# echo -e "${txtred}asd${txtwht}" # echo -e "${txtred}asd${txtwht}"
# #
####################################### #######################################
export txtblk='\e[0;30m' # Black - Regular export txtblk='\e[0;30m' # Black - Regular
export txtred='\e[0;31m' # Red export txtred='\e[0;31m' # Red
export txtgrn='\e[0;32m' # Green export txtgrn='\e[0;32m' # Green
export txtylw='\e[0;33m' # Yellow export txtylw='\e[0;33m' # Yellow
export txtblu='\e[0;34m' # Blue export txtblu='\e[0;34m' # Blue
export txtpur='\e[0;35m' # Purple export txtpur='\e[0;35m' # Purple
export txtcyn='\e[0;36m' # Cyan export txtcyn='\e[0;36m' # Cyan
export txtwht='\e[0;37m' # White export txtwht='\e[0;37m' # White
export txtbold='\e[1m' # bold export txtbold='\e[1m' # bold
export txtreset='\e(B\e[m' # back to normal export txtreset='\e(B\e[m' # back to normal
# --------- gestion des exclusions de rsync -------- # # --------- gestion des exclusions de rsync -------- #
EXCLUDE=( ".yarn" ".nvm" "cache" ".cache" "Cache" "Steam" "steamapps" ".npm" ".yarn" "node_modules" ".mozilla" "vendor" "Steam" ".rbenv" ".config/borg" "@eaDir" "steamapps" "bower_components" ".cargo" ".gem" ".BOINC") EXCLUDE=( ".yarn" ".nvm" "cache" ".cache" "Cache" "Steam" "steamapps" ".npm" ".yarn" "node_modules" ".mozilla" "vendor" "Steam" ".rbenv" ".config/borg" "@eaDir" "steamapps" "bower_components" ".cargo" ".gem" ".BOINC")
exclude_opts=() exclude_opts=()
for item in "${EXCLUDE[@]}"; do for item in "${EXCLUDE[@]}"; do
exclude_opts+=( --exclude "$item" ) exclude_opts+=( --exclude "$item" )
done done
export exclude_opts export exclude_opts
if [ "$debug" = true ]; then if [ "$debug" = true ]; then
echo "# chargement des variables de workflow OK --------" echo "# chargement des variables de workflow OK --------"
fi fi
source $WORKFLOW_PATH_PUBLIC/variables.sh source $WORKFLOW_PATH_PUBLIC/variables.sh
else
echo "pas premier chargement"
fi