File: root-status

package info (click to toggle)
bup 0.33.9-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,712 kB
  • sloc: python: 15,897; sh: 5,764; ansic: 2,965; pascal: 669; makefile: 21
file content (26 lines) | stat: -rwxr-xr-x 563 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
"""": # -*-python-*-
python="$(dirname "$0")/python" || exit $?
exec "$python" "$0" ${1+"$@"}
"""

import os, sys

if sys.platform.startswith('cygwin'):
    # see helpers.getgroups()
    egid = os.getegid()
    groups = os.getgroups()
    if egid not in groups:
        groups.append(egid)
    if 544 in groups or 0 in groups:
        print('root')
    else:
        print('none')
else:
    if os.environ.get('FAKEROOTKEY'):
        print('fake')
    else:
        if os.geteuid() == 0:
            print('root')
        else:
            print('none')