Skip to content

Commit

Permalink
check basedir first. make sure the config check is basedir aware
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed May 8, 2011
1 parent 81fa8bf commit c8b5677
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions geninit
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,19 @@ readonly NC BOLD BLUE GREEN RED YELLOW
## sanity checks ##
# ----------------- #

# if specified, does the basedir exist? trim any trailing slash
if [[ $basedir ]]; then
basedir=${basedir%/}

# if $basedir still exists (some noodle noggin might use -b /), make sure the
# dir can be resolved
[[ $basedir && ! -d $basedir ]] && die "basedir \`$basedir' not found"
fi

# make sure our config exists, and source it
config=${config:-$baseconfig}
[[ ! -f $basedir$config ]] && die "failed to find config file: \`$basedir$config'" || . "$basedir$config"

# declared as an array to force expansion. we have to be careful that the wrong
# linker isn't picked for mulitlib systems, so we branch on $carch.
case $carch in
Expand All @@ -479,19 +492,6 @@ if (( ${#ld_so[*]} != 1 )); then # uh oh...
die "failed to resolve the location of /lib/ld.so. Please report this bug."
fi

# make sure our config exists, and source it
config=${config:-$baseconfig}
[[ ! -f $config ]] && die "failed to find config file: \`$config'" || . "$config"

# if specified, does the basedir exist? trim any trailing slash
if [[ $basedir ]]; then
basedir=${basedir%/}

# if $basedir still exists (some noodle noggin might use -b /), make sure the
# dir can be resolved
[[ $basedir && ! -d $basedir ]] && die "basedir \`$basedir' not found"
fi

# mktemp takes care of our error handling here
tmpdir=$(readlink -e "$(mktemp -d "${otmpdir:-/tmp}"/${0##*/}.XXXXXX)") || cleanup 1

Expand Down

0 comments on commit c8b5677

Please sign in to comment.