Package Maker with Post Install Script

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

  1. macrumors member

    Joined:
    Jul 3, 2008
    #1
    Hello,
    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?




    Thanks.
     
  2. macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #2
    You want to delete the files in the user's home directory on install?!?!

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

    Joined:
    Jul 3, 2008
    #3
    oh,
    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.



    Thanks.
     
  4. thread starter macrumors member

    Joined:
    Jul 3, 2008
    #4
    Its giving me following error while installing:

    Code:
    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

    iSee

    Joined:
    Oct 25, 2004
    #5
    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. thread starter macrumors member

    Joined:
    Jul 3, 2008
    #6
    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.


    Thanks,
     
  7. macrumors newbie

    Joined:
    Aug 19, 2009
  8. macrumors newbie

    Joined:
    Nov 24, 2008
    #8
    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

    Joined:
    Aug 24, 2011
    #9
    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

    Joined:
    Oct 13, 2007
    #10
    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