diff options
author | Andreas Loibl <andreas@andreas-loibl.de> | 2011-03-17 16:49:48 +0100 |
---|---|---|
committer | Andreas Loibl <andreas@andreas-loibl.de> | 2011-03-17 16:49:48 +0100 |
commit | a3f3aba32248f703735ee83612d17da128f38185 (patch) | |
tree | 4e6e41a47dfcf0b5175ca02a6b245c28f1a33d4d /backend | |
parent | 7a49b899d24648dc69fa392e3604d7ee88c1560c (diff) | |
download | acritoxinstaller-a3f3aba32248f703735ee83612d17da128f38185.zip acritoxinstaller-a3f3aba32248f703735ee83612d17da128f38185.tar.gz |
min window size, "sudo gparted" fix
Diffstat (limited to 'backend')
-rwxr-xr-x | backend/backend.sh.in | 44 | ||||
-rw-r--r-- | backend/modules/partmgr | 2 |
2 files changed, 29 insertions, 17 deletions
diff --git a/backend/backend.sh.in b/backend/backend.sh.in index 4c0c161..e461387 100755 --- a/backend/backend.sh.in +++ b/backend/backend.sh.in @@ -36,28 +36,36 @@ function set_debug() esac } -if ((UID)); then - p="$PWD/$(basename "$0")" - if [ -x /usr/bin/sudo ]; then - if /usr/bin/sudo -n -l "$p" &>/dev/null; then - /usr/bin/sudo "$p" "$@" +# Synopsis: get_root ["X"] +# +# This function makes sure the user has root-privileges. +# Argument X means it won't use "sudo" to gain root-privileges, because sudo doesn't support X-applications +function get_root() +{ + if ((UID)); then + p="$PWD/$(basename "$0")" + if [ -x /usr/bin/sudo -a "$1" != "X" ]; then + if /usr/bin/sudo -n -l "$p" &>/dev/null; then + /usr/bin/sudo "$p" "${O_ARGS[@]}" + exit $? + fi + fi + if [ -x /usr/lib/kde4/libexec/kdesu ]; then + /usr/lib/kde4/libexec/kdesu --noignorebutton -d -- "$p" --pid $$ "${O_ARGS[@]}" &>/dev/null exit $? fi - fi - if [ -x /usr/lib/kde4/libexec/kdesu ]; then - /usr/lib/kde4/libexec/kdesu --noignorebutton -d -- "$p" --pid $$ "$@" &>/dev/null + if [ -z "$as_root" ]; then + for as_root in /usr/bin/kdesu /usr/bin/gksu exec + do + [ -x $as_root ] && break + done + fi + $as_root "$p" --pid $$ "${O_ARGS[@]}" &>/dev/null exit $? fi - if [ -z "$as_root" ]; then - for as_root in /usr/bin/kdesu /usr/bin/gksu exec - do - [ -x $as_root ] && break - done - fi - $as_root "$p" --pid $$ "$@" &>/dev/null - exit $? -fi +} +O_ARGS=( "${@}" ) while [ "$1" ] do case $1 in @@ -80,6 +88,8 @@ do shift done +get_root + EOT="$(echo -e '\004')" while true do diff --git a/backend/modules/partmgr b/backend/modules/partmgr index c773e8d..618406b 100644 --- a/backend/modules/partmgr +++ b/backend/modules/partmgr @@ -4,9 +4,11 @@ function run_partmgr() { case "$1" in cfdisk|fdisk) + get_root TERM=xterm /sbin/"$1" "$2" ;; gparted|qtparted) + get_root X "$1" "$2" ;; esac |