summaryrefslogtreecommitdiffstats
path: root/db-functions
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-02-04 15:05:02 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-05-27 15:46:04 +0200
commit6f06ac7995cbb55a8574cd41b5236c2f5ec43e57 (patch)
treee8f0b727feda17c70c1fa31afcbdbdfe60b06459 /db-functions
parentba0094839da328a6820ced5fe07e32c9630b6b23 (diff)
downloaddbscripts-6f06ac7995cbb55a8574cd41b5236c2f5ec43e57.tar.gz
dbscripts-6f06ac7995cbb55a8574cd41b5236c2f5ec43e57.tar.xz
add sudo support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'db-functions')
-rw-r--r--db-functions6
1 files changed, 6 insertions, 0 deletions
diff --git a/db-functions b/db-functions
index 47d23ef..fd8fd96 100644
--- a/db-functions
+++ b/db-functions
@@ -24,6 +24,12 @@ mv_acl() {
rm -f "$1"
}
+if [[ $USER != $DBSCRIPTS_USER ]]; then
+ exec sudo -H -u $DBSCRIPTS_USER "$0" "$@"
+else
+ cd "$TMPDIR"
+fi
+
# set up general environment
WORKDIR=$(mktemp -d "${TMPDIR}/${0##*/}.XXXXXXXXXX")
LOCKS=()