Add check for running from current user directory and bail with warning (#65)

* Add check for running from special dirs that apple thinks need approval and warn
This commit is contained in:
Nate Walck 2020-09-18 16:41:31 -04:00 committed by GitHub
parent e71ade7e92
commit e59d8b84cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -506,6 +506,16 @@ def main():
sys.exit('This command requires root (to install packages), so please ' sys.exit('This command requires root (to install packages), so please '
'run again with sudo or as root.') 'run again with sudo or as root.')
current_dir = os.getcwd()
if os.path.expanduser("~") in current_dir:
bad_dirs = ['Documents', 'Desktop', 'Downloads', 'Library']
for bad_dir in bad_dirs:
if bad_dir in os.path.split(this_dir):
print('Running this script from %s may not work as expected. '
'If this does not run as expected, please run again from '
'somewhere else, such as /Users/Shared.'
% current_dir, file=sys.stderr)
if args.catalogurl: if args.catalogurl:
su_catalog_url = args.catalogurl su_catalog_url = args.catalogurl
elif args.seedprogram: elif args.seedprogram: