1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Package Maker with Post Install Script

Discussion in 'Mac Programming' started by xmax, Mar 16, 2009.

  1. macrumors member

    I have written one script to delete the files from Users home directory if exist.
    And I have added that script to post-Install script when i am making package for my application.
    The Application is not installing and i am getting error "Installation failed".
    And if I removed the part of Post-installation script and I again installed application. It installed successfully. but i was not able to see my application in destination directory.

    Now I am not able to install any package made by me.
    I am always getting one warning that is ".app is word writable".how can i resolve this warning.
    So, what do i need to take care while setting post installation scripts ?

    And If there exist my application in applications directory and i want to uninstall that application then what is the procedure to make uninstaller?

  2. macrumors 68040


    You want to delete the files in the user's home directory on install?!?!

    What would be the legitimate purpose of that?
  3. macrumors member

    I just missed to mention.
    The file that is stored as com.mycompany.product name from Preferences.
    And One directory named as product name stored in Library/Application Support folder.

    That is the purpose only.

  4. macrumors member

    Its giving me following error while installing:

    Mar 16 19:12:05 pc-00075 /private/tmp/scripts.97LF/./postinstall[2155]: /private/tmp/scripts.97LF/__Installer_Script_Springboard__: line 13: /private/tmp/scripts.97LF/./postinstall: cannot execute binary file
    Mar 16 19:12:05 pc-00075 Installer[2145]: Install failed: The following install step failed: run postupgrade script for emptyapp. Contact the software manufacturer for assistance.
    Mar 16 19:12:05 pc-00075 Installer[2145]: Displaying 'Install Failed' UI.
    Mar 16 19:12:05 pc-00075 Installer[2145]: 'Install Failed' UI displayed message:'The following install step failed: run postupgrade script for emptyapp. Contact the software manufacturer for assistance.'.
  5. macrumors 68040


    Is the execute bit set on the script? And are the permissions correct?
    Also, can you post the script itself, or at least the first few lines?
  6. macrumors member

    I research on it and i came to know that i need to make Postflight Scripts.
    I don't understand how to make it and include in package maker.

  7. macrumors newbie

    I'm very interested! I would love to find out more.
    script install
  8. macrumors newbie

    Re: Package Maker with Post Install Script

    I too had the need for deleting a temp folder (after the installation) created by me in user's home directory. I used shell script to do "rm -rf" and set it as postinstall script in package maker. I kept getting the error for installation failure.

    I changed the script to perl and run "rm -rf" with the function system() and set it as postinstall script in package maker. It solved my problem. :)
    I still do not know why did shell script not work.
  9. macrumors 6502

    Just so people know in the future, the two main reasons I see people's scripts not working is because they either forgot to include the all-important "#!/bin/sh" (chaithrika's problem I believe) or equivalent, or the execute bit isn't set via "chmod +x script.sh" (OP's problem).
  10. macrumors 6502a

    As a long-term sys-admin I can say with some authority that almost every time you need to do something like this it is because you are wrongly trying to cover up mistakes made in other parts of software development in the installer. This is almost always a bad move, and will just lead to more problem.

    If you installer needs to clean up temporary items created durring install, then you are doing the install wrong, and need to re-evaluate the situation that got you to that point. Trying to hack your way out of it is the wrong approach, and will just cause massive problem later.

    My position is that only sys-admins should create installers that have install scripts. That is people directly responsible for the computers that will run the installers should ever do this. That is because those are the same people who are going to be accountable for cleaning up the mess when it goes wrong (and it will).

Share This Page