summaryrefslogtreecommitdiff
path: root/omnibus/package-scripts/push-jobs-client/postinst
diff options
context:
space:
mode:
authorYvonne Lam <yvonne@opscode.com>2015-09-21 15:21:28 -0700
committerYvonne Lam <yvonne@opscode.com>2015-09-21 15:21:28 -0700
commit1d0d8a7f0cc95225eaac29379894502c2cac9407 (patch)
treefcb433feb5c1791effab02b9e0d4df5cdf2ba4d5 /omnibus/package-scripts/push-jobs-client/postinst
parent538af753efff8493b71ee49f06f314701ce2523e (diff)
downloadchef-1d0d8a7f0cc95225eaac29379894502c2cac9407.tar.gz
Set up omnibus build.yzl/ES-437
Diffstat (limited to 'omnibus/package-scripts/push-jobs-client/postinst')
-rwxr-xr-xomnibus/package-scripts/push-jobs-client/postinst55
1 files changed, 55 insertions, 0 deletions
diff --git a/omnibus/package-scripts/push-jobs-client/postinst b/omnibus/package-scripts/push-jobs-client/postinst
new file mode 100755
index 0000000000..66e58ae368
--- /dev/null
+++ b/omnibus/package-scripts/push-jobs-client/postinst
@@ -0,0 +1,55 @@
+#!/bin/sh
+# WARNING: REQUIRES /bin/sh
+#
+# Post install configuration for Push Jobs Client
+#
+
+PROGNAME=`basename $0`
+INSTALLER_DIR=/opt/push-jobs-client
+
+error_exit()
+{
+ echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
+ exit 1
+}
+
+is_darwin()
+{
+ uname -v | grep "^Darwin" 2>&1 >/dev/null
+}
+
+is_smartos()
+{
+ uname -v | grep "^joyent" 2>&1 >/dev/null
+}
+
+if is_smartos; then
+ PREFIX="/opt/local"
+elif is_darwin; then
+ PREFIX="/usr/local"
+ mkdir -p "$PREFIX/bin"
+else
+ PREFIX="/usr"
+fi
+
+# We test for the presence of /usr/bin/push-client to know if this script succeeds,
+# so push-client must appear as the last item here.
+binaries="pushy-client"
+
+# rm -f before ln -sf is required for solaris 9
+for binary in $binaries; do
+ rm -f $PREFIX/bin/$binary
+done
+
+for binary in $binaries; do
+ ln -sf $INSTALLER_DIR/bin/$binary $PREFIX/bin || error_exit "Cannot link $binary to $PREFIX/bin"
+done
+
+# Ensure all files/directories in $INSTALLER_DIR are owned by root. This
+# has been fixed on new installs but upgrades from old installs need to
+# be manually fixed.
+chown -Rh 0:0 $INSTALLER_DIR
+
+echo "Thank you for installing Chef Push Jobs Client!"
+
+exit 0