ox-it / munki-rebrand

Script to rebrand Munki's Managed Software Center
BSD 3-Clause "New" or "Revised" License
89 stars 24 forks source link

Adds --resource-addition option #53

Closed patgmac closed 1 year ago

patgmac commented 2 years ago

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.

sphen13 commented 2 years ago

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

kginger commented 2 years ago

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.
patgmac commented 2 years ago

@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

kginger commented 2 years ago

@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 commented 2 years ago

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

LcTrKiD commented 2 years ago

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

fuzzylogiq commented 2 years ago

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

patgmac commented 2 years ago

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

patgmac commented 2 years ago

@fuzzylogiq I've updated the PR.

patgmac commented 1 year ago

@fuzzylogiq Any interest in merging this PR?