munki-rebrand icon indicating copy to clipboard operation
munki-rebrand copied to clipboard

Adds --resource-addition option

Open patgmac opened this issue 2 years ago • 9 comments

Adds the option for --resource-addition to allow the addition of another file in the Scripts directory, typically another pkg installer such as one including middleware or additional python modules.

patgmac avatar Jan 15 '22 18:01 patgmac

holy shnikes! this could be useful. i have some crazy scripts around rebrand right now to add my middleware pkg etc.

sphen13 avatar Jan 15 '22 19:01 sphen13

This happens to me when I try to add middleware, am I adding the option correctly?

sudo ./munki-rebrand/munki_rebrand.py -a "Managed Software Center" -i logo.png -p build/groupname/postinstall -r build/groupname/middleware-1.3.pkg -s "Developer ID Installer: redacted" -o build/groupname/ManagedSoftwareCenter-groupname
Converting .png file to .icns...
Downloading munkitools from https://github.com/munki/munki/releases/download/v5.6.2/munkitools-5.6.2.4398.pkg...
Copying postinstall script build/groupname/postinstall to /tmp/tmpalz9own_/root/munkitools_app.pkg/Scripts/postinstall...
Making /tmp/tmpalz9own_/root/munkitools_app.pkg/Scripts/postinstall executable...
Adding additional resource build/groupname/middleware-1.3.pkg to /tmp/tmpalz9own_/root/munkitools_app.pkg/Scripts/build/groupname/middleware-1.3.pkg...
Traceback (most recent call last):
  File "./munki-rebrand/munki_rebrand.py", line 641, in <module>
    main()
  File "./munki-rebrand/munki_rebrand.py", line 501, in main
    shutil.copyfile(args.resource_addition, dest)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpalz9own_/root/munkitools_app.pkg/Scripts/build/groupname/middleware-1.3.pkg'
Cleaning up...
Done.

kginger avatar Jan 21 '22 03:01 kginger

@kginger Looks like it's grabbing the full path of build/groupname/middleware-1.3.pkg and capturing that as the filename. I only tested with the middleware package being in the same directory as the script. I'll see if I can fix that, but in the mean time, try it with the pkg in the same directory so you can call -r middleware-1.3.pkg

patgmac avatar Jan 21 '22 03:01 patgmac

@patgmac that worked, I could have thought of that. This will help a lot with goofy scripting and race conditions with middleware. Thank you!

kginger avatar Jan 21 '22 03:01 kginger

I would love to see this added to the new 5.2 main.

kginger avatar May 04 '22 15:05 kginger

I would love to see this added to a new version!!!

LcTrKiD avatar May 04 '22 18:05 LcTrKiD

Have you tested what effect including a pkg in the Scripts dir has on signing and notarizing the pkg?

fuzzylogiq avatar May 04 '22 18:05 fuzzylogiq

@fuzzylogiq I do sign the rebranded package, no problems there. I do not notarize the package (or apps).

patgmac avatar May 04 '22 18:05 patgmac

@fuzzylogiq I've updated the PR.

patgmac avatar Jun 27 '22 21:06 patgmac

@fuzzylogiq Any interest in merging this PR?

patgmac avatar Dec 22 '22 16:12 patgmac