Modify relative paths of lib, elements for packaging

(Based on review https://review.openstack.org/#/c/36009)

Scripts test for existence of ../share/diskimage-builder and
fall-back to ../ if not found. This allows scripts to run unmodified
from a packaged installation or a local archive/repository.

Change-Id: I0cf4c1fdb8e42ec284c56860cb15818632b93b9e
This commit is contained in:
Jeff Peeler 2013-07-30 14:23:31 -04:00 committed by Steve Baker
parent 5a69fa879e
commit 87fb533979
3 changed files with 16 additions and 3 deletions

View File

@ -27,7 +27,13 @@ export DIB_ENV=$(export)
SCRIPTNAME=$(basename $0) SCRIPTNAME=$(basename $0)
SCRIPT_HOME=$(dirname $0) SCRIPT_HOME=$(dirname $0)
export _LIB=$(dirname $0)/../lib if [ -d $SCRIPT_HOME/../share/diskimage-builder ]
then
export _PREFIX=$SCRIPT_HOME/../share/diskimage-builder
else
export _PREFIX=$SCRIPT_HOME/..
fi
export _LIB=$_PREFIX/lib
source $_LIB/die source $_LIB/die
IS_RAMDISK=0 IS_RAMDISK=0

View File

@ -18,7 +18,14 @@
set -e set -e
SCRIPTNAME=$(basename $0) SCRIPTNAME=$(basename $0)
export _LIB=$(dirname $0)/../lib SCRIPT_HOME=$(dirname $0)
if [ -d $SCRIPT_HOME/../share/diskimage-builder ]
then
export _PREFIX=$SCRIPT_HOME/../share/diskimage-builder
else
export _PREFIX=$SCRIPT_HOME/..
fi
export _LIB=$_PREFIX/lib
source $_LIB/die source $_LIB/die
function show_options () { function show_options () {

View File

@ -36,7 +36,7 @@ export ARCH
export DIB_NO_TMPFS=${DIB_NO_TMPFS:-0} export DIB_NO_TMPFS=${DIB_NO_TMPFS:-0}
# Set via the CLI normally. # Set via the CLI normally.
# IMAGE_ELEMENT= # IMAGE_ELEMENT=
_BASE_ELEMENT_DIR=$(dirname $0)/../elements _BASE_ELEMENT_DIR=$_PREFIX/elements
ELEMENTS_PATH=${ELEMENTS_PATH:+"$ELEMENTS_PATH:$_BASE_ELEMENT_DIR"} ELEMENTS_PATH=${ELEMENTS_PATH:+"$ELEMENTS_PATH:$_BASE_ELEMENT_DIR"}
export ELEMENTS_PATH=${ELEMENTS_PATH:-$_BASE_ELEMENT_DIR} export ELEMENTS_PATH=${ELEMENTS_PATH:-$_BASE_ELEMENT_DIR}
export DIB_OFFLINE=${DIB_OFFLINE:-''} export DIB_OFFLINE=${DIB_OFFLINE:-''}