Branch 'develop' - liveusb-creator

Luke Macken lmacken at fedoraproject.org
Tue Jun 9 22:08:11 UTC 2015


 liveusb-creator |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit dd5562598ead37c8f840e78c642c34fc98085ee9
Author: Andrej Manduch <amanduch at redhat.com>
Date:   Tue Jun 9 18:07:46 2015 -0400

    Previously when user wanted to print out --help message user was forced
    to do it under root account which is a quite inpractical.
    
    By moveing `getuid() != 0` check after parse_args it will be
    asured that this is no longer the case
    
    Before this patch:
    burlak at borg /m/c/liveusb-creator (develop) $ liveusb-creator --help
    You must run this application as root
    
    After this patch:
    burlak at borg /m/c/liveusb-creator (develop) $ ./liveusb-creator --help
    Usage: liveusb-creator [options]
    
    Options:
      --version             show program's version number and exit
      -h, --help            show this help message and exit
      -c, --console         Use console mode instead of the GUI
    
    Signed-off-by: Andrej Manduch <amanduch at redhat.com>
    Signed-off-by: Luke Macken <lmacken at redhat.com>

diff --git a/liveusb-creator b/liveusb-creator
index 2fcc667..e4d5965 100755
--- a/liveusb-creator
+++ b/liveusb-creator
@@ -72,6 +72,11 @@ def parse_args():
 
 def main():
     opts, args = parse_args()
+    if sys.platform != 'win32':
+        if os.getuid() != 0:
+            print >> sys.stderr, _("You must run this application as root")
+            sys.exit(1)
+
     if opts.console:
         from liveusb import LiveUSBCreator
         try:
@@ -93,8 +98,4 @@ def main():
             pass
 
 if __name__ == '__main__':
-    if sys.platform != 'win32':
-        if os.getuid() != 0:
-            print >> sys.stderr, _("You must run this application as root")
-            sys.exit(1)
     main()




More information about the liveusb-creator mailing list