Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a installer from package maker and scripts I specified scripts directory and postinstall script. When I installs the package it application installs fine but the scripts I specified is not running. Somewhere I read executable bit must be set but I did not find from to set this bit.

Following is the is my script. In this I am setting path variables in plist. Please guide me on this..

#!/bin/bash    
FILE=~/.MacOSX/environment.plist
PLIST=/usr/libexec/PlistBuddy

# if the file doesn't exist, try to create folder
if [ ! -f $FILE ]
then
  mkdir -p ~/.MacOSX
fi

# then just add entries (file will be created if it doesn't exist)
$PLIST -c "Add :Variable1 string 'Value1'" $FILE
$PLIST -c "Add :Variable2 string 'Value2'" $FILE
echo "Ended" >> ok.txt
exit 0

enter image description here

share|improve this question
    
Can you execute the script directly in Terminal by entering its full path? – Daniel Beck May 28 '11 at 16:26
up vote 1 down vote accepted

Open Terminal and enter the following:

chmod +x /Users/sandy/Resource/PostInstall.sh

This will set the executable flag on the file.

share|improve this answer
1  
Also, it's good practice to use #!/usr/bin/env bash instead of hard-coding the path to bash. – Daniel Beck May 28 '11 at 16:22
    
Sorry, blame that on me :) – slhck May 28 '11 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .