summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-12-25 15:26:13 +0000
committerV3n3RiX <venerix@redcorelinux.org>2017-12-25 15:26:13 +0000
commit54ae6d9a70318babfb858fa1c71da16f2a31a271 (patch)
tree502691d60b029b92d1921c6c6bb885f9e5a19736
parenta0b7377a90b8612d362d8dd1f4be6e548a4dceac (diff)
sisyphus-gui : prevent instant crash if application is started as non-root user
-rwxr-xr-xsisyphus-gui25
1 files changed, 21 insertions, 4 deletions
diff --git a/sisyphus-gui b/sisyphus-gui
index 87254ec..0d46356 100755
--- a/sisyphus-gui
+++ b/sisyphus-gui
@@ -1,12 +1,29 @@
#!/usr/bin/env bash
-# Sisyphus is a simple GUI for sisyphus, the portage wrapper
+# Sisyphus-GUI is a simple frontend for libsisyphus
# Main Author : Ghiunhan Mamut @ Redcore Linux Project
+if [[ -f /lib/gentoo/functions.sh ]] ; then
+ source /lib/gentoo/functions.sh
+else
+ echo "Cannot import Gentoo functions, I will abort now!"
+ exit 1
+fi
+
+checkifroot() {
+ if [[ "$(whoami)" != root ]] ; then
+ eerror "I won't do that, unless you're root!"
+ exit 1
+ fi
+}
+
+
main() {
- pushd /usr/share/sisyphus
- python3 sisyphus-gui.py
- popd
+ if checkifroot; then
+ pushd /usr/share/sisyphus
+ python3 sisyphus-gui.py
+ popd
+ fi
}
main