summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Hodgins <davidwhodgins@mageia.org>2013-10-07 19:27:54 -0400
committerDave Hodgins <davidwhodgins@mageia.org>2013-10-07 19:27:54 -0400
commit6bb30dc5a47157c2c5793e31e9f89fc2ede38f6b (patch)
tree3b9aa95d4092297c2d5483b20baad283981d4d83
parent728a9286a154352d84c1d063421408fbeb3c5cb6 (diff)
downloadcopyiso2usb-6bb30dc5a47157c2c5793e31e9f89fc2ede38f6b.tar
copyiso2usb-6bb30dc5a47157c2c5793e31e9f89fc2ede38f6b.tar.gz
copyiso2usb-6bb30dc5a47157c2c5793e31e9f89fc2ede38f6b.tar.bz2
copyiso2usb-6bb30dc5a47157c2c5793e31e9f89fc2ede38f6b.tar.xz
copyiso2usb-6bb30dc5a47157c2c5793e31e9f89fc2ede38f6b.zip
mv script from /sbin to bin, and run pkexec from it, instead of using seperate script
-rwxr-xr-xbin/copyiso2usb4
-rwxr-xr-xcopyiso2usb31
2 files changed, 15 insertions, 20 deletions
diff --git a/bin/copyiso2usb b/bin/copyiso2usb
deleted file mode 100755
index 6e89dee..0000000
--- a/bin/copyiso2usb
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-pkexec '/usr/sbin/copyiso2usb' "$@"
-
diff --git a/copyiso2usb b/copyiso2usb
index a0fa253..7ccb82c 100755
--- a/copyiso2usb
+++ b/copyiso2usb
@@ -1,6 +1,6 @@
#!/bin/bash
########################################################################################
-# /usr/sbin/copyiso2usb
+# /usr/bin/copyiso2usb
########################################################################################
# Usage: copyiso2usb [isofile]
# Installs needed packages if missing - dcfldd cdialog udisks mlocate
@@ -13,11 +13,8 @@
# Confirms that the command should be run
# Copies the iso image to the usb drive.
#
-# Note for maintainers 'xgettext -d copyiso2usb -L Shell /usr/sbin/copyiso2usb' used
+# Note for maintainers 'xgettext -d copyiso2usb -L Shell /usr/bin/copyiso2usb' used
# to create copyiso2usb.po (which was manually renamed to copyiso2usb.pot)
-#
-# If installing manually, also suggest installing Xdialog and runnning
-# 'ln -s /usr/bin/consolehelper /usr/sbin/copyiso2usb'
########################################################################################
# Author: David W. Hodgins - Mageia Qa team
# 2013-06-02 Initial writing
@@ -42,6 +39,19 @@ 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)
+ThisScript="$0"
+if [[ ! ${ThisScript:0:1} = '/' ]] ; then
+ ThisScript="$(pwd)/$0"
+fi
+
+# Exit if not root.
+if [[ "$(id -u)" != "0" ]] ; then
+ exec pkexec "$ThisScript" "$@"
+ MustBeRoot=$(eval_gettext "Must be root to run \$ThisScript")
+ ShowMsgExit "$MustBeRoot"
+ exit 0
+fi
+
#Check to see if running under pkexec, aka policykit and X
pktest=${PKEXEC_UID-"unset"}
if [ ! "unset" = "$pktest" ] ; then
@@ -60,11 +70,6 @@ if [ ! -e /usr/bin/Xdialog ] || [ ! -x /usr/bin/Xdialog ] || [ "unset" = "$disp
dialogcmd="/usr/bin/dialog"
fi
-ThisScript="$0"
-if [[ ! ${ThisScript:0:1} = '/' ]] ; then
- ThisScript="$(pwd)/$0"
-fi
-
# Function to get window size
GetDisplaySize() {
IFS=$':, '
@@ -165,12 +170,6 @@ setspaceunits () {
printf '%s' "$SpaceString"
}
-# Exit if not root.
-if [[ "$(id -u)" != "0" ]] ; then
- MustBeRoot=$(eval_gettext "Must be root to run \$ThisScript")
- ShowMsgExit "$MustBeRoot"
- exit 0
-fi
InstallPackageIfFileMissing /usr/bin/dcfldd dcfldd
InstallPackageIfFileMissing /usr/bin/dialog cdialog