]> arthur.barton.de Git - bup.git/blob - t/root-status
is_superuser: test for group 544 or 0 on cygwin
[bup.git] / t / root-status
1 #!/bin/sh
2 """": # -*-python-*-
3 bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
5 """
6 # end of bup preamble
7
8 from sys import stderr
9 import sys
10
11 if sys.platform.startswith('cygwin'):
12     groups = os.getgroups()
13     if 544 in groups or 0 in groups:
14         print 'root'
15     else:
16         print 'none'
17 else:
18     import os
19     if os.environ.get('FAKEROOTKEY'):
20         print 'fake'
21     else:
22         if os.geteuid() == 0:
23             print 'root'
24         else:
25             print 'none'