Ensure correct root_dir for dotfile being parsed

This commit is contained in:
2013-07-01 12:20:11 +02:00
parent 94131770b9
commit b42f3c0938

View File

@@ -34,11 +34,11 @@ create-symlink() {
} }
execute-dotfile() { execute-dotfile() {
ROOTDIR="$(dirname "$DOTFILE")"
parse-dotfile-options parse-dotfile-options
local root_dir="$(dirname "$DOTFILE")"
local cwd="$(pwd)" local cwd="$(pwd)"
cd "$rootdir" cd "$root_dir"
create-symlink "$root_dir" "$TARGET/$OPT_ROOT_LINK" create-symlink "$root_dir" "$TARGET/$OPT_ROOT_LINK"
if [ -n "$?" ]; then return 1; fi if [ -n "$?" ]; then return 1; fi
@@ -103,9 +103,10 @@ parse-dotfile-line() {
include-dotfile() { include-dotfile() {
local dotfile="$1" local dotfile="$1"
local root_dir="$(dirname "$dotfile")"
local cwd="$(pwd)" local cwd="$(pwd)"
cd "$rootdir" cd "$root_dir"
if [ ! -f "$dotfile" ]; then if [ ! -f "$dotfile" ]; then
echo "ERROR: Can not include \"$dotfile\", it does not exist." >&2 echo "ERROR: Can not include \"$dotfile\", it does not exist." >&2