aboutsummaryrefslogtreecommitdiff
path: root/lib/hydra/misc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hydra/misc')
-rw-r--r--lib/hydra/misc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/hydra/misc b/lib/hydra/misc
index 4275021..2c44503 100644
--- a/lib/hydra/misc
+++ b/lib/hydra/misc
@@ -6,6 +6,10 @@ function hydra_set_env {
export CONFIG="$HOME/.hydra/config"
export ACTION="$1"
+ if [ "`whoami`" != 'root' ]; then
+ SUDO="sudo"
+ fi
+
if [ ! -z "$HYDRA" ]; then
export HYDRA_FOLDER="`hydra_eval_parameter $HYDRA`"
export PREFERENCES="$HOME/.hydra/$HYDRA"
@@ -108,6 +112,12 @@ function hydra_safe_run {
hydra_exit_on_error $*
}
+# Run a command using sudo and abort on error
+function hydra_sudo_run {
+ $SUDO $*
+ hydra_exit_on_error $*
+}
+
# Determine the next debian release
function hydra_next_debian_release {
local release="$1"