Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Goftrey

macrumors 68000
Original poster
May 20, 2011
1,853
75
Wales, UK
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?
 
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.
 
Command;

1_zps7b29efb6.jpg


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;

Picture1_zps265900ea.png


Any ideas?
 
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.
 
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.

Tried that - it's definitely an improvement (so thank you!) but it still visibly open the terminal app & spits a process window.

pic_zps90324e35.jpg
 
Tried that - it's definitely an improvement (so thank you!) but it still visibly open the terminal app & spits a process window.

Image

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.
 
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.

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.
 
Sorry, I'm not going to install Flash for that.

Please post descriptions and/or screenshots.

Screens: Before, during & post installation.
 

Attachments

  • Picture 1.png
    Picture 1.png
    312.3 KB · Views: 275
  • Picture 2.png
    Picture 2.png
    266.6 KB · Views: 291
  • Picture 3.png
    Picture 3.png
    269 KB · Views: 280
  • Picture 4.png
    Picture 4.png
    260.4 KB · Views: 346
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.
 
Have you tried to name the script "postinstall"? There seems to be specific names that packagemaker recognizes.

From the man page:

If the environment-test scripts allow the installation to proceed, Installer performs the installation scripts and the installs the payload in the following order:

preflight
preinstall or preupgrade
Payload installation
postinstall or postupgrade
postflight
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.