moved gpg-agent into config
This commit is contained in:
parent
878e1f5fcb
commit
3574300184
@ -23,18 +23,3 @@ function __func_help() {
|
||||
# echo "Usage:" ${FUNCNAME[1]} $1
|
||||
echo " ${FUNCNAME[1]} $1"
|
||||
}
|
||||
|
||||
# Run through all sources
|
||||
SDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/sources
|
||||
|
||||
if [ -d "$SDIR" ]; then
|
||||
echo "Begin source:"
|
||||
for i in $( find $SDIR -maxdepth 1 -type f -perm $PERM | sort )
|
||||
do
|
||||
echo " Source:" $( basename $i )
|
||||
. $i
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo " .. failed"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -7,6 +7,7 @@ esac
|
||||
__SCRIPT=$BASH_SOURCE
|
||||
RBASH_HOME="$HOME/.rbash"
|
||||
RBASH_SOURCES="$RBASH_HOME/sources"
|
||||
RBASH_CONFIG="$RBASH_HOME/config"
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
@ -72,26 +73,6 @@ if ! shopt -oq posix; then
|
||||
fi
|
||||
fi
|
||||
|
||||
which gpg-agent 2>&1 > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
GPG_ENV="$HOME/.gnupg/environment"
|
||||
|
||||
function __start_agent {
|
||||
gpg-agent --daemon > "${GPG_ENV}"
|
||||
chmod 600 "${GPG_ENV}"
|
||||
. "${GPG_ENV}" > /dev/null
|
||||
}
|
||||
|
||||
if [ -f "${GPG_ENV}" ]; then
|
||||
. "${GPG_ENV}" > /dev/null
|
||||
|
||||
gpg-agent > /dev/null 2>&1
|
||||
[ "$?" -ne 0 ] && { __start_agent; }
|
||||
else
|
||||
__start_agent;
|
||||
fi
|
||||
fi
|
||||
|
||||
function __download {
|
||||
which curl 2>&1 > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
@ -167,30 +148,30 @@ function rbash_run {
|
||||
"$f" "$@"
|
||||
}
|
||||
|
||||
export PS1='This is <MACHINE_NAME>\e[1;3<COLOR_CODE>m<MACHINE_COLORED_NAME>\e[0m: \w\n\$ '
|
||||
export EDITOR=vim
|
||||
|
||||
# User specific aliases and functions
|
||||
function rbash_load {
|
||||
local f path
|
||||
echo " $1"
|
||||
path="sources/$1"
|
||||
f=`rbash_cache "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/$path"`
|
||||
f=`rbash_cache "https://git.k8s.astropenguin.net/penguin/utils/raw/branch/master/bash/bashrc/$1"`
|
||||
source "$f"
|
||||
}
|
||||
|
||||
export PS1='This is <MACHINE_NAME>\e[1;3<COLOR_CODE>m<MACHINE_COLORED_NAME>\e[0m: \w\n\$ '
|
||||
export EDITOR=vim
|
||||
|
||||
# Create default source config
|
||||
if [ ! -f "$RBASH_HOME/source.conf" ]; then
|
||||
cat <<___DEFAULT___ > "$RBASH_HOME/source.conf"
|
||||
if [ ! -f "$RBASH_CONFIG" ]; then
|
||||
cat <<___DEFAULT___ > "$RBASH_CONFIG"
|
||||
echo "Source:"
|
||||
rbash_load "package.sh" 1
|
||||
rbash_load "10_aliases"
|
||||
rbash_load "12_shortcuts"
|
||||
rbash_load "20_fast-greps"
|
||||
rbash_load "40_go-command"
|
||||
rbash_load "41_pivot-command"
|
||||
rbash_load "package.sh"
|
||||
rbash_load "sources/10_aliases"
|
||||
rbash_load "sources/12_shortcuts"
|
||||
rbash_load "sources/15_gpg-agent"
|
||||
rbash_load "sources/20_fast-greps"
|
||||
rbash_load "sources/40_go-command"
|
||||
rbash_load "sources/41_pivot-command"
|
||||
___DEFAULT___
|
||||
chmod 600 "$RBASH_HOME/source.conf"
|
||||
chmod 600 "$RBASH_CONFIG"
|
||||
fi
|
||||
|
||||
source "$RBASH_HOME/source.conf"
|
||||
source "$RBASH_CONFIG"
|
||||
|
21
bash/bashrc/sources/15_gpg-agent
Normal file
21
bash/bashrc/sources/15_gpg-agent
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
which gpg-agent 2>&1 > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
GPG_ENV="$HOME/.gnupg/environment"
|
||||
|
||||
function __start_agent {
|
||||
gpg-agent --daemon > "${GPG_ENV}"
|
||||
chmod 600 "${GPG_ENV}"
|
||||
. "${GPG_ENV}" > /dev/null
|
||||
}
|
||||
|
||||
if [ -f "${GPG_ENV}" ]; then
|
||||
. "${GPG_ENV}" > /dev/null
|
||||
|
||||
gpg-agent > /dev/null 2>&1
|
||||
[ "$?" -ne 0 ] && { __start_agent; }
|
||||
else
|
||||
__start_agent;
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user