summarylogtreecommitdiffstats
path: root/gmabooster.sh
diff options
context:
space:
mode:
authorStorm dragon2016-01-20 07:20:30 -0500
committerStorm dragon2016-01-20 07:20:30 -0500
commitf216597da2be12ec7c4196747e9c9de61e749a4b (patch)
treedf306bebdb095f813eb52ad3df8c46cfc41c63ab /gmabooster.sh
downloadaur-f216597da2be12ec7c4196747e9c9de61e749a4b.tar.gz
Initial commit, moved from AUR 3
Diffstat (limited to 'gmabooster.sh')
-rw-r--r--gmabooster.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/gmabooster.sh b/gmabooster.sh
new file mode 100644
index 000000000000..1b0d8568df94
--- /dev/null
+++ b/gmabooster.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Contributor: Chris Down <cdown.uk@gmail.com>
+
+# Wrapper for gmabooster to prompt that it should be run as root
+
+# We don't want to simply block root or check for the existence of su/sudo,
+# as the user might be running in a fakeroot environment, etc...
+# (and even if we aren't root, let's assume the user knows what they're doing)
+
+if [[ "${EUID}" -eq 0 ]]; then
+ /opt/GMABooster/GMABooster "$@"
+ # Store it in a variable so we can exit with the same return code
+ gbexit="$?"
+else
+ echo "GMABooster should be run as root to function properly."
+
+ while true; do
+ read -p "Do you wish to continue anyway? (y/n): " DOCONT
+ case "${DOCONT}" in
+ y|Y)
+ /opt/GMABooster/GMABooster "$@"
+ exit "$?"
+ ;;
+ n|N) exit "126" ;;
+ *) echo "Please enter y or n." ;;
+ esac
+ done
+fi
+
+# Exit with the same return code as gmabooster
+# (We shouldn't ever get down to here... but just in case)
+exit "${gbexit-127}"