Skip to content

setup on macos not using correct directory #2

@yunchengyang515

Description

@yunchengyang515

Examine the code here

def _setup(download_dir, platform, showprogress=True):
	print('installing stackql...')
	try:
		binary_name = _get_binary_name(platform)
		url = _get_url(platform)
		print("downloading latest version of stackql from %s to %s" % (url, download_dir))
		archive_file_name = os.path.join(download_dir, os.path.basename(url))
		_download_file(url, archive_file_name, showprogress)
		if platform == 'Darwin':
			os.system('sudo installer -pkg {} -target /'.format(archive_file_name))
		else:
			with zipfile.ZipFile(archive_file_name, 'r') as zip_ref:
				zip_ref.extractall(download_dir) 
		os.chmod(os.path.join(download_dir, binary_name), 0o755)
	except Exception as e:
		print("ERROR: [_setup] %s" % (str(e)))
		exit()
  • sudo installer -pkg {} -target / will install the package to a different directory than download directory
  • because the binary not going to be in the download_dir, causing os.chmod(os.path.join(download_dir, binary_name), 0o755) will return error
  • In setup-stackql we use pkgutil to expand the pkg
      case 'darwin':
        let tmpPath = await tc.downloadTool(url);
        core.info(`extracting mac pkg in ${tmpPath}...`);
        const installPath = '/Users/runner/work/_temp/stackql-pkg';
        execSync(`pkgutil --expand-full ${tmpPath} ${installPath}`);
        return `${installPath}/Payload`;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions