77              def become_root():
78                  """Become root and run this script as root. Tested on 
Ubuntu 8.04 Live
79                  and Kubuntu 7.10 Live
80                  """
81                  if os.getuid() != 0:
82                      try:
83                          os.execl("/usr/bin/gksu", "gksu", 
os.path.abspath(sys.argv[0]))
84                      except:
85                          pass
86                      try:
87                          os.execl("/usr/bin/kdesu", "-u", "root", "-c",
88                                   os.path.abspath(sys.argv[0]))
89                      except: 
90                          pass
91                      if os.getuid() != 0:
92                          error("Could not become root")
93                          exit(1) 

Source:
http://bazaar.launchpad.net/~probono/liveusb/main/annotate/11?file_id=liveusb.py-20080521140641-6qy8a3a46kl4k01c-53

-- 
needs a .desktop file
https://bugs.launchpad.net/bugs/267788
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to