Fix annoying bug in file installation

This commit is contained in:
Laurence Withers 2007-02-05 13:49:17 +00:00
parent dfdd180b0d
commit 28de5c8aaa
1 changed files with 6 additions and 5 deletions

View File

@ -178,7 +178,8 @@ build_dir_tree_recurse() {
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
build_dir_tree_recurse $(dirname "${DIR}") || return 1 build_dir_tree_recurse $(dirname "${DIR}") || return 1
mkdir "${DIR}" echo " Creating directory '${DIR}'"
do_cmd mkdir "${DIR}"
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
print_failure "Failed to create directory '${DIR}'" print_failure "Failed to create directory '${DIR}'"
@ -198,9 +199,9 @@ build_dir_tree_recurse() {
install_file() { install_file() {
# figure out if $2 is a directory or not # figure out if $2 is a directory or not
DEST_FILE="${INSTALL_PREFIX}$2" DEST_FILE="${INSTALL_PREFIX}$2"
[ -d "$2" ] && DEST_FILE="${INSTALL_PREFIX}$2/$(basename $1)" [ -d "${DEST_FILE}" ] && DEST_FILE="${INSTALL_PREFIX}$2/$(basename $1)"
echo " Installing: '$1' -> '$2'" echo " Installing: '$1' -> '${DESTFILE}'"
do_cmd cp -fP "$1" "${DEST_FILE}" || return 1 do_cmd cp -fP "$1" "${DEST_FILE}" || return 1
do_cmd chmod "$3" "${DEST_FILE}" || return 1 do_cmd chmod "$3" "${DEST_FILE}" || return 1
@ -213,9 +214,9 @@ install_file() {
# install_file(), only we strip out the #line directives. # install_file(), only we strip out the #line directives.
install_header() { install_header() {
DEST_FILE="${INSTALL_PREFIX}$2" DEST_FILE="${INSTALL_PREFIX}$2"
[ -d "$2" ] && DEST_FILE="${INSTALL_PREFIX}$2/$(basename $1)" [ -d "${DEST_FILE}" ] && DEST_FILE="${INSTALL_PREFIX}$2/$(basename $1)"
echo " Installing header: '$1' -> '$2'" echo " Installing: '$1' -> '${DESTFILE}'"
do_cmd rm -f ${DEST_FILE} || exit 1 do_cmd rm -f ${DEST_FILE} || exit 1
do_cmd_redir ${DEST_FILE} sed -e "s,^#line.*,," $1 || exit 1 do_cmd_redir ${DEST_FILE} sed -e "s,^#line.*,," $1 || exit 1
do_cmd chmod "$3" "${DEST_FILE}" || return 1 do_cmd chmod "$3" "${DEST_FILE}" || return 1