git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/.bash/vars.bash
diff options
context:
space:
mode:
Diffstat (limited to '.bash/vars.bash')
-rw-r--r--.bash/vars.bash37
1 files changed, 28 insertions, 9 deletions
diff --git a/.bash/vars.bash b/.bash/vars.bash
index cb124be..3bc68cd 100644
--- a/.bash/vars.bash
+++ b/.bash/vars.bash
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# vim:syntax=sh
+# shellcheck disable=SC2034,SC1091
# default Byobu session name
export BSNAME="CHANGEME"
@@ -9,8 +10,6 @@ export SCRSHDIR="${HOME}/Pictures"
export SSHHOME="${HOME}/.ssh"
# 1. key files, array:
SSHKEYS=( "${SSHHOME}/id_ed25519" "${SSHHOME}/id_rsa" )
-# 2. SSH environment file
-export SSHENVFILE="${HOME}/.ssh/sshenv"
# 3. Hosts on which ssh-agent should run, FQDN. Array.
# Typically, "hosts" will equal your workstations. See ssh_config(5) (esp. ForwardAgent)
# Interpreted by fgrep / grep -F.
@@ -19,18 +18,28 @@ SSHAGH+=( "woschd.example.com" )
export SSHAGH
# ----- SHELL ----- #
-for pa in "/usr/local/bin" "${HOME}/bin";do
- if ! printf "%b" "$PATH"|grep -P "^${pa}:|:${pa}:" >/dev/null;then
- export PATH="${pa}:${PATH}"
+for pa in "/usr/local/bin" "${HOME}/bin" "${HOME}/.local/bin" "${HOME}/go/bin";do
+ if [ -x "$pa" ]; then
+ if ! printf "%b" "$PATH"|grep -E "^${pa}:|:${pa}:" >/dev/null;then
+ export PATH="${pa}:${PATH}"
+ fi
fi
done
# $OSNAME
if [ -r "/etc/os-release" ];then
- OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1)"
+ OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')"
+ if grep '^DEBIAN_VERSION_FULL' /etc/os-release >/dev/null 2>&1; then
+ OSVER="$(grep '^DEBIAN_VERSION_FULL' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')"
+ elif grep '^BUILD_ID' /etc/os-release >/dev/null 2>&1; then
+ OSVER="$(grep '^BUILD_ID' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')"
+ else
+ OSVER="$(grep '^VERSION_ID' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')"
+ fi
+elif [ "$(uname -s)" == 'SunOS' ]; then OSNAME="sunos"
elif [ -r "/etc/redhat-release" ];then
- grep -P "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat"
- grep -P "^[Ff]edora" /etc/redhat-release >/dev/null 2>&1 && OSNAME="fedora"
- grep -P "^[Cc]ent[Oo][Ss]" /etc/redhat-release >/dev/null 2>&1 && OSNAME="centos"
+ grep -E "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat"
+ grep -E "^[Ff]edora" /etc/redhat-release >/dev/null 2>&1 && OSNAME="fedora"
+ grep -E "^[Cc]ent[Oo][Ss]" /etc/redhat-release >/dev/null 2>&1 && OSNAME="centos"
[ -z "$OSNAME" ]&&OSNAME="obsolete"
elif [ -r "/etc/SuSE-release" ];then
OSNAME="oldsuse"
@@ -81,3 +90,13 @@ export LIBVIRT_DEFAULT_URI="qemu:///system"
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
+
+if [ -r "vars.bash.local" ];then
+ source vars.bash.local
+fi
+# SSH environment file
+#!/usr/bin/env bash
+# vim:syntax=sh
+#if echo "${SSHAGH[@]}" | grep -F --word-regexp "$(hostname -f)" > /dev/null;then
+ export SSHENVFILE="${HOME}/.ssh/sshenv"
+#fi