git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authormail_redacted_for_web 2022-03-19 19:27:36 +0100
committermail_redacted_for_web 2022-03-19 19:27:36 +0100
commit53b55b4b10ef6344a882402d5dcaf11d87b78d3f (patch)
treea4c8f2248fe0ef17d2c7cd98a62adfc5f0a2a7ca /bin
downloaddotfiles-53b55b4b10ef6344a882402d5dcaf11d87b78d3f.tar.bz2
Initial commit
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ssh-agent-launcher48
-rwxr-xr-xbin/sxs35
2 files changed, 83 insertions, 0 deletions
diff --git a/bin/ssh-agent-launcher b/bin/ssh-agent-launcher
new file mode 100755
index 0000000..0d116dc
--- /dev/null
+++ b/bin/ssh-agent-launcher
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+if [ -z "$SSHENVFILE" ];then
+ printf "SSHENVFILE not set, no target for SSH environment variables.\\n" >&2
+ exit 1
+fi
+
+VERB=1
+KILLIT=0
+while getopts ":qf" SHOPT;do
+ case "$SHOPT" in
+ q) VERB=0;;
+ f) KILLIT=1;;
+ *) printf "WAT\n" >&2;exit 127;;
+ esac
+done
+shift "$(( OPTIND -1 ))"
+
+[ "$VERB" -eq 1 ]&&printf "[....] Starting SSH agent.\\033[s"
+ROEDGROED="$(pgrep -U "$(whoami)" ssh-agent|grep -v grep|awk '{print $1}')"
+
+if [ -n "$ROEDGROED" ];then
+ if [ "$KILLIT" -eq 1 ];then
+ for i in $(echo "$ROEDGROED");do kill "$i" >/dev/null 2>&1||break;done
+ case "$?" in
+ 0);;
+ *)
+ [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n"
+ exit 2
+ ;;
+ esac
+ else
+ [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[30;1mSKIP\\033[0m]\\033[u\\033[K (running, PID: %s)\\n" "$ROEDGROED"
+ exit 0
+ fi
+fi
+ssh-agent >"$SSHENVFILE" 2>&1&&chmod 0600 "$SSHENVFILE" >/dev/null 2>&1
+case "$?" in
+ 0)
+ sed -i 's/^echo[^\;]*\;//g' "$SSHENVFILE" >/dev/null 2>&1
+ [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[32m OK \\033[0m]\\033[u\\033[K\\n"
+ exit 0
+ ;;
+ *)
+ [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n"
+ exit 1
+ ;;
+esac
diff --git a/bin/sxs b/bin/sxs
new file mode 100755
index 0000000..7e544ef
--- /dev/null
+++ b/bin/sxs
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+pidof -s xinit && exit 0
+
+[ -z "$STXTARG" ] && STXTARG="$1"
+
+if [ -z "$STXTARG" ];then
+ read -p "Start: e16, xmonad, gnome or kde? " STXTARG
+ [ -z "$STXTARG" ] && STXTARG="xmonad"
+fi
+
+case "$STXTARG" in
+ e16)
+ diff ~/.xsession-e16 ~/.xsession &> /dev/null
+ [ "$?" -ne 0 ] && ln -sf .xsession-e16 ~/.xsession
+ ;;
+ xmonad)
+ diff ~/.xsession-xmonad ~/.xsession &> /dev/null
+ [ "$?" -ne 0 ] && ln -sf .xsession-xmonad ~/.xsession
+ ;;
+ gnome)
+ diff ~/.xsession-gnome ~/.xsession &> /dev/null
+ [ "$?" -ne 0 ] && ln -sf .xsession-gnome ~/.xsession
+ ;;
+ kde)
+ diff ~/.xsession-kde ~/.xsession &> /dev/null
+ [ "$?" -ne 0 ] && ln -sf .xsession-kde ~/.xsession
+ ;;
+ *)
+ echo "Sorry, I don't know $STXTARG as window manager."
+ exit 1
+ ;;
+esac
+
+startx