Skip to content

Instantly share code, notes, and snippets.

@grahampugh
Created March 29, 2019 14:46
Show Gist options
  • Save grahampugh/7fb73372424cdb0d980f406f0570a2ce to your computer and use it in GitHub Desktop.
Save grahampugh/7fb73372424cdb0d980f406f0570a2ce to your computer and use it in GitHub Desktop.
AutoPkg recipe for packaging up SPSSStatistics with a Network License
<?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 latest version of SPSSStatistics and creates a package.</string>
<key>Identifier</key>
<string>com.github.grahampugh.recipes.pkg.SPSSStatisticsFloating</string>
<key>Input</key>
<dict>
<key>FLOATING_LICENSE_URL</key>
<string>lic-spss.example.com</string>
<key>LICENSE</key>
<string>Floating</string>
<key>MAJOR_VERSION</key>
<string>25</string>
<key>NAME</key>
<string>SPSSStatistics</string>
</dict>
<key>MinimumVersion</key>
<string>1.0.0</string>
<key>Process</key>
<array>
<dict>
<key>Arguments</key>
<dict>
<key>pkgdirs</key>
<dict>
</dict>
<key>pkgroot</key>
<string>%RECIPE_CACHE_DIR%/Scripts</string>
</dict>
<key>Processor</key>
<string>PkgRootCreator</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>pkgdirs</key>
<dict>
</dict>
<key>pkgroot</key>
<string>%RECIPE_CACHE_DIR%/pkgroot</string>
</dict>
<key>Processor</key>
<string>PkgRootCreator</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>destination_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/SPSS_Statistics_Installer.bin</string>
<key>source_path</key>
<string>%pathname%/SPSS_Statistics_Installer.bin</string>
</dict>
<key>Processor</key>
<string>Copier</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>destination_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/installer.properties</string>
<key>source_path</key>
<string>%pathname%/installer.properties</string>
</dict>
<key>Processor</key>
<string>Copier</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>file_content</key>
<string>[Language]
SPSSLanguage=en
[Product]
CommonRoot=/Applications/IBM/SPSS/Statistics/%MAJOR_VERSION%/SPSSStatistics.app/Contents/common
StartJVMAtStartup=no
CustomerName=ladmin
VersionMinor=0
VersionPatch=0
Version=%MAJOR_VERSION%.0.0.0
DaemonHost=%FLOATING_LICENSE_URL%
LicenseVersion=7
Organization=
PreferencesRoot=Statistics
ProductName=IBM SPSS Statistics %MAJOR_VERSION%
ProductNickName=IBM SPSS Statistics
VersionMajor=%MAJOR_VERSION%
FeatureCode=1200
Copyright=Copyright (c) IBM Corp. 1989, 2014.
CommuterMaxLife=7
</string>
<key>file_mode</key>
<string>0755</string>
<key>file_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/spssprod.inf</string>
</dict>
<key>Processor</key>
<string>FileCreator</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>file_content</key>
<string>#!/bin/bash
## script to install SPSS %MAJOR_VERSION% %LICENSE%
scriptsdir=$(dirname "$0")
# Installer will fail but report success if Java not already present
# so need to check for this
if ! /usr/libexec/java_home -X &gt; /dev/null 2&gt;&amp;1; then
echo "Java not present but is required for SPSS installation. Cannot proceed"
exit 1
fi
# Edit installer.properties to make it a floating license
perl -pi -e 's|^single=(.*)|#single=$1|' $scriptsdir/installer.properties
perl -pi -e 's|^#network(.*)|network=1|' $scriptsdir/installer.properties
perl -pi -e 's|^AUTHCODE=.*|###AUTHCODE=None|' $scriptsdir/installer.properties
perl -pi -e 's|^LSHOST=.*|LSHOST=%FLOATING_LICENSE_URL%|' $scriptsdir/installer.properties
# run the installer
echo "Running SPSS base installer"
/bin/chmod a+x $scriptsdir/SPSS_Statistics_Installer.bin
$scriptsdir/SPSS_Statistics_Installer.bin -f $scriptsdir/installer.properties 2&gt;&amp;1
# copy license info file
echo "Copying spssprod.inf"
/bin/cp $scriptsdir/spssprod.inf /Applications/IBM/SPSS/Statistics/%MAJOR_VERSION%/SPSSStatistics.app/Contents/bin/spssprod.inf
# unblock SPSS in the firewall
echo "Unblocking SPSS in Application Firewall"
/usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /Applications/IBM/SPSS/Statistics/%MAJOR_VERSION%/SPSSStatistics.app/Contents/MacOS/spssLauncher
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/IBM/SPSS/Statistics/%MAJOR_VERSION%/SPSSStatistics.app/Contents/MacOS/spssLauncher
</string>
<key>file_mode</key>
<string>0755</string>
<key>file_path</key>
<string>%RECIPE_CACHE_DIR%/Scripts/postinstall</string>
</dict>
<key>Processor</key>
<string>FileCreator</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
<key>force_pkg_build</key>
<true/>
<key>pkg_request</key>
<dict>
<key>chown</key>
<array>
</array>
<key>id</key>
<string>com.ibm.%NAME%%MAJOR_VERSION%%LICENSE%</string>
<key>pkgname</key>
<string>%NAME%-%MAJOR_VERSION%-%LICENSE%-%version%</string>
<key>pkgroot</key>
<string>%RECIPE_CACHE_DIR%/pkgroot</string>
<key>pkgtype</key>
<string>flat</string>
<key>scripts</key>
<string>Scripts</string>
<key>version</key>
<string>%version%</string>
</dict>
</dict>
<key>Processor</key>
<string>PkgCreator</string>
</dict>
</array>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment