]> 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 __future__ import absolute_import, print_function
9 from sys import stderr
10 import sys
11
12 if sys.platform.startswith('cygwin'):
13     groups = os.getgroups()
14     if 544 in groups or 0 in groups:
15         print('root')
16     else:
17         print('none')
18 else:
19     import os
20     if os.environ.get('FAKEROOTKEY'):
21         print('fake')
22     else:
23         if os.geteuid() == 0:
24             print('root')
25         else:
26             print('none')