Skip to content

Commit e59d8b8

Browse files
authored
Add check for running from current user directory and bail with warning (munki#65)
* Add check for running from special dirs that apple thinks need approval and warn
1 parent e71ade7 commit e59d8b8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

installinstallmacos.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,16 @@ def main():
506506
sys.exit('This command requires root (to install packages), so please '
507507
'run again with sudo or as root.')
508508

509+
current_dir = os.getcwd()
510+
if os.path.expanduser("~") in current_dir:
511+
bad_dirs = ['Documents', 'Desktop', 'Downloads', 'Library']
512+
for bad_dir in bad_dirs:
513+
if bad_dir in os.path.split(this_dir):
514+
print('Running this script from %s may not work as expected. '
515+
'If this does not run as expected, please run again from '
516+
'somewhere else, such as /Users/Shared.'
517+
% current_dir, file=sys.stderr)
518+
509519
if args.catalogurl:
510520
su_catalog_url = args.catalogurl
511521
elif args.seedprogram:

0 commit comments

Comments
 (0)