ox-it / munki-rebrand Goto Github PK
View Code? Open in Web Editor NEWScript to rebrand Munki's Managed Software Center
License: BSD 3-Clause "New" or "Revised" License
Script to rebrand Munki's Managed Software Center
License: BSD 3-Clause "New" or "Revised" License
When attempting to replace the app icon for the Managed Software Center, munki_rebrand throws this error:
Replacing icons in /tmp/tmpTuOMUq/payload/Applications/Managed Software Center.app/Contents/Resources/AppIcon.icns with /Users/Shared/munki_installer/ISU_Seal.icns...
Traceback (most recent call last):
File "./munki_rebrand.py", line 518, in <module>
main()
File "./munki_rebrand.py", line 471, in main
if car:
UnboundLocalError: local variable 'car' referenced before assignment
Works fine as long as I'm not attempting to change the icon.
There was just a bug-fix munki release (3.2.1.3499) and while not a huge deal, the output munki-rebrand package uses a slightly different version: 3.2.1.3498
the pkg-info tag of the generated munkitools_app pkg is not complete. The other pieces of the package are fine presumably as they are not being modified. see the resulting PackageInfo
i just generated. Let me know if there is more data I can help give! thanks.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.googlecode.munki.app" postinstall-action="none" version="0" format-version="2" generator-version="InstallCmds-554 (15F34)" auth="root">
<payload numberOfFiles="278" installKBytes="5151"/>
<bundle path="./Applications/Managed Software Center.app/Contents/Resources/MunkiStatus.app" id="com.googlecode.munki.MunkiStatus" CFBundleShortVersionString="4.0.3438" CFBundleVersion="3438"/>
<bundle path="./Applications/Managed Software Center.app/Contents/Resources/munki-notifier.app" id="com.googlecode.munki.munki-notifier" CFBundleShortVersionString="1.0.3445" CFBundleVersion="3445"/>
<bundle path="./Applications/Managed Software Center.app/Contents/PlugIns/MSCDockTilePlugin.docktileplugin" id="com.googlecode.munki.MSCDockTilePlugin" CFBundleShortVersionString="1.0" CFBundleVersion="1"/>
<bundle path="./Applications/Managed Software Center.app" id="com.googlecode.munki.ManagedSoftwareCenter" CFBundleShortVersionString="4.7.3442" CFBundleVersion="3442"/>
<bundle-version>
<bundle id="com.googlecode.munki.ManagedSoftwareCenter"/>
</bundle-version>
<upgrade-bundle>
<bundle id="com.googlecode.munki.ManagedSoftwareCenter"/>
</upgrade-bundle>
<update-bundle/>
<atomic-update-bundle/>
<strict-identifier>
<bundle id="com.googlecode.munki.MunkiStatus"/>
<bundle id="com.googlecode.munki.munki-notifier"/>
<bundle id="com.googlecode.munki.ManagedSoftwareCenter"/>
</strict-identifier>
<relocate/>
<scripts>
<preinstall file="./preinstall"/>
</scripts>
</pkg-info>
When I try to make an munki rebrand pkg, the name of the app doenst change.
sudo ./munki_rebrand.py -a "Custom AppStore"
Cloning git repo...
Using latest Github code...
Replacing Managed Software Center with Custom AppStore in apps...
Building customized Munki...
Customized package built at /Users/foo/git/munki-rebrand/munkitools-3.1.0.3437.pkg.
Cleaning up...
Done.
If i install the new package, the name is "Geführte Softwareaktuallisierung" die German version of Managed Software Center.
The possibility to change the icon works great, only the name doenst change.
Any ideas?
When getting a branded MSC notification, clicking on it does not open MSC. Presumably because of the name change. Is this something that could possibly be resolved?
Under Munki-rebrands Pre-requisites, the following is stated:
But as far as I can tell Xcode 10+ will only run on macOS 10.13.6 or later, according to this release note from Apple:
https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
Shouldn't the Pre-requisites then list macOS 10.13.6 as the minimum?
Is it possible to run the latest Munki-Rebrand on macOS 10.12?
Is Xcode 10 required?
When providing the argument --icon-file „Example.png“
, the script will return the following error (full output shown):
Downloading munkitools from https://github.com/munki/munki/releases/download/v6.3.1/munkitools-6.3.1.4580.pkg...
Replacing app name with FooBar...
Traceback (most recent call last):
File "/Users/user/Downloads/munki-rebrand-5.2/munki_rebrand.py", line 632, in <module>
main()
File "/Users/user/Downloads/munki-rebrand-5.2/munki_rebrand.py", line 512, in main
if icns:
UnboundLocalError: local variable 'icns' referenced before assignment
Cleaning up...
Done.
This happens irrespective of the image file provided, or the location the script is being run from. Running the script without the image argument works just fine.
macOS 12.6.6
Tag version 2.2.4 is super old, your code references it here. Greg made a change with munki/munki@6ad9066 that is in tags v2.5.0 and greater that removes the macosx10.8 sdk requirement.
At minimum I'd recommend bumping the tag version to 2.5.0, however in reality it might just be easier to set the current release of v2.8.2.
This will solve the:
error: There is no SDK with the name or path '/Users/username/Source/munki_rebrand/munki/code/apps/Managed Software Center/macosx10.8'
error that @ jimmynyc had in the MacAdmin's Slack group. reference link https://macadmins.slack.com/archives/munki/p1477491267006752
This will means new users can download Xcode, accept the license agreement, download the munki-rebrand script and just go.
Hello! I'm testing munki_rebrand.py on macOS Sierra beta 7.
Issue: after installing the rebranded munkitools.pkg and running MSC, the title and menu bars of MSC still read the standard “Managed Software Center” rather than “Our Rebranded Software Centre”.
The app icon and the name of the app do show our rebranding as expected, but the title and menu bars do not.
I installed the same pkg on a few machines running El Capitan 10.11.6, and the title and menu bars get the rebranding as expected, so I see this behaviour only with Sierra (beta 7).
Same behaviour with munkitools 2.7.x and 2.8.x.
Seems #60 caused a regression in behavior. When i try to use munki-rebrand, signing as usual and then submitting for notarization it fails with a laundry list of issues. reverting to the previous commit fixes the behavior. This is with the latest 6.5.1 munki.
Hi,
when i ran:
sudo python munki_rebrand.py --appname $appname --icon-file $icon --output-file $appname --pkg $pkg_path
i had this issue
Converting .png file to .icns...
xcode-select: error: tool 'actool' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
and i did a quick google search and found the solution [here|https://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error/17980786#17980786]
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
I hope it helps :).
The current Munki release version is 3.6.0.3734. The subpackages are:
munkitools_core-3.6.0.3721.pkg
munkitools_app_usage-3.6.0.3721.pkg
munkitools_admin-3.6.0.3721.pkg
munkitools_app-5.1.0.3734.pkg
munkitools_launchd-3.0.3265.pkg
When you use munki-rebrand, it names the package munkitools-3.6.0.3721.pkg. The official build takes the highest last number out of all the subpackages, so munki-rebrand should be using 3734 as the last part of the version number.
Is it possible to add support for a custom welcome, readme and licence during the installation of the software?
Is het possible to incorporate ericng’s (https://github.com/munki/munki/blob/master/code/tools/make_munki_mpkg_DEP.sh) DEP build script with the bootstrap option as an option to choose?
Hey are you planning to add support for notarization like the original Munki did a few weeks ago :)?
Here is what they added to the code to make it possible.
munki/munki#939
Thank you so much for you great work 👍
(I may write this myself but putting it here so I don't forget or someone else can write it first)
Instead of pulling munki down from git, it would be ideal if munki-rebrand could point to local code. This is useful if you have a fork/branch of munki.
The default build settings in Xcode 13 generates NIBArchives rather than binary Plists. This is touched on in the Xcode 13 Release Notes.
Storyboards and XIBs for macOS compile using UINibEncoder to reduce file sizes and improve runtime performance. When deploying an App before macOS 10.13, Xcode generates a backward compatible nib for the older OSes. You can opt out of this behavior by applying the IBC_COMPILER_USE_NIBKEYEDARCHIVER_FOR_MACOS=YES and IBSC_COMPILER_USE_NIBKEYEDARCHIVER_FOR_MACOS=YES user defined overrides in the project’s build setting. (31889616)
This means versions of Munki compiled with Xcode 13 or later cannot be rebranded.
The script fails on line 168 because the file type of the NIB is no longer a binary Plist and so cannot be converted to XML by plutil
.
cmd = [PLUTIL, "-convert", "xml1", plist]
Opting out of this behaviour by setting the two build settings referenced by Apple in the release notes above does fix the problem and generates NIB files that can be edited by munki-rebrand.
Munki-Rebrand does not work with Munki 3.1 (no problems with Munki 3.0.3):
Building customized Munki...
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Localize build/Managed\ Software\ Center.build/Release/Managed\ Software\ Center.build/Script-C09CE1D918BEA41000B9724A.sh
(1 failure)
Cleaning up...
Hi,
I've tried to integrate a postinstall.sh via the p parameter. But after creating the new package with munki_rebrand.py and executing the new package or after extracting the newly created package via pkgutil --expand there is no postinstall in the package inside.
sudo ./munki_rebrand.py -a 'Software Center' -k munkitools-4.0.0.3881.pkg -o youknow -p 'postinstall.sh'
content of postinstall.sh
#!/bin/bash
SETPREF="defaults write /Library/Preferences/ManagedInstalls"
$SETPREF SoftwareRepoURL https://munki.mydomain.com
$SETPREF ClientIdentifier selfservice
Kind Regards
Hi all,
I have the same issue on the original installer, so I wrote a script to download a choices.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>attributeSetting</key>
<integer>1</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>core</string>
</dict>
<dict>
<key>attributeSetting</key>
<integer>0</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>admin</string>
</dict>
<dict>
<key>attributeSetting</key>
<integer>1</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>app</string>
</dict>
<dict>
<key>attributeSetting</key>
<integer>1</integer>
<key>choiceAttribute</key>
<string>selected</string>
<key>choiceIdentifier</key>
<string>launchd</string>
</dict>
</array>
</plist>
And then call the installer command with these choices.
Is there any way I can do this from the postinstall script and call the launchctl for the daemons ?
While I happily codesign using my user, I’m not able to sucessfully codesign as root. As I need to run munki-rebrand with sudo, codesigning fails. How do I fix this?
I don't get any errors and it rebuilds the .pkg, but it's not renaming it or adding in the correct icon. Just curious if v3.1 is supported before I try to problem solve more. Thanks!
There are issues with both icon names changing and the way localisation files are used and encoded.
Hi, munki-rebrand 3.3 does not work with special characters like 'ü'.
Example:
sudo ./munki_rebrand.py --appname "Nüme"
Downloading munkitools from https://github.com/munki/munki/releases/download/v5.1.0/munkitools-5.1.0.4107.pkg...
Replacing app name with Nüme...
Traceback (most recent call last):
File "./munki_rebrand.py", line 622, in
main()
File "./munki_rebrand.py", line 544, in main
replace_strings(lfile, code, args.appname)
File "./munki_rebrand.py", line 251, in replace_strings
right = right.replace(localized, appname)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
Cleaning up...
Done.
This script is very helpful in the process of distribute Munki. I have however never been able to successfully notarize the pkg even with --sign-binaries and --sign-package
Log shows ex:
{
"severity": "error",
"code": null,
"path": "Munki-employees-city-v1_2-4.1.4.3949.pkg/munkitools_python-3.7.4.pkg Contents/Payload/usr/local/munki/Python.framework/Versions/3.7/Python",
"message": "The binary is not signed.",
"docUrl": null,
"architecture": "x86_64"
},
{
"severity": "error",
"code": null,
"path": "Munki-employees-city-v1_2-4.1.4.3949.pkg/munkitools_python-3.7.4.pkg Contents/Payload/usr/local/munki/Python.framework/Versions/3.7/Python",
"message": "The signature does not include a secure timestamp.",
"docUrl": null,
"architecture": "x86_64"
},
{
"severity": "error",
"code": null,
"path": "Munki-employees-city-v1_2-4.1.4.3949.pkg/munkitools_python-3.7.4.pkg Contents/Payload/usr/local/munki/Python.framework/Versions/3.7/bin/python3.7m",
"message": "The binary is not signed.",
"docUrl": null,
"architecture": "x86_64"
},
This one does successfully notarize: https://github.com/lifeunexpected/Scripts/blob/master/MunkiPythonNotarizeAndSign.zsh
Any tips on how to get the Munki-rebrand to successfully notarize with all binaries signed correctly?
Run command: sudo python ./munki_rebrand.py --appname Programvaresenter --sign-package Developer ID Installer: Firstname LastName (Developerid) --sign-binaries Developer ID Application: Firstname Lastname (Developerid) -p munki-city-employees.sh --output-file ./versjon_1_2/Munki-employees-city-v1_2
payload-script:
#!/bin/sh
sudo defaults write /Library/Preferences/ManagedInstalls SoftwareRepoURL "http://munki.organization.no/munki_repo"
sudo defaults write /Library/Preferences/ManagedInstalls ClientIdentifier City-Employees
I was testing munki_rebrand.py with Munki 3.0.0.3316. When Munki starts the macOS install process, it appears that the FileVault auth-restart dialog is not rebranded. It still tells "Managed Software Center wants to unlock the startup disk..." when I would expect it to tell "$my-rebranded-software-centre wants to unlock the startup disk..."
Happy new year fuzzylogiq.
Glad to see that Xcode is no longer required.
Unfortunately 2.0 does not work with (german) special characters like 'ü'.
Example:
munki-rebrand-2.0 $ sudo ./munki_rebrand.py --appname "Name"
Downloading munkitools from https://github.com/munki/munki/releases/download/v3.1.1/munkitools-3.1.1.3447.pkg...
Building output pkg at /Users/user/Documents/munki-rebrand-2.0/munkitools-3.1.1.3447.pkg...
Cleaning up...
Done.
munki-rebrand-2.0 $ sudo ./munki_rebrand.py --appname "Nüme"
Downloading munkitools from https://github.com/munki/munki/releases/download/v3.1.1/munkitools-3.1.1.3447.pkg...
Traceback (most recent call last):
File "./munki_rebrand.py", line 427, in
main()
File "./munki_rebrand.py", line 380, in main
replace_strings(lfile, code, args.appname)
File "./munki_rebrand.py", line 213, in replace_strings
right = right.replace(localized, appname)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
Cleaning up...
Done.
after an Installation over imagr (f.e.) the mac reboots. my custom munki with munki-reband is the reason. in your old Version, it was possible to deactivated. the argument -d is missing now.
Hi fuzzylogiq, nice to see an updated version. But munki-rebrand 3.0 does not work with special characters like 'ü'.
Example:
sudo ./munki_rebrand.py --appname "Name"
Downloading munkitools from https://github.com/munki/munki/releases/download/v3.6.0/munkitools-3.6.0.3733.pkg...
Replacing app name with Name...
Building output pkg at /Users/name/Documents/munki-rebrand-3.0/munkitools-3.6.0.3721.pkg...
Cleaning up...
Done.
sudo ./munki_rebrand.py --appname "Nüme"
Downloading munkitools from https://github.com/munki/munki/releases/download/v3.6.0/munkitools-3.6.0.3733.pkg...
Replacing app name with Nüme...
Traceback (most recent call last):
File "./munki_rebrand.py", line 518, in
main()
File "./munki_rebrand.py", line 456, in main
replace_strings(lfile, code, args.appname)
File "./munki_rebrand.py", line 239, in replace_strings
fw.write(line)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 23: ordinal not in range(128)
Cleaning up...
Done.
Using the most recently version of the script, ran the following from the command line:
sudo ~/Documents/GitHub/munki-rebrand/munki_rebrand.py --appname "MYORG Auto-Update" --pkg /Users/MYUSER/Downloads/munkitools-3.6.2.3776.pkg --icon-file "/Users/MYUSER/Downloads/OURORGICON.png" --sign-package "Developer ID Installer: OURORG (OURTEAMID)"
When installed on a machine running 10.14.6, I can see that Managed Software Center is correctly named with the specified --appname
. However, despite using our custom icon the app icon is still the standard MSC icon. I can see our icon in ./Contents/Resources/AppIcon.icns and using Suspicious Package confirm it's what it should be. Likewise, I see this icon in MunkiStatus as well, but the icon is also still the standard MSC icon.
More problematic is that at the loginwindow when MunkiStatus it runs, it shows the MSC icon and is titled "Managed Software Update" instead of our specified --appname
.
The Mac I used to build this is still on 10.12.6 (am going to try another machine on a more recent OS) and Xcode 9.2, and am not sure if this is contributing to the issues here. Wanted to report before I did additional testing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.