aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-07-28 17:13:30 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-07-28 17:13:30 +0200
commit67896a891bec5064fc603792cf161e5e38dbac05 (patch)
tree1880f53a3b44d1f7db986ca9bbd5e668024b0faa /bash
parentc9ebf2cfc68adee13fcd720c534119e431062ced (diff)
downloaddotfiles-67896a891bec5064fc603792cf161e5e38dbac05.tar.gz
Add config options for ssh agent and bashboard
Diffstat (limited to 'bash')
-rw-r--r--bash/board.bash13
-rw-r--r--bash/ssh-agent.bash30
-rw-r--r--bash/ssh-agent.profile8
3 files changed, 44 insertions, 7 deletions
diff --git a/bash/board.bash b/bash/board.bash
index dfee05f..4df9f2a 100644
--- a/bash/board.bash
+++ b/bash/board.bash
@@ -1,14 +1,15 @@
#!/bin/bash
-BB_HIST_DIR="$HOME/.cache/bashboard/"
-BB_SHORTCUT=()
-BB_LIST_LEN=5
-BB_PRUNE_DAYS=5
+# config in ~/.files.config
+
+if [ "$BB_ENABLE"="yes" ]; then
+ return
+fi
[ ! -d "$BB_HIST_DIR" ] && mkdir -p "$BB_HIST_DIR"
-BB_COLOR_HIGHLIGHT="\e[0;34m"
-BB_COLOR_RESET="\e[39m"
+# Public var, not config
+BB_SHORTCUT=()
# format
# NUM EPOCH PATH
diff --git a/bash/ssh-agent.bash b/bash/ssh-agent.bash
new file mode 100644
index 0000000..2f3040b
--- /dev/null
+++ b/bash/ssh-agent.bash
@@ -0,0 +1,30 @@
+# vi: ft=sh
+
+#SA_SSH_AGENT_STATIC='no'
+#SA_SSH_SOCKET="/var/run/user/$UID/ssh-agent.sock"
+#SA_SSH_PIDFILE="/var/run/user/$UID/ssh-agent.pid"
+
+# For use with graphical logins when DEs don't provide an agent
+# Flatpak versions of KeePassXC don't allow file access to /var/run. Allow with:
+# $ flatpak override org.keepassxc.KeePassXC --user --filesystem=/run/user/$UID/ssh-agent.sock
+# Caution: /var/run symlinks to /run. Flatpak for some reason does not resolve symlinks.
+
+if [ "$SA_SSH_AGENT_STATIC"="yes" ]; then
+ AGENT_PID=''
+ if [ -e "$SA_SSH_PIDFILE" ]; then
+ AGENT_PID=$(cat $SA_SSH_PIDFILE)
+ fi
+
+ if [ -z "$AGENT_PID" ] || ! kill -s 0 $AGENT_PID > /dev/null 2>&1; then
+ echo "Agent not running. creating one."
+ eval $(ssh-agent -s -a $SA_SSH_SOCKET)
+
+ echo "PID: $SSH_AGENT_PID"
+ echo "$SSH_AGENT_PID" > "$SA_SSH_PIDFILE"
+ else
+ echo "Using existing Agent"
+ export SSH_AUTH_SOCK="$SA_SSH_SOCKET"
+ fi
+fi
+
+unset AGENT_PID
diff --git a/bash/ssh-agent.profile b/bash/ssh-agent.profile
index 9912bbf..efa3724 100644
--- a/bash/ssh-agent.profile
+++ b/bash/ssh-agent.profile
@@ -1,3 +1,9 @@
# vi: ft=sh
-[ -z $SSH_AUTH_SOCK ] && eval `ssh-agent`
+#SA_SSH_AGENT_STATIC='no'
+#SA_SSH_SOCKET="/var/run/user/$UID/ssh-agent.sock"
+#SA_SSH_PIDFILE="/var/run/user/$UID/ssh-agent.pid"
+
+if [ ! "$SA_SSH_AGENT_STATIC"="yes" ]; then
+ [ -z $SSH_AUTH_SOCK ] && eval `ssh-agent`
+fi