Skip to content

Add support for .pkg extraction to support MacOs on Hugo versions >0.153.0 #187

@wilmardo

Description

@wilmardo

Since releases v0.153.0 Hugo now distributes .pkg files instead of .tar.gz files for MacOs

Currently on MacOs running install.js will result in vendor/hugo_0.158.0_darwin-universal.pkg instead of the binary. Also probably why this Github action is failing and the NPM releases lacking behind.

Since the extract option of bin-wrapper (subsequently downloader > decompress etc) had no support for the pkg extraction the flag is ignored.

Would it be an idea to add a decompress-xar package (.pkg are xar archives) and then subsequently add support in decompress, downloader, bin-wrapper and hugo-bin?

See here for inspiration:
https://github.com/finnp/xar/blob/master/lib/extract.js

It seems to me that the xar archive is just a gzip/bzip/lzma encoded zip with some information headers before it.

Another idea could be to invoke xar (which is available on Linux as well so could be used in the GH Actions to test):

# xar -xf hugo_0.158.0_darwin-universal.pkg
# ls -l
-rw-r--r--@ 1 wilmardo  staff     57419 Mar 16 18:50 Bom
-rwxr-xr-x  1 wilmardo  staff  35772910 Mar 21 10:42 hugo_0.158.0_darwin-universal.pkg
-rw-r--r--  1 wilmardo  staff       486 Mar 21 11:03 PackageInfo
-rw-r--r--@ 1 wilmardo  staff  35756438 Mar 16 18:50 Payload
# file Payload
Payload: gzip compressed data, from Unix, original size modulo 2^32 103522816

And then Payload could be extracted with decompress-targz

# tar -xzvf Payload
x .
x ./hugo
x ./._hugo

Let me know if this is something you would like to pursue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions