mirror of
https://github.com/grahampugh/macadmin-scripts.git
synced 2025-12-17 17:56:33 +00:00
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:
parent
e71ade7e92
commit
e59d8b84cb
@ -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:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user