Posted on 08-02-2022 10:33 AM
We are starting to use Figma and their installer is a stub installer which is a pain. They give some very base instructions for deployment. We want to use architecture specific builds and there is a "script" for accessing those. My scripting is very basic and I need a little help with getting the resent version acquired from one command into the argument for the download command. I can run them individually without issue manually replacing the latest_version with the "latest_version"
here are the commands provided.
latest_version=$(curl -fsSL "https://desktop.figma.com/mac/version.txt")
intel_url="https://desktop.figma.com/mac/Figma-${latest_version}.zip"
apple_silicon_url="https://desktop.figma.com/mac-arm/Figma-${latest_version}.zip"
I'm missing how to get what is echoed for latest_version into the curl for each architecture. This is what I tried without success.
echo latest_version=$(curl -fsSL "https://desktop.figma.com/mac/version.txt") | curl -O -k https://desktop.figma.com/mac/Figma-${latest_version}.zip
Any pointers for the right direction are appreciated.
Posted on 08-03-2022 12:59 AM
personally I just use DataJAR's autopkg recipe for Figma as it will create a installer with both architectures in a single pkg which can be used with Jamf, Munki etc.. for deployment
https://github.com/autopkg/dataJAR-recipes/tree/master/Figma
Posted on 08-03-2022 06:15 AM
I saw the post title in the post list and had exactly the same thought.
Posted on 08-03-2022 06:23 AM
Thanks for the pointer. I was thinking the script might save some packaging when there is a update. Using Auto pkg is a good place to start, I will check out that recipe.
08-03-2022 08:25 AM - edited 08-04-2022 04:46 AM
If you're still interested in a script to download the architecture specific versions of apps, you can use this as a guide. This one handles .zip files. If you are trying to download apps that come in .dmgs, the process is similar but you have to add code for handling the dmg.
#!/bin/bash
# hardware architecture check. Possible answers are "arm" or "i386"
CPU=$(uname -p)
echo "hardware architecture is $CPU . Installing $CPU version of Figma"
latest_version=$(curl -fsSL "https://desktop.figma.com/mac/version.txt")
apple_silicon_url="https://desktop.figma.com/mac-arm/Figma-${latest_version}.zip"
intel_url="https://desktop.figma.com/mac/Figma-${latest_version}.zip"
if [[ -e /Applications/Figma.app ]]; then
rm -Rf /Applications/Figma.app/
else
echo "Figma is not present"
fi
# arm64 installation
arm_install()
{
curl -L $apple_silicon_url > /Users/Shared/Figma-${latest_version}.zip
unzip /Users/Shared/Figma-${latest_version}.zip -d /Applications/
sleep 3
rm -Rf /Users/Shared/Figma-${latest_version}.zip
}
# intel installation
intel_install()
{
curl -L $intel_url > /Users/Shared/Figma-${latest_version}.zip
unzip /Users/Shared/Figma-${latest_version}.zip -d /Applications/
sleep 3
rm -Rf /Users/Shared/Figma-${latest_version}.zip
}
if [ "$CPU" == arm ]
then arm_install
else intel_install
fi
echo "Finished installing $CPU version of Figma"
exit 0
Posted on 01-18-2023 07:41 AM
How this script will work if Figma is running. How I will kill the process. I create a package via .dmg with composer but now it is not working after upgrade to Ventura. it is getting Figma desktop app is corrupted. But workaround if we rightclick on the icon from dock and then click open that start working and this need to do only 1st time, which is wired. any suggestion.
Posted on 01-18-2023 09:29 AM
You can get highly detailed in how to kill the Figma app, but the simplest way I have found is to add
killall Figma
right before the
# arm64 installation
section of the script. If Figma isn't running, the command will just fail silently. If Figma is running, it will kill the process and make for a safe install.
Posted on 08-04-2022 10:15 AM
Thanks for that, wish I was better at scripting. I will report back which direction we go once it is implemented.
Posted on 01-19-2023 08:37 AM
The way I deploy
1. Download the latest version as .dmg
2. Copy that .app to application folder and package through composer
3. change the ownership of the app
4. Add a script to kill running app
5. Deploy through policy that resolve the issue.