How To Hide Terminal Windows While Executing A Command?

Discussion in 'Mac Programming' started by Goftrey, Sep 26, 2013.

  1. Goftrey macrumors 68000

    Goftrey

    Joined:
    May 20, 2011
    Location:
    Wales, UK
    #1
    I'm in the midst of putting together an iOS 7 inspired theme & need to add a little script that changes the dock from 2D to 3D or vice-versa.

    I've got the scripts themselves working with no problems whatsoever. I'm using PackageMaker to put the .mpkg together & am using the scripts at the postinstall stage. However, as the installer is doing it's thing & get's to the postinstall stage - the scripts open up the Terminal app & are just a bit of a nuisance to be honest with you. My OCD kicked in & am looking for a way to hide these windows & have the installer knock them off in the background. Is this possible?
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    What language are you writing the post-install scripts in?

    If it's AppleScript, then use the 'do shell script' command.

    If it's something else, then please explain exactly what you're doing. Post the actual post-install script, and point to the place where you tell Terminal to run a command or script that reconfigures the Dock.
     
  3. Goftrey thread starter macrumors 68000

    Goftrey

    Joined:
    May 20, 2011
    Location:
    Wales, UK
    #3
    Command;

    [​IMG]

    That's runs w/ the installer. The 'yes' changes to a 'no' with the uninstaller. Simple enough.

    And this is what the (un)installer looks like;

    [​IMG]

    Any ideas?
     
  4. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    The 2d.command file is run by Terminal because its suffix is ".command".

    If you change the suffix to nothing at all, and you make the file executable, then it should run as a plain shell script. It should automatically run /bin/sh because the file starts with #!/bin/sh.

    To make the file executable, use this command in Terminal:
    Code:
    chmod a+x 2d.command
    
    The 2d.command file must be in your home folder first.
     
  5. Goftrey thread starter macrumors 68000

    Goftrey

    Joined:
    May 20, 2011
    Location:
    Wales, UK
    #5
    Tried that - it's definitely an improvement (so thank you!) but it still visibly open the terminal app & spits a process window.

    [​IMG]
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    What's the improvement? Please explain what improved.

    Please describe exactly how you're running this script. Show exactly where it is in the post-install configuration of PackageMaker. We need to see how the target script is invoked.
     
  7. Goftrey thread starter macrumors 68000

    Goftrey

    Joined:
    May 20, 2011
    Location:
    Wales, UK
    #7
    That's my mind playing tricks on me. I thought it cleaned up the directory but no, the pic above is just an instance is which I was using a short(er) directory than before. Forget I said that. It's no different to the .command - still opens up terminal and completest he process.

    Video going through where the command is kept & how it acts in the installer.
     
  8. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #8
    Sorry, I'm not going to install Flash for that.

    Please post descriptions and/or screenshots.
     
  9. Goftrey thread starter macrumors 68000

    Goftrey

    Joined:
    May 20, 2011
    Location:
    Wales, UK
    #9
    Screens: Before, during & post installation.
     

    Attached Files:

  10. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #10
    Those are Installer screenshots. I asked to see where the post-installer script is in PackageMaker. I need to see how you're making the .mpkg and exactly how the post-install script is being invoked (with PackageMaker). I don't need to see the result of running it (with Installer).

    If this were just a shell script, I'm asking to post your code, not to see the results of running the code.
     
  11. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #11
    Have you tried to name the script "postinstall"? There seems to be specific names that packagemaker recognizes.

    From the man page:

     

Share This Page