macadmins / macadmins/installapplications

Including rootscript in IA package will break if url is present, but empty

Open
#86 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
307
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Stumbled upon this issue. It is only a problem if you bundle stuff into a package.

_If you are downloading resources from an URL this does not apply!_

if you bundle a rootscript in the package you have to do the following:

a: Remove the "url" parameter, even if it is empty

or

b: Include the "url" AND the "hash" parameter

This will not work
```
"preflight": [
{
"file": "/Library/installapplications/scripts/root/05-preflight.py",
"name": "Preflight",
"type": "rootscript",
"url": ""
}
]
```
This will work

```
"preflight": [
{
"file": "/Library/installapplications/scripts/root/05-preflight.py",
"name": "Preflight",
"type": "rootscript"
}
]
```

This will also work

```
"preflight": [
{
"file": "/Library/installapplications/scripts/root/05-preflight.py",
"name": "Preflight",
"type": "rootscript",
"url": "",
"hash": "a_generated_256_hash_value"
}
]
```

The issue is easily solved by removing empty hashes from your json, which probably is a good habit anyway.

The confusion arrives since sometimes its allow with an empty hash, like this: which also will work:
```
"setupassistant": [`
{
"file": "/Library/installapplications/packages/DEPNotify-1.1.5.signed.pkg",
"hash": "a_generated_256_hash_value",
"name": "DEPNotify",
"packageid": "menu.nomad.DEPNotify",
"type": "package",
"url": "",
"version": "1.1.5"
}
]
```

It might also be that the use of generatejson.py does avoid this issue, but if you handcraft your json you have to be careful.

I think this issue is best solved by archiving this issue as part of documentation of a cornercase. I will also try to make a general addition to the documentation (as a PR) about avoiding empty hashes in your jsonfile, in case of handcrafting or copy/paste from other sources.

K

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review generatejson.py and the existing documentation for rootscript package entries, focusing on how empty url and hash fields are represented. Document the difference between bundled rootscripts and URL downloads, include the working and failing JSON examples, and explain the expected handling of empty hashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.