root user check

This commit is contained in:
brent s. 2017-04-11 01:34:14 -04:00
parent ac7bfa7320
commit 06c8924367

View File

@ -8,12 +8,15 @@ import bSSL
import ipxe import ipxe
import bsync import bsync
import bGPG import bGPG
import os


# we need to: # we need to:
# we also need to figure out how to implement "mentos" (old bdisk) like functionality, letting us reuse an existing chroot install if possible to save time for future builds. # we also need to figure out how to implement "mentos" (old bdisk) like functionality, letting us reuse an existing chroot install if possible to save time for future builds.
# if not, though, it's no big deal. # if not, though, it's no big deal.
# still on the todo: iPXE # still on the todo: iPXE
if __name__ == '__main__': if __name__ == '__main__':
if os.getuid() != 0:
exit('{0}: ERROR: BDisk *must* be run as the root user or with sudo!'.format(datetime.datetime.now()))
print('{0}: Starting.'.format(datetime.datetime.now())) print('{0}: Starting.'.format(datetime.datetime.now()))
conf = host.parseConfig(host.getConfig())[1] conf = host.parseConfig(host.getConfig())[1]
prep.dirChk(conf) prep.dirChk(conf)