I found one solution. It is not very nice because each included script should contain couple lines of code, but it works.
This link was helpful
http://stackoverflow.com/questions/5...-its-stored-in
finally I added following code to each included file:
Code:
SOURCE="${BASH_SOURCE[0]}"
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
And I am doing this kind of stuff in the config.in:
Code:
#!/bin/bash
function find_current_script_dir()
{
SOURCE="${BASH_SOURCE[0]}"
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
done
echo "$( cd -P "$( dirname "$SOURCE" )" && pwd )"
}
LFS_BUILD_CONFIG_SCRIPTS_DIR="$(find_current_script_dir)"
source $LFS_BUILD_CONFIG_SCRIPTS_DIR/output_messages.in
source $LFS_BUILD_CONFIG_SCRIPTS_DIR/error_handling.in
source $LFS_BUILD_CONFIG_SCRIPTS_DIR/paths.in
and in similar way I included output_messages.in in error_handling.in