summaryrefslogtreecommitdiff
path: root/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'functions.sh')
-rw-r--r--functions.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/functions.sh b/functions.sh
index 3c05320..1ee9590 100644
--- a/functions.sh
+++ b/functions.sh
@@ -48,3 +48,13 @@ umount_iso() {
getuuid() {
lsblk -n -o UUID "$1"
}
+
+as-root() {
+ if [ "$UID" == 0 ]; then
+ "$@"
+ elif type -p sudo > /dev/null; then
+ sudo "$@"
+ elif type -p su > /dev/null; then
+ su -c "$*"
+ fi
+}