Skip to content

Instantly share code, notes, and snippets.

@timsutton
Created May 3, 2013 16:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsutton/5510343 to your computer and use it in GitHub Desktop.
Save timsutton/5510343 to your computer and use it in GitHub Desktop.
repackaging script for SPSS 21 using FPM
#!/bin/sh
# Create a package for SPSS's silent installer using FPM. We do this because the "silent"
# installer requires a user to be logged in so that the Java installer will run. It
# has only been tested with version 21. FPM is just a convenience here - substituting
# pkgbuild will work if you create a pkg root structure yourself.
#
# It requires one argument, the path to the .bin silent installer.
#
# Configure VERSION, ID_PREFIX, INSTALL_DIR to your liking. We set INSTALL_DIR to its
# real package location rather than a temp area, because it sets up various links in some
# of the application's own helper scripts.
VERSION=21
NAME=SPSSStatistics
ID_PREFIX=org.my.great
INSTALL_DIR=/Applications/SPSS
BINFILE="$1"
PREFIX=/tmp/SPSS
PROPFILE="$PREFIX/installer.properties"
mkdir "$PREFIX"
sudo gem update --system
sudo gem install fpm --no-ri --no-rdoc
# The installer.properties does a poor job of parsing double quotes, FWIW
echo "INSTALLER_UI=silent" > "$PROPFILE"
echo "USER_INSTALL_DIR=$INSTALL_DIR" >> "$PROPFILE"
echo "LICENSE_ACCEPTED=true" >> "$PROPFILE"
echo "network=1" >> "$PROPFILE"
echo "LSHOST=spss.license.server" >> "$PROPFILE"
echo "COMPANYNAME=MyGreatOrg" >> "$PROPFILE"
#cd "$PREFIX"
# Run the installer. It doesn't seem to care that we set INSTALLER_UI, so we
# force it with the undocumented -i flag and set LAX_DEBUG so we actually get
# something logged
export LAX_DEBUG=1
"$BINFILE" -i silent -f "$PROPFILE"
# Fix permissions on root folder
sudo chmod -R 755 "$INSTALL_DIR"
fpm \
-s dir \
-t osxpkg \
-C "$INSTALL_DIR" \
--name "$NAME" \
--version "$VERSION" \
--osxpkg-identifier-prefix "$ID_PREFIX" \
--prefix ${INSTALL_DIR} \
.
# Clean up
rm "$PREFIX/installer.properties"
sudo rm -rf "$INSTALL_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment