]> arthur.barton.de Git - bup.git/blobdiff - t/root-status
configure.inc: name the tmpdir with a configure- prefix
[bup.git] / t / root-status
index 9fb12cb2c4411a2d87e5c7d823061c231a5cb233..7127f8c1277172a81d358c2244286dea7c36ecd5 100755 (executable)
@@ -1,19 +1,24 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
 
-import sys
+from __future__ import absolute_import, print_function
+import os, sys
 
 if sys.platform.startswith('cygwin'):
-    import ctypes
-    if ctypes.cdll.shell32.IsUserAnAdmin():
-        print 'root'
+    groups = os.getgroups()
+    if 544 in groups or 0 in groups:
+        print('root')
     else:
-        print 'none'
+        print('none')
 else:
-    import os
     if os.environ.get('FAKEROOTKEY'):
-        print 'fake'
+        print('fake')
     else:
         if os.geteuid() == 0:
-            print 'root'
+            print('root')
         else:
-            print 'none'
+            print('none')