Closed subnetmarco closed 9 years ago
I have further debugged this manually, and it seems like removing the --after-install
argument will make it work. I will keep debugging the issue and understand why --after-install
doesn't work on OS X. The script that I am running might be wrong.
The after script seems to be right, but it still doesn't work. I have found a workaround and I'm not using the --after-install
anymore. No idea why it doesn't work on OS X.
Hmm, weird. Thanks for doing some debugging! Can you show your --after-install script?
I'm able to reproduce, I think:
% fpm -s empty --after-install =(printf "#\!/bin/sh\nhello world\n") -n fizz -t osxpkg
Created package {:path=>"fizz-1.0.pkg"}
% sudo installer -pkg fizz-1.0.pkg -target /
installer: Package name is fizz-1.0
installer: Installing at base path /
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
Oops, haha, I had a typo. It was failing because it tried to run "Hello" as a command. Silly me!
Here's trying it myself, and having it work:
# I used --debug and --debug-workspace to help me see what is going on
% fpm -f --debug --debug-workspace -s empty --after-install =(printf "#\!/bin/sh\necho hello world\n") -n fizz -t osxpkg
...
Created package {:path=>"fizz-1.0.pkg", :file=>"clamp/command.rb", :line=>"67", :method=>"run"}
% sudo installer -pkg fizz-1.0.pkg -target /
installer: Package name is fizz-1.0
installer: Upgrading at base path /
installer: The upgrade was successful.
My script basically creates a folder in etc
and moves a file into it:
# Make the package
post_install_script=$(mktemp -t post_install_script.XXX.sh)
echo "mkdir -p /etc/kong;cp /usr/local/lib/luarocks/rocks/kong/$KONG_VERSION/conf/kong.yml /etc/kong/kong.yml" > $post_install_script
cd $OUT
fpm -a all -f -s dir -t $PACKAGE_TYPE -n "kong" -v ${KONG_VERSION} ${FPM_PARAMS} \
--iteration 1 \
--description 'Kong is an open distributed platform for your APIs, focused on high performance and reliability.' \
--vendor Mashape \
--license MIT \
--url http://getkong.org/ \
--after-install $post_install_script \
usr
While the verbose output of installer
seems ... not awesome, I think we can try debugging this. We'll need to unpack the .pkg file:
# Unpack the .pkg file:
% mkdir /tmp/pkg
% xar -x -f fizz-1.0.pkg -C /tmp/pkg
# Unpack the scripts:
% gzip -dc /tmp/pkg/Scripts | (cd /tmp/pkg; cpio -iv)
# Run the postinstall script manually:
% /tmp/pkg/postinstall
hello world
Try repeating this with your package, see what happens when you run your script?
I suspect, based on your previous comment including your build step, that the post_install_script.XXX.sh
is missing a #!/bin/sh
header on the first line, so when OSX executes it, it doesn't know what to do, though that's just a hunch.
A missing #!/bin/sh
was the problem indeed. Thanks.
I have created an OS X package, but when trying to install it I get the following error:
This is the script: https://gist.github.com/thefosk/d17a3acf0eb22aaf4eca (which works fine for
deb
andrpm
packages)Basically the script detects the operating system and if ran on OS X it will generate a
pkg
with the following software:The problem occurs when trying to install the
pkg
on OS X 10.10, specifically at theValidating packages
phase:Here is the output with
-verboseR
: