Enterprise Bundling with Menu Icon Packs

Got a problem with Viscosity or need help? Ask here!

citizenkepler

Posts: 2
Joined: Wed Dec 15, 2021 7:45 am

Post by citizenkepler » Wed Dec 15, 2021 10:53 am
When I build the Enterprise Installer from the following guide, it works as expected.

https://www.sparklabs.com/support/kb/ar ... ences-mac/

As soon as I add my MenuBar icons to the Viscosity.app with the following steps, I encounter an issue

Create a Menu icon pack such as Custom.ViscosityMenuIcons
Right-click or control-click on Viscosity and select "Show Package Contents"
Open the Contents folder, and then the Resources folder
Find the Menu Icons folder and open it
From the Edit menu select "Paste Item" to copy Custom.ViscosityMenuIcons into this folder
Reopen Viscosity and set the menu icon under Preferences->Appearance

When I do this after the Viscosity helper is installed the Viscosity.app displays the icons and the App functions normally. However when I put that custom Viscosity.app into the Viscosity directory and create the installer, the installed Viscosity.app fails to launch.

After the installer runs with the Viscosity.app with the Custom Menu Icons I get the following error:
Code: Select all
Viscosity was unable to install or upgrade its helper tools and must now quit. Please ensure that Viscosity has been correctly installed and isn't being blocked by any security software, and then reopen Viscosity to try again.
Error: Code signature on update bundle is invalid
If I remove the Custom Menu Icons the installer installs a version of the Viscosity.app that launches correctly.

This is Viscosity 1.10.1
This is MacOS 12.0.1
Attachments
Screen Shot 2021-12-14 at 2.52.18 PM.jpg
Screen Shot 2021-12-14 at 2.52.18 PM.jpg (124.09 KiB) Viewed 3345 times

James

User avatar
Posts: 2313
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Wed Dec 15, 2021 2:08 pm
Hi citizenkepler,

It sounds likely you've come across an old post on the forums with those instructions - sadly it hasn't been possible to include custom menu icons in such a fashion for many years thanks to Apple's code signing rules changes. Modifying Viscosity's application bundle in any way will break the code signature, causing Gatekeeper warnings, and helper validation to fail.

Viscosity's icon bundle format has also changed over the years. While the original format will still be loaded, it doesn't properly support newer macOS menu bar behaviour (such as adjusting the light/dark mode, adjusting the the desktop picture behind the menu bar, reacting to different monitor behaviours, etc.).

So I'm afraid bundling Viscosity with custom menu icon packs is no longer something that Viscosity supports.

Cheers,
James
Web: https://www.sparklabs.com
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs

citizenkepler

Posts: 2
Joined: Wed Dec 15, 2021 7:45 am

Post by citizenkepler » Thu Dec 16, 2021 9:39 am
While I was unable to bundle the Menu Icons, I did achieve a workaround to accomplish this. With an AppleScript to launch a shell script to install them after the app has been installed and launched for the first time.

In the following folder, I created three things /Preconfigure/MenuItems/Install Menu Icons.viscositymenuitem/

1) A folder of Icons to install
2) action.scpt - An Applescript to launch the shell script that installs the icons
3) install_script.sh - A script to install these things



The apple script
Code: Select all
display dialog "Icon Installer
 -=================-
 
Is it currently acceptable to disconnect you from the VPN?

To install the Menu Icons, we will need to restart the VPN Client. After the VPN client restarts, you will need to re-connect manually.  Is it ok to disconnect you from the VPN if you are connected?" 

display dialog "We will launch a terminal window to install the menu icons, and apple security will let you know. You will be asked to provide your account password in the terminal window to install the icons. " buttons {"I'm ready for the terminal password action"} 

set InstallPrompt to "clear;echo VPN Menu Icon Installer; echo  -=================- ; echo ;echo Please provide your account password to install the Menu Icons.;echo"
set InstallScript to "~/Library/Application\\ Support/Viscosity/MenuItems/Install\\ Menu\\ Icons.viscositymenuitem/install_script.sh"
tell application "Terminal"
	activate
	do script InstallPrompt & " ; sudo " & InstallScript
end tell
The shell script
Code: Select all
#!/bin/bash
echo "Installing Menu Icons"
sudo cp -r ~/Library/'Application Support'/Viscosity/MenuItems/'Install Menu Icons'.viscositymenuitem/MenuIcons/* /Applications/'Viscosity.app'/Contents/Resources/'Menu Icons'/
echo " - Menu Icons Installed"
sudo rm -rf ~/Library/'Application Support'/Viscosity/MenuItems/'Install Menu Icons'.viscositymenuitem &> /dev/null
echo " - Removed Menu Icon Installer option"
pkill Viscosity
echo " - Closed Brainium VPN Client"
defaults write com.viscosityvpn.Viscosity MenuBarIcons -string "Custom Colored"
echo " - Set Menu Icon to Custom Colored"
open /Applications/Viscosity\ VPN.app/
echo " - Launched VPN Client"
echo "----------------------------"
echo "Install is complete.  It's safe to close this window"

As an enterprise user, being able to rebrand the installer is a nice feature. The Enterprise bundler is what sold us for a site license. It would be nice if MenuIcons were handled like MenuItems, where the MenuItems are stored in /Library/Application Support/Viscosity/MenuItems. If MenuIcons had a search location of /Library/'Application Support'/Viscosity/MenuIcons in addition to the Application Directory they could be bundled in the installer far easier.
3 posts Page 1 of 1