Use readlink to get script path

So we can support usage:
ln -s ~/source/.../disk-image-create ~/bin/

Change-Id: Id54b613a247679b98cef3e9a6f37cd93155d029e
This commit is contained in:
JUNJIE NAN 2014-07-10 15:40:11 +00:00
parent 4e97def3d5
commit d65b37fb03

View File

@ -25,7 +25,7 @@ export DIB_ARGS="$@"
export DIB_ENV=$(export | grep ' DIB_.*=') export DIB_ENV=$(export | grep ' DIB_.*=')
SCRIPTNAME=$(basename $0) SCRIPTNAME=$(basename $0)
SCRIPT_HOME=$(dirname $0) SCRIPT_HOME=$(dirname $(readlink -f $0))
if [ -d $SCRIPT_HOME/../share/diskimage-builder ]; then if [ -d $SCRIPT_HOME/../share/diskimage-builder ]; then
export _PREFIX=$SCRIPT_HOME/../share/diskimage-builder export _PREFIX=$SCRIPT_HOME/../share/diskimage-builder
else else