Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created December 9, 2022 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/635154d73b18273bc64c21be45074b96 to your computer and use it in GitHub Desktop.
Save rtrouton/635154d73b18273bc64c21be45074b96 to your computer and use it in GitHub Desktop.
<?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">
<dict>
<key>Description</key>
<string>Downloads the current release version of the Global Protect VPN client and builds an installer package which enables the Global Protect system extension.</string>
<key>Identifier</key>
<string>com.company.pkg.GlobalProtect.systemextension</string>
<key>Input</key>
<dict>
<key>NAME</key>
<string>GlobalProtect</string>
<key>VENDOR</key>
<string>PaloAlto</string>
<key>SOFTWARETITLE1</key>
<string>GlobalProtect</string>
<key>SOFTWARETITLE2</key>
<string>System</string>
<key>SOFTWARETITLE3</key>
<string>Extension</string>
<key>SOFTWARETITLE4</key>
<string>Enabler</string>
</dict>
<key>MinimumVersion</key>
<string>1.0.0</string>
<key>ParentRecipe</key>
<string>com.company.download.GlobalProtect</string>
<key>Process</key>
<array>
<dict>
<key>Arguments</key>
<dict>
<key>destination_path</key>
<string>%RECIPE_CACHE_DIR%/unpack</string>
<key>flat_pkg_path</key>
<string>%pathname%</string>
</dict>
<key>Processor</key>
<string>FlatPkgUnpacker</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>pattern</key>
<string>%RECIPE_CACHE_DIR%/unpack/*gp.pkg</string>
</dict>
<key>Processor</key>
<string>FileFinder</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>destination_path</key>
<string>%RECIPE_CACHE_DIR%/payload/GlobalProtect.app</string>
<key>pkg_payload_path</key>
<string>%found_filename%/Payload</string>
</dict>
<key>Processor</key>
<string>PkgPayloadUnpacker</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>input_plist_path</key>
<string>%RECIPE_CACHE_DIR%/payload/GlobalProtect.app/Contents/Info.plist</string>
<key>plist_version_key</key>
<string>CFBundleShortVersionString</string>
</dict>
<key>Processor</key>
<string>Versioner</string>
</dict>
<dict>
<key>Processor</key>
<string>PkgRootCreator</string>
<key>Arguments</key>
<dict>
<key>pkgroot</key>
<string>%RECIPE_CACHE_DIR%/pkgroot</string>
<key>pkgdirs</key>
<dict>
<key>Scripts</key>
<string>0755</string>
</dict>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>FileMover</string>
<key>Arguments</key>
<dict>
<key>source</key>
<string>%RECIPE_CACHE_DIR%/pkgroot/Scripts</string>
<key>target</key>
<string>%RECIPE_CACHE_DIR%/Scripts</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>PkgCopier</string>
<key>Arguments</key>
<dict>
<key>source_pkg</key>
<string>%pathname%</string>
<key>pkg_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/GlobalProtect.pkg</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>FileCreator</string>
<key>Arguments</key>
<dict>
<key>file_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/install_system_extensions.xml</string>
<key>file_mode</key>
<string>0755</string>
<key>file_content</key>
<string>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;array&gt;
&lt;dict&gt;
&lt;key&gt;attributeSetting&lt;/key&gt;
&lt;integer&gt;1&lt;/integer&gt;
&lt;key&gt;choiceAttribute&lt;/key&gt;
&lt;string&gt;selected&lt;/string&gt;
&lt;key&gt;choiceIdentifier&lt;/key&gt;
&lt;string&gt;third&lt;/string&gt;
&lt;/dict&gt;
&lt;dict&gt;
&lt;key&gt;attributeSetting&lt;/key&gt;
&lt;integer&gt;1&lt;/integer&gt;
&lt;key&gt;choiceAttribute&lt;/key&gt;
&lt;string&gt;selected&lt;/string&gt;
&lt;key&gt;choiceIdentifier&lt;/key&gt;
&lt;string&gt;com.paloaltonetworks.globalprotect.systemext.pkg&lt;/string&gt;
&lt;/dict&gt;
&lt;/array&gt;
&lt;/plist&gt;</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>FileCreator</string>
<key>Arguments</key>
<dict>
<key>file_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/postinstall</string>
<key>file_mode</key>
<string>0755</string>
<key>file_content</key>
<string>#!/bin/bash
PKG="${0%/*}/GlobalProtect.pkg"
ChoiceChangesXMLFile="${0%/*}/install_system_extensions.xml"
ERROR=0
if [[ -f "$PKG" ]]; then
/usr/sbin/installer -pkg "$PKG" -applyChoiceChangesXML "$ChoiceChangesXMLFile" -target "$3"
if [[ $? -ne 0 ]]; then
/usr/bin/logger -t "${0##*/}" "ERROR! Installation of package $PKG failed"
ERROR=1
fi
else
/usr/bin/logger -t "${0##*/}" "ERROR! Package $PKG not found"
ERROR=1
fi
exit $ERROR</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>PkgCreator</string>
<key>Arguments</key>
<dict>
<key>pkg_request</key>
<dict>
<key>pkgroot</key>
<string>%RECIPE_CACHE_DIR%/pkgroot</string>
<key>pkgname</key>
<string>%VENDOR%_%SOFTWARETITLE1%_%SOFTWARETITLE2%_%SOFTWARETITLE3%_%SOFTWARETITLE4%_%version%</string>
<key>pkgtype</key>
<string>flat</string>
<key>id</key>
<string>com.company.GlobalProtectSystemExtensionEnable.pkg</string>
<key>options</key>
<string>purge_ds_store</string>
<key>scripts</key>
<string>Scripts</string>
<key>version</key>
<string>%version%</string>
</dict>
</dict>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>path_list</key>
<array>
<string>%RECIPE_CACHE_DIR%/pkgroot</string>
<string>%RECIPE_CACHE_DIR%/payload</string>
<string>%RECIPE_CACHE_DIR%/Scripts</string>
<string>%RECIPE_CACHE_DIR%/unpack</string>
</array>
</dict>
<key>Processor</key>
<string>PathDeleter</string>
</dict>
</array>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment