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

Support unarchiving .PKG format for macOS #1803

Closed
suzuki-shunsuke opened this issue Mar 25, 2023 · 11 comments · Fixed by #2002
Closed

Support unarchiving .PKG format for macOS #1803

suzuki-shunsuke opened this issue Mar 25, 2023 · 11 comments · Fixed by #2002
Labels
enhancement New feature or request
Milestone

Comments

@suzuki-shunsuke
Copy link
Member

Feature Overview

Support unarchiving .PKG format for macOS.

Why is the feature needed?

Please explain the problem you want to solve.

Some tools provide only .PKG format assets.

Does the feature include Breaking Changes?

No.

Example Code

command and configuration

$ 

Reference

pkgutil

Note

I'm not familiar with PKG format, so I'm not sure if aqua can support PKG.
And the issue has a low priority because there are only a few packages that require this feature.

@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label Mar 25, 2023
@suzuki-shunsuke
Copy link
Member Author

I thought aqua can support aws CLI in macOS, but unfortunately aqua couldn't because AWS CLI's PKG URL doesn't have the version, so aqua couldn't distinguish the version.

https://awscli.amazonaws.com/AWSCLIV2.pkg

@gedw99
Copy link

gedw99 commented Apr 5, 2023

Hey

I have seen a few golang libs that support PKG format. I used a few and can have a look what i used.

@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented Apr 5, 2023

Hey

I have seen a few golang libs that support PGK format. I used a few and can have a look what i used.

Could you tell us libraries?

@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented May 10, 2023

s3deploy migrated to PKG format.

We have ported the release script to Hugoreleaser. This means that the archive names have changed (standardised), but it also means that you get only one unviversal, notarized MacOS PKG archive.


@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented May 10, 2023

I could unarchive a PKG format file using pkgutil.

ref. https://qiita.com/spc_gmorimoto/items/10ee021303f8b1b05114

https://stackoverflow.com/a/50835954

$ pkgutil --expand-full s3deploy_2.9.0_darwin-universal.pkg dist

$ tree dist 
dist
├── Bom
├── PackageInfo
└── Payload
    └── s3deploy

2 directories, 3 files

$ file dist/Payload/s3deploy 
dist/Payload/s3deploy: Mach-O universal binary with 2 architectures: [arm64:Mach-O 64-bit executable arm64] [x86_64]
dist/Payload/s3deploy (for architecture arm64):	Mach-O 64-bit executable arm64
dist/Payload/s3deploy (for architecture x86_64):	Mach-O 64-bit executable x86_64

$ ./dist/Payload/s3deploy --help
Usage of s3deploy:
  -V	print version and exit
  -acl string
    	provide an ACL for uploaded objects. to make objects public, set to 'public-read'. all possible values are listed here: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl (default "private")
  -bucket string
    	destination bucket name on AWS
  -config string
    	optional config file (default ".s3deploy.yml")
  -distribution-id value
    	optional CDN distribution ID for cache invalidation, repeat flag for multiple distributions
  -force
    	upload even if the etags match
  -h	help
  -ignore string
    	regexp pattern for ignoring files
  -key string
    	access key ID for AWS
  -max-delete int
    	maximum number of files to delete per deploy (default 256)
  -path string
    	optional bucket sub path
  -public-access
    	DEPRECATED: please set -acl='public-read'
  -quiet
    	enable silent mode
  -region string
    	name of AWS region
  -secret string
    	secret access key for AWS
  -source string
    	path of files to upload (default ".")
  -try
    	trial run, no remote updates
  -v	enable verbose logging
  -workers int
    	number of workers to upload files (default -1)
error parsing commandline arguments: flag: help requested

@gedw99
Copy link

gedw99 commented May 10, 2023

nice one :)

I saw a golang msi packager on github. cant remember but can look.

@suzuki-shunsuke
Copy link
Member Author

@gedw99
Copy link

gedw99 commented May 16, 2023

will take a look...

@suzuki-shunsuke suzuki-shunsuke added this to the v2.7.0 milestone May 16, 2023
@gedw99
Copy link

gedw99 commented May 16, 2023

hey @suzuki-shunsuke

code looks nice and clean...

Looks like it has Unarchive using "pkgutil --expand my-package.pkg path/to/expand", but nothing to to create an archive.

For example, these are the calls to create a pkg and sign it.
Maybe we can do in another PR ???

#Makes a .pkg

pkgbuild --root "$APPDIR" --identifier "com.myapp.gui" --version $VERSION --sign "IDENTITYKEY" --install-location "/Applications/MyApp.app" "app.pkg"

# distribution.xml for the gui the user sees when running the pkg at install time.
productbuild --distribution builddir/distribution.xml --version $VERSION --sign "IDENTITYKEY" app-distrib.pkg


# Signs the pkg
productsign --timestamp --sign "Developer ID Installer: YOUR NAME (TEAM_ID)" /path/to/unsigned.pkg /path/to/signed.pkg

There is also a util written in rust that can sign Mac stuff without being on a MAC. I am playing with it.
Its kind of cool to not need a mac. You have to have Certs from a mac...

anyways let me knwo what you think...

@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented May 16, 2023

Thank you for your review.
The scope of this issue and the pull request is Support unarchiving .PKG format for macOS.
Archiving and signing is out of scope.

Please open a discussion or update the related issues #1826 if you want to discuss the signing.

@gedw99
Copy link

gedw99 commented May 16, 2023

Thank you for your review. The scope of this issue and the pull request is Support unarchiving .PKG format for macOS. Archiving and signing is out of scope.

Please open a discussion or update the related issues #1826 if you want to discuss the signing.

https://github.com/orgs/aquaproj/discussions/2004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants