From 5ec713f1b1516f5d8f1cb5ff6ad540e6eed7b769 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 7 Apr 2025 17:26:53 +0200 Subject: [PATCH] added .bash_profile and .bash_samenv --- to_system/home/l_samenv/.bash_profile | 12 ++++++++++++ to_system/home/l_samenv/.bash_samenv | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 to_system/home/l_samenv/.bash_profile create mode 100644 to_system/home/l_samenv/.bash_samenv diff --git a/to_system/home/l_samenv/.bash_profile b/to_system/home/l_samenv/.bash_profile new file mode 100644 index 0000000..06a2388 --- /dev/null +++ b/to_system/home/l_samenv/.bash_profile @@ -0,0 +1,12 @@ +# helper for adding to PATH without duplicates +pathadd() { + if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then + PATH="${PATH:+"$PATH:"}$1" + fi +} + +pathadd ~/bin +pathadd ~/.local/bin +pathadd ~/frappy/bin + +. ~/.bash_samenv diff --git a/to_system/home/l_samenv/.bash_samenv b/to_system/home/l_samenv/.bash_samenv new file mode 100644 index 0000000..42632ac --- /dev/null +++ b/to_system/home/l_samenv/.bash_samenv @@ -0,0 +1,20 @@ +alias dir='ls -alF' +export EDITOR=nano + +if [ ! -f "~/.config/setuser/setuser.sh" ]; then + mkdir -p .config + scp -q -r -o BatchMode=yes -o StrictHostKeyChecking=no l_samenv@linse-c:.config/setuser ~/.config/ +fi + +if [ -f ~/.config/setuser/setuser.sh ]; then + . ~/.config/setuser/setuser.sh +fi + +function gitea_git() ( + for repo in "$@"; do + cd ~/$repo + scp -q -r -o BatchMode=yes -o StrictHostKeyChecking=no l_samenv@linse-c:gitea/hooks .git/ + grep -q 'https://gitea.psi.ch' .git/config || git remote set-url origin https:/gitea.psi.ch/linse/${repor}.git + grep -q '.git/hooks/get_gitea_token' .git/config || git config credential.helper "!source .git/hooks/get_gitea_token" + done +)