Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installinstallmacos.py: Fix bad_dir check, and make warning louder #87

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions installinstallmacos.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def os_installer_product_info(catalog, workdir, ignore_cache=False):
product_info[product_key]['title'] = dist_info.get('title_from_dist')
if not product_info[product_key]['version']:
product_info[product_key]['version'] = dist_info.get('VERSION')

return product_info


Expand Down Expand Up @@ -531,15 +531,18 @@ def main():
sys.exit('This command requires root (to install packages), so please '
'run again with sudo or as root.')

home_dir = os.path.expanduser("~")
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(current_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)
bad_subdirs = ['Documents', 'Desktop', 'Downloads', 'Library']
for bad_subdir in bad_subdirs:
bad_dir = os.path.join(home_dir, bad_subdir)
if current_dir.startswith(bad_dir):
print('*********************************************************\n'
'*** Running this script from %s may not work as expected.\n'
'*** If this does not run as expected, please run again\n'
'*** from somewhere else, such as /Users/Shared.\n'
'*********************************************************'
% current_dir, file=sys.stderr)

if args.catalogurl:
su_catalog_url = args.catalogurl
Expand Down