improve sudo for sshs
This commit is contained in:
parent
3384f79c62
commit
febd54d354
1 changed files with 21 additions and 10 deletions
31
functions.sh
31
functions.sh
|
@ -50,24 +50,35 @@ function cpb() {
|
||||||
function sudo() {
|
function sudo() {
|
||||||
local SUDO
|
local SUDO
|
||||||
local BASH
|
local BASH
|
||||||
|
local C
|
||||||
|
|
||||||
|
|
||||||
# SUDO=$( if [ -e /bin/sudo ]; then echo /bin/sudo; else echo /usr/bin/sudo; fi )
|
# SUDO=$( if [ -e /bin/sudo ]; then echo /bin/sudo; else echo /usr/bin/sudo; fi )
|
||||||
SUDO=$(which sudo)
|
SUDO=$(which sudo)
|
||||||
|
|
||||||
[ getbashrcfile ] && BASH="bash --rcfile $(getbashrcfile) -c " || unset BASH
|
|
||||||
|
|
||||||
if $SSHS ; then
|
if $SSHS ; then
|
||||||
logwarning "TEMPCONFIG"
|
logdebug "TEMPCONFIG"
|
||||||
|
logdebug "\$1: $1"
|
||||||
|
[ -e "$(which $1 2>/dev/null)" ] && C="x"
|
||||||
|
logdebug "C: $C"
|
||||||
|
[ getbashrcfile ] && BASH="bash --rcfile $(getbashrcfile) ${C:+-c}" || unset BASH
|
||||||
|
logdebug "BASH1: $BASH"
|
||||||
|
[ -z "${C:-x}" ] && unset BASH
|
||||||
|
logdebug "BASH2: $BASH"
|
||||||
else
|
else
|
||||||
logwarning "NO Tempconfig"
|
logdebug "NO Tempconfig"
|
||||||
|
unset BASH
|
||||||
fi
|
fi
|
||||||
|
logdebug "SUDO: $SUDO"
|
||||||
|
logdebug "BASH3: $BASH"
|
||||||
|
logdebug "SHLVL: $SHLVL"
|
||||||
|
logdebug "@: $@"
|
||||||
|
[ -z "${C:-x}" ] && logwarn "run $1 -> $(which $1)"
|
||||||
|
|
||||||
logwarning "SUDO: $SUDO"
|
|
||||||
logwarning "BASH: $BASH"
|
|
||||||
logwarning "SHLVL: $SHLVL"
|
|
||||||
|
|
||||||
logwarning $SUDO \
|
logdebug $SUDO \
|
||||||
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
|
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
|
||||||
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
|
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
|
||||||
GIT_COMMITTER_EMAIL="$GIT_COMMITTER_EMAIL" \
|
GIT_COMMITTER_EMAIL="$GIT_COMMITTER_EMAIL" \
|
||||||
|
@ -79,7 +90,7 @@ function sudo() {
|
||||||
SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
|
SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
|
||||||
http_proxy="$http_proxy" \
|
http_proxy="$http_proxy" \
|
||||||
$BASH \
|
$BASH \
|
||||||
"$@"
|
$@
|
||||||
$SUDO \
|
$SUDO \
|
||||||
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
|
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
|
||||||
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
|
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
|
||||||
|
@ -92,8 +103,8 @@ function sudo() {
|
||||||
SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
|
SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \
|
||||||
http_proxy="$http_proxy" \
|
http_proxy="$http_proxy" \
|
||||||
$BASH \
|
$BASH \
|
||||||
"$@"
|
$@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_symlinks() {
|
create_symlinks() {
|
||||||
|
|
Loading…
Reference in a new issue