From 6d704846d37a29390897f2c900eaa6b2a0a127b6 Mon Sep 17 00:00:00 2001 From: flo Date: Sat, 4 Jan 2025 04:30:13 +0100 Subject: [PATCH] remove ssh from profile --- .profile | 44 +++++++++----------------------------------- .systems.example | 2 +- bin/ssh | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 36 deletions(-) create mode 100644 bin/ssh diff --git a/.profile b/.profile index 151013d..cf72683 100644 --- a/.profile +++ b/.profile @@ -1,43 +1,17 @@ -# bin +# system-aliasses +if [ -f "$DEV_ENV_PATH/.aliases" ]; then + . "$DEV_ENV_PATH/.aliases" +fi + +# binaries . $DEV_ENV_PATH/bin/denv . $DEV_ENV_PATH/bin/dcom . $DEV_ENV_PATH/bin/drun . $DEV_ENV_PATH/bin/git -# /bin +. $DEV_ENV_PATH/bin/ssh -# alias -if [ -f "$DEV_ENV_PATH/.aliases" ]; then - . "$DEV_ENV_PATH/.aliases" -fi -# /alias - -# GIT branch in bash +# git branch in shell parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } -PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' -# /GIT branch in bash - - -# SSH -SSH_ENV="$HOME/.ssh/agent-environment" -function start_agent { - echo "Initialising new SSH agent..." - /usr/bin/ssh-agent | sed 's/^echo/#echo/' >"$SSH_ENV" - echo succeeded - chmod 600 "$SSH_ENV" - . "$SSH_ENV" >/dev/null - /usr/bin/ssh-add; - - ssh-add ~/.ssh/gitea_ssh -} - -if [ -f "$SSH_ENV" ]; then - . "$SSH_ENV" >/dev/null - ps -ef | grep $SSH_AGENT_PID | grep ssh-agent$ >/dev/null || { - start_agent - } -else - start_agent -fi -# /SSH \ No newline at end of file +PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' \ No newline at end of file diff --git a/.systems.example b/.systems.example index 0d7b5d9..770e2b3 100644 --- a/.systems.example +++ b/.systems.example @@ -1,7 +1,7 @@ # Systems configuration # configure the systems for the dev-env with the following pattern: # -# = +# # # LIKE CRON - THE FILE HAS TO END WITH AN EMPTY LINE # diff --git a/bin/ssh b/bin/ssh new file mode 100644 index 0000000..b04422a --- /dev/null +++ b/bin/ssh @@ -0,0 +1,22 @@ +#!/bin/bash + +SSH_ENV="$HOME/.ssh/agent-environment" +function dssh { + echo "Initialising new SSH agent..." + /usr/bin/ssh-agent | sed 's/^echo/#echo/' >"$SSH_ENV" + echo succeeded + chmod 600 "$SSH_ENV" + . "$SSH_ENV" >/dev/null + /usr/bin/ssh-add; + + ssh-add ~/.ssh/gitea_ssh +} + +if [ -f "$SSH_ENV" ]; then + . "$SSH_ENV" >/dev/null + ps -ef | grep $SSH_AGENT_PID | grep ssh-agent$ >/dev/null || { + dssh + } +else + dssh +fi \ No newline at end of file