diff --git a/to_system/home/l_samenv/.bash_profile b/to_system/home/l_samenv/.bash_profile index 06a2388..360f0ce 100644 --- a/to_system/home/l_samenv/.bash_profile +++ b/to_system/home/l_samenv/.bash_profile @@ -9,4 +9,4 @@ pathadd ~/bin pathadd ~/.local/bin pathadd ~/frappy/bin -. ~/.bash_samenv +. ~/.config/linse_profile diff --git a/to_system/home/l_samenv/.bash_samenv b/to_system/home/l_samenv/.config/linse_profile similarity index 63% rename from to_system/home/l_samenv/.bash_samenv rename to to_system/home/l_samenv/.config/linse_profile index 5f36982..2ea201b 100644 --- a/to_system/home/l_samenv/.bash_samenv +++ b/to_system/home/l_samenv/.config/linse_profile @@ -1,14 +1,9 @@ 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 +. ~/.config/linse_setuser -if [ -f ~/.config/setuser/setuser.sh ]; then - . ~/.config/setuser/setuser.sh -fi +export GIT_AUTHOR_NAME=PREVENT_DEFAULT function gitea_git() ( for repo in "$@"; do diff --git a/to_system/home/l_samenv/.config/linse_setuser b/to_system/home/l_samenv/.config/linse_setuser new file mode 100644 index 0000000..5ed9b28 --- /dev/null +++ b/to_system/home/l_samenv/.config/linse_setuser @@ -0,0 +1,44 @@ +function setuser() { + if [[ $# -eq 0 ]]; then + cat << EOF + + Usage: + setuser + + set author for git commit and get gitea token from linse-c if available + +EOF + if [[ ! -z "$LC_IDENTIFICATION" ]]; then + local id=($LC_IDENTIFICATION) + echo "you are already identified as ${id[@]:2:9} <${id[1]}>" + echo " " + fi + return 1 + fi + local isuser=$(ssh l_samenv@linse-c "test -d ~$1 && echo OK" 2>/dev/null) + if [[ "$isuser" == "OK" ]]; then + local id=($LC_IDENTIFICATION) + echo " " + if [[ ! -z "$id" ]]; then + echo "you are already identified as: ${id[@]:2:9} <${id[1]}> - you may press ctrl-c to abort" + fi + echo "get token from $1@linse-c" + export LC_IDENTIFICATION=$(ssh $1@linse-c 'echo $LC_IDENTIFICATION' 2>/dev/null) + if [[ -z "$LC_IDENTIFICATION" ]]; then + echo "LC_IDENTIFICATION is not defined in your rc file on $1@linse-c" + else + local id=($LC_IDENTIFICATION) + echo "you are identified as ${id[@]:2:9} <${id[1]}>" + fi + echo " " + else + host=($(hostname -A)) + export GIT_AUTHOR_NAME="$1" + export GIT_AUTHOR_EMAIL="$1@$host" + echo " " + echo "$1 is no valid linux user on linse-c -> not gitea token available for git push" + echo " " + echo "however, you are identified as $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> for git commit" + echo " " + fi +}