Bug 7984 - Modifying macOS installer is difficult
Summary: Modifying macOS installer is difficult
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Client platforms (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-24 16:41 CEST by Samuel Mannehed
Modified: 2022-08-31 13:53 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments
Patch required for building Mac-Finder-DSStore (1.37 KB, patch)
2022-08-24 16:45 CEST, Samuel Mannehed
Details
Patch required for Mac-PropertyList (420 bytes, patch)
2022-08-24 16:51 CEST, Samuel Mannehed
Details
Perl script that generates a working .DS_Store file (5.04 KB, application/x-perl)
2022-08-24 17:04 CEST, Samuel Mannehed
Details

Description Samuel Mannehed cendio 2022-08-24 16:41:01 CEST
We use a “.DS_Store” file to apply our background, size, and icons to the macOS installer. Generating or modifying this .DS_Store file is difficult and involves many manual steps (described in ctc/client/macos/ThinLinc/README).

This could be easier and done without going back and forth to a macOS machine.

There is a Perl module called “Mac-Finder-DSStore” that, can both parse and write new .DS_Store files:

https://metacpan.org/release/WIML/Mac-Finder-DSStore-1.00

Modifications to the macOS installer would then easily be done in the DS_Store.pl file, which is humanly readable. Using the Mac-Finder-DSStore module we could have a checked in “DS_Store.pl” which, which when executed, with “perl DS_Store.pl”, would generate a new working .DS_Store file.
Comment 1 Samuel Mannehed cendio 2022-08-24 16:45:48 CEST
Created attachment 1057 [details]
Patch required for building Mac-Finder-DSStore

This patch is required in order for building Mac-Finder-DSStore on Linux. It includes two fixes:

 * The recommended requirements "Mac::Files" and "Mac::Memory" are removed from Build.PL. Despite them being optional it didn't build without them. Both these perl modules only seem available on macOS machines.

 * Added types for the properties "pBBk" and "pBB0". These types appear in modern .DS_Store files but seems like they didn't exist when the module was written. Without this patch we can't build new .DS_Store files from perl input that contains this property.
Comment 2 Samuel Mannehed cendio 2022-08-24 16:51:19 CEST
Created attachment 1058 [details]
Patch required for Mac-PropertyList

The perl module Mac-PropertyList is required by Mac-Finder-DSStore for parsing and printing .DS_Store plist data.

The code that this patch fixes seemed broken, it asserts that the variable $power2 isn't bigger than 3, but just a few rows down has code that handles the case when $power2 == 4. After this change it was possible to parse both old and modern .DS_Store files.
Comment 3 Samuel Mannehed cendio 2022-08-24 17:04:12 CEST
Created attachment 1059 [details]
Perl script that generates a working .DS_Store file

This perl script was generated using Mac-Finder-DSStore (patched) with an old .DS_Store file as input (Note that the --raw-aliases flag is required since we won't have the "Mac::Files" and "Mac::Memory" requirements):

 perl Mac-Finder-DSStore-1.00-patched/examples/dsstore_dump.pl --raw-aliases ~/DS_Store_old > ~/DS_Store.pl

This perl script can then create a working .DS_Store file:

 perl ~/DS_Store.pl
Comment 4 Samuel Mannehed cendio 2022-08-25 09:34:47 CEST
Note that the generated perl scripts sometimes generate warnings. One example that we manually adjusted was this:

> ...
>         "showItemInfo" => bless( do{\(my $o = "false")}, 'Mac::PropertyList::false' ),
>         "textSize" => bless( do{\(my $o = 12)}, 'Mac::PropertyList::real' ),
>         "backgroundType" => bless( do{\(my $o = 2)}, 'Mac::PropertyList::integer' ),
>         "arrangeBy" => bless( do{\(my $o = "none")}, 'Mac::PropertyList::string' ),
>         "labelOnBottom" => bless( do{\(my $o = "true")}, 'Mac::PropertyList::true' ),
>         "backgroundColorGreen" => bless( do{\(my $o = 1)}, 'Mac::PropertyList::real' ),
>         "viewOptionsVersion" => bless( do{\(my $o = 1)}, 'Mac::PropertyList::integer' ),
>         "gridSpacing" => bless( do{\(my $o = 100)}, 'Mac::PropertyList::real' ),
>         "gridOffsetX" => bless( do{\(my $o = 0)}, 'Mac::PropertyList::real' ),
>         "showIconPreview" => $VAR1->{"showItemInfo"},
>         "iconSize" => bless( do{\(my $o = 128)}, 'Mac::PropertyList::real' ),
> ...

The "showIconPreview" property line gave the following warning when we tried to create a new DS_Store file:

> Name "main::VAR1" used only once: possible typo at /home/cendio/DS_Store.pl line 29.

It is likely a harmless warning, but we fixed it by replacing the $VAR1 reference with its value found up with the "showItemInfo" property, like this:

> "showIconPreview" => bless( do{\(my $o = "false")}, 'Mac::PropertyList::false' ),

Note You need to log in before you can comment on or make changes to this bug.