Giter Club home page Giter Club logo

quickpkg's Introduction

quickpkg - Build packages quickly

This tool will quickly and easily build a package from an installed application, a disk image file or zip archive with an enclosed application bundle. It will also extract the application name and version and use it to name the resulting pkg file.

The tool will look for applications on the first level of the disk image or archive. If it finds no or more than one application it will error.

The name of the resulting package will be of the form {name}-{version}.pkg. Spaces will be removed from the name. The package will be written to the current working directory.

Dependencies

Apple will remove the Python 2.7 binary at /usr/local/python from macOS in macOS Monterey 12.3. This script is built and tested with the MacAdmins "Managed Python." It should (probably) work with other Python 3 distributions, as well, but has not been tested on any.

Examples

Build package from installed application:

quickpkg /Applications/Numbers.app

Build package from a disk image:

quickpkg ~/Downloads/Firefox\ 43.0.4.dmg

Build package from a zip archive:

quickpkg ~/Downloads/Things.zip

Options

--scripts scripts_folder:

Pass a folder with scripts that are passed to pkgbuild's --scripts option. If the there is a preinstall and/or postinstall script they will be run at the respective and can call other scripts in this folder.

--postinstall postinstall_script

Use the script file given as a postinstall script. If given together with the -scripts option will attempt to merge the two and error if a postinstall script is already present.

--preinstall preinstall_script

Use the script file given as a preinstall script. If given together with the -scripts option will attempt to merge the two and error if a preinstall script is already present.

--ownership {recommended,preserve,preserve-other}

This parameter will be passed into pkgbuild. Default is recommended. See man pkgbuild for details.

--output pkgpath

Will write the resulting package to pkgpath instead of the current working directory. If pkgpath is a directory, then the default package name ({name}-{version}.pkg) is used. You can also give the complete path, including a name. You can use the placeholders {name}, {version} and {identifier} in the name.

Examples:

quickpkg /Applications/Numbers.app --output ~/Packages/

Will create Numbers-X.Y.Z.pkg in ~/Packages.

quickpkg /Applications/Numbers.app --output Numbers_latest.pkg

will create Numbers_latest.pkg in the current working directory.

quickpkg /Applications/Numbers.app --output ~/Packages/{identifier}_{version}.pkg

will create com.apple.Numbers_X.Y.Z.pkg in ~/Packages.

--[no-]relocatable

Controls wether the resulting pkg file is relocatable, i.e. if the installer process will search for the bundle by bundle-identifier if it was moved to another location. By default packages will be created NON-relocatable.

--sign, --keychain and --cert

You can add these options to sign the resulting package. These three options are passed through to the pkgbuild command. Read the pkgbuild man page for details.

Usually you can find the proper signing identity (from the Apple Developer account) with the command

$ security find-identity -p basic -v

and then you add the proper identity with the --sign option.

$ quickpkg ~/Downloads/Firefox\ 53.0.3.dmg --sign "3rd Party Mac Developer Installer: Your Name Here"

Background

OS X has had the pkgbuild tool since Xcode 3.2 on Snow Leopard. With pkgbuild you can directly build a installer package from an application in the /Applications folder:

pkgbuild --component /Applications/Numbers.app Numbers.pkg

Or even an application inside a mounted dmg:

pkgbuild --component /Volumes/Firefox/Firefox.app \
         --install-location /Applications \
         Firefox.pkg

This tool even does the work of determining a bundle's identifier and version and sets the identifier and version of the pkg to the same values.

However, while pkgbuild does automatically name the package, it does not include the version, which is important when you tracking many versions of the same application. It also doesn't automatically look into a dmg file or zip archive.

quickpkg vs autopkg

This tool is not meant to replace autopkg. autopkg will automate the download, the re-packaging (if necessary) and the upload to and configuration of your client management system. It can also handle much more complex setups than quickpkg. autopkg is far superior and should be your tool of choice.

However, there are situations where autopkg does not work well. The most common reason is if the download cannot be automated because the download page is behind a paywall. Or maybe you are just experimenting with a test server and do not want to change your production autopkg setup. Also autopkg requires a recipe for a given piece of software. If no recipe exists, quickpkg may be a simple alternative. (Though if quickpkg works, creating an autopkg recipe should not be hard.)

quickpkg vs munkipkg

quickpkg is meant for 'quick' packaging. No configuration, no options. Download the application from the AppStore or the dmg or zip from the web and go. (I started working on it because I could never remember the exact options needed for pkgbuild.) munkipkg is a tool that makes it easier to access the complex options of pkgbuild and packagebuild, but it still supports complex projects.

If you prefer a UI rather than a command line tool, then use Stéphane Sudre's Packages.

Warning

All quickpkg does is identify an application bundle and package it in a way that the package will install that application bundle into the /Applications folder. If the application needs other files (libraries, frameworks, configuration files, license files, preferences etc.) to run and work they are your responsibility.

Also be sure to understand what you are running quickpkg against. If you run quickpkg on the disk image you get from DropBox or for the Adobe Flash Player, you will get a pkg that installs the DropBox or Flash Player installer in the /Applications folder. Probably not what you wanted.

quickpkg's People

Contributors

homebysix avatar scriptingosx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quickpkg's Issues

how to use

How does quickpkg make this command work

Relocatable option is enabled by default

The quickpkg read me says:

All quickpkg does is identify an application bundle and package it in a way that the package will install that application bundle into the /Applications folder. If the application needs other files (libraries, frameworks, configuration files, license files, preferences etc.) to run and work they are your responsibility.

But it seems that quickpkg allows bundle relocation by default, so it's possible that an app may not be installed in the Applications folder where expected.

Might you consider switching relocation to false by default, to align quickpkg's behavior to the stated goal? Thanks!

MacAdmins "Managed Python" issue

I have been using quickpkg in a project. Everything has worked as expected. However, I got an issue today when I returned to the project and needed to run some CI tests.

> git clone https://github.com/scriptingosx/quickpkg.git
> quickpkg/quickpkg dist/someApp.app --output someApp-1.0.0-macOS.pkg

Resulted in:

Cloning into 'quickpkg'...
/Users/runner/work/_temp/5fb59a5c-97d8-4069-bf10-0169e67a8e01.sh: quickpkg/quickpkg: /usr/local/bin/managed_python3: bad interpreter: No such file or directory
Error: Process completed with exit code 126.

This was tested on a hosted runner (GitHub Actions), on macos 10.15, using python 3.7.


From our discussion here, it seems like I am using the wrong python version when using quickpkg. I had not seen the updated requirements in the README.

Therefore, I should use the MacAdmins "Managed Python" version instead. However, I am not familiar with it. I am currently using GitHub Actions, and I am unable to find this python version, at least as an action. Have you tried or found it?

In advance, thanks!

Not having much luck with v1.0beta pre-release

Hi,

I tried using the latest v1.0beta pre-release when I was using 12.2 with both MacAdmins python installed along with the system python2 and found only 1 or 2 times that the new beta version worked. The previous version of quickpkg was always working for the same commands at that time.

I've now updated to 12.3beta with the system python2 removed and still having problems. I've in the meantime upgraded to MacAdmins python version 3.9.10 however the same issue remains.

I'm not sure if this gives much information however it is the output from a simple ./quickpkg ~/Downloads/something.dmg command.

  File "/Users/uqpkollm/Desktop/quickpkg-1.0beta/./quickpkg", line 277, in <module>
    dmgvolumepaths = attachdmg(item_path)
  File "/Users/uqpkollm/Desktop/quickpkg-1.0beta/./quickpkg", line 88, in attachdmg
    (theplist, alltext) = getFirstPlist(info_result["stdout"])
  File "/Users/uqpkollm/Desktop/quickpkg-1.0beta/./quickpkg", line 52, in getFirstPlist
    plist_start_index = textString.find(plist_header)
TypeError: argument should be integer or bytes-like object, not 'str'

Happy to help with any testing/troubleshooting if I can be of assistance.

Cheers.

Throwing a Syntax Error

I'm using version 0.8.1 and have pointed the shebang to the latest version of Managed Python (/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3).

I'm getting:

./quickpkg ~/Downloads/Notion-2.0.24.dmg
  File "/Users/tonyw/Dropbox/work/quickpkg-0.8.1/./quickpkg", line 126
    except NSPropertyListSerializationException, error:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized

1.0beta throws a different error :

./quickpkg ~/Downloads/Notion-2.0.24.dmg
Traceback (most recent call last):
  File "/Users/tonyw/Dropbox/work/quickpkg-1.0beta/./quickpkg", line 277, in <module>
    dmgvolumepaths = attachdmg(item_path)
  File "/Users/tonyw/Dropbox/work/quickpkg-1.0beta/./quickpkg", line 88, in attachdmg
    (theplist, alltext) = getFirstPlist(info_result["stdout"])
  File "/Users/tonyw/Dropbox/work/quickpkg-1.0beta/./quickpkg", line 52, in getFirstPlist
    plist_start_index = textString.find(plist_header)
TypeError: argument should be integer or bytes-like object, not 'str'

bad interpreter

zsh: ./quickpkg: bad interpreter: /usr/local/bin/managed_python3: no such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.