From 728a9286a154352d84c1d063421408fbeb3c5cb6 Mon Sep 17 00:00:00 2001 From: Dave Hodgins Date: Mon, 7 Oct 2013 17:53:10 -0400 Subject: Switch to using pkexec instead of consolehelper --- bin/copyiso2usb | 4 ++++ copyiso2usb | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100755 bin/copyiso2usb diff --git a/bin/copyiso2usb b/bin/copyiso2usb new file mode 100755 index 0000000..6e89dee --- /dev/null +++ b/bin/copyiso2usb @@ -0,0 +1,4 @@ +#!/bin/bash + +pkexec '/usr/sbin/copyiso2usb' "$@" + diff --git a/copyiso2usb b/copyiso2usb index 19127bc..a0fa253 100755 --- a/copyiso2usb +++ b/copyiso2usb @@ -42,6 +42,17 @@ Waitmlocate=$(gettext "Running /etc/cron.daily/mlocate.cron. Please wait for 'rc WaitCopy=$(gettext "Copying iso to usb drive. Please wait for 'rc=0' before continuing.") FileNameTemp=$(mktemp -p /tmp "${0##*/}".XXXXXX) +#Check to see if running under pkexec, aka policykit and X +pktest=${PKEXEC_UID-"unset"} +if [ ! "unset" = "$pktest" ] ; then + mydisplay=$(strings "/proc/$PPID/environ"|grep ^DISPLAY=) + myxauthority=$(strings "/proc/$PPID/environ"|grep ^XAUTHORITY=) + if [ -n "$mydisplay" ] ; then + export DISPLAY=eval "$mydisplay" + export XAUTHORITY=eval "$myxauthority" + fi +fi + # Set dialog command to use dialogcmd="/usr/bin/Xdialog" displaytest=${DISPLAY-"unset"} -- cgit v1.2.1