0

This is probably really simple, but currently I've been writing installer packages for OSX.

As of now, I was just writing things using specified paths that were always set (I.E /Users//Shared) But I'd like for these to run anywhere as long as the files are in the same directory.

Here is what I've been trying:

pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`
popd > /dev/null

BASEDIR="$( dirname "$0" )"

dmgpath=$(cd "${0%/*}" && echo $PWD

All three of the above are different variations I've tried. I've found most of these here but none seem to work, not sure what I'm doing wrong. Here is a sample of actual code I'm working with:

dmgpath=$(cd "${0%/*}" && echo $PWD)

cp $dmgpath/<install>.plist /Library/Preferences
installer -pkg $dmgpath/<Install.pkg> -target /
shutdown -r now

I've tried a few things, but keep getting the same error return "path resolved to null value" or "directory not found", "command not found". I've tried placing "" around areas where I'm using the variable, but no go. Most of the scripts are like that.

First time posting here, but I've always found most threads to be super helpful! Thanks in advance!

bojaste
  • 9
  • 2

0 Answers0