[gparted] Move root privilege escalation into gparted wrapper script (#776437)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Move root privilege escalation into gparted wrapper script (#776437)
- Date: Fri, 1 Sep 2017 16:33:25 +0000 (UTC)
commit a2cc5014c652a7e15b5460fa58d9680d146c6be4
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Fri Jun 16 07:30:30 2017 +0100
Move root privilege escalation into gparted wrapper script (#776437)
Move calling of the privilege escalation program which allows a normal
user to run GParted as root from the desktop file into the gparted
wrapper script. This is in preparation for further changes needed to
grant root access to the X11 display under Wayland.
Don't introduce yet another script so that there aren't two different
names to run GParted by for normal users and root. Using the same
gparted name but placing two different scripts at /usr/bin/gparted and
/usr/sbin/gparted is not possible because on Arch Linux /usr/sbin is a
symbolic link to /usr/bin.
Frequently asked questions, Does Arch follow the FHS?
https://wiki.archlinux.org/index.php/Frequently_asked_questions#Does_Arch_follow_the_FHS.3F
"Arch Linux follows the file system hierarchy for operating systems
using the systemd service manager. See file-hierarchy(7) for an
explanation of each directory along with their designations. In
particular, /bin, /sbin, and /usr/sbin are symbolic links to
/usr/bin, and /lib (and /lib64 if applicable) are symbolic links to
/usr/lib".
Bug 776437 - GParted fails to run as root under Wayland
README | 20 +++++++++-----------
gparted.desktop.in.in | 2 +-
gparted.in | 42 ++++++++++++++++++++++++------------------
3 files changed, 34 insertions(+), 30 deletions(-)
---
diff --git a/README b/README
index ca4375d..87e28e0 100644
--- a/README
+++ b/README
@@ -270,20 +270,18 @@ system. These commands include:
{filemanager} - used in attempt data rescue to display discovered
file systems. (e.g., nautilus, pcmanfm)
hal-lock - used to prevent automounting of file systems
- gksudo - used to acquire root privileges in .desktop file,
- but only if available when gparted source is
- configured.
+ gksudo - used to acquire root privileges in gparted shell
+ script wrapper, but only if available when gparted
+ source is configured
gksu - alternatively used to acquire root privileges in
- .desktop file if gksu not available, but only if
- available when gparted source is configured.
+ gparted shell script wrapper, second choice if
+ available when gparted source is configured
kdesudo - alternatively used to acquire root privileges in
- .desktop file if gksudo and gksu not available, but
- only if available when gparted source is
- configured.
+ gparted shell script wrapper, third choice if
+ available when gparted source is configured
xdg-su - alternatively used to acquire root privileges in
- .desktop file if gksudo, gksu, and kdesudo are not
- available, but only if available when gparted
- source is configured.
+ gparted shell script wrapper, last choice if
+ available when gparted source is configured
udevinfo - used in dmraid to query udev name
udevadm - used in dmraid to query udev name
yelp - used to display help manual
diff --git a/gparted.desktop.in.in b/gparted.desktop.in.in
index 4b41fe4..394eda6 100644
--- a/gparted.desktop.in.in
+++ b/gparted.desktop.in.in
@@ -3,7 +3,7 @@ _Name=GParted
_GenericName=Partition Editor
_X-GNOME-FullName=GParted Partition Editor
_Comment=Create, reorganize, and delete partitions
-Exec=@gksuprog@ @installdir@/gparted %f
+Exec=@installdir@/gparted %f
Icon=gparted
Terminal=false
Type=Application
diff --git a/gparted.in b/gparted.in
index c435bac..68902cb 100755
--- a/gparted.in
+++ b/gparted.in
@@ -37,6 +37,30 @@ if test "z`ps -e | grep gpartedbin`" != "z"; then
fi
#
+# Define base command for executing GParted
+#
+BASE_CMD="@installdir@/gpartedbin $*"
+
+#
+# For non-root users try to get authorisation to run GParted as root.
+#
+if test "x`id -u`" != "x0"; then
+ #
+ # If there is no configured SU program run gpartedbin as
+ # non-root to display the graphical error about needing root
+ # privileges.
+ #
+ if test "x@gksuprog@" = "x"; then
+ echo "Root privileges are required for running gparted."
+ $BASE_CMD
+ exit 1
+ fi
+
+ @gksuprog@ '@installdir@/gparted' "$@"
+ exit $?
+fi
+
+#
# Search PATH to determine if systemctl program can be found
# and if appropriate daemon is running.
#
@@ -105,24 +129,6 @@ for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
done
#
-# Define base command for executing GParted
-#
-BASE_CMD="@installdir@/gpartedbin $*"
-
-#
-# If no root privileges, then invoke gpartedbin directly
-# so that a graphical warning is displayed.
-# Otherwise udisks, devkit-disks, or hal-lock in the later
-# invocation may prevent gpartedbin from starting and hence
-# the user will not see a graphical warning.
-#
-if test "x`id -u`" != "x0"; then
- echo "Root privileges are required for running gparted."
- $BASE_CMD
- exit 1
-fi
-
-#
# Use systemctl to prevent automount by masking currently unmasked mount points
#
if test "x$HAVE_SYSTEMCTL" = "xyes"; then
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]