]> arthur.barton.de Git - bup.git/blobdiff - t/root-status
is_superuser: test for group 544 or 0 on cygwin
[bup.git] / t / root-status
index 0c43e9d38b88f21e094b4c25f0cd700ece48758a..69fad4e37fa1943058a852f0bb06dcf78c19d03e 100755 (executable)
@@ -5,19 +5,13 @@ exec "$bup_python" "$0" ${1+"$@"}
 """
 # end of bup preamble
 
-from __future__ import print_function
+from __future__ import absolute_import, print_function
 from sys import stderr
 import sys
 
-
 if sys.platform.startswith('cygwin'):
-    if sys.getwindowsversion()[0] > 5:
-        # Sounds like the situation is much more complicated here
-        print("can't detect root status for OS version > 5; assuming not root",
-              file=stderr)
-        print('none')
-    import ctypes
-    if ctypes.cdll.shell32.IsUserAnAdmin():
+    groups = os.getgroups()
+    if 544 in groups or 0 in groups:
         print('root')
     else:
         print('none')