From 498c6565c66c2ce3af0fab56ecfd5f08e01dc23b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 15 Jan 2008 21:21:02 +0000 Subject: [PATCH] Copying source directories to the image was broken, when building from the root of the source tree. Added a work-around that should fix the problem. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23544 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/scripts/build_haiku_image | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/build/scripts/build_haiku_image b/build/scripts/build_haiku_image index 7e61f6f6b7..a3a8597887 100755 --- a/build/scripts/build_haiku_image +++ b/build/scripts/build_haiku_image @@ -184,19 +184,29 @@ if [ -n "${sourceDirsToCopy}" ]; then $mkdir -p ${sourcesDest} fi +# When building in the root of the source directory, sourceDir is "." and +# the source directory are not prefixed, which breaks the sed expressions +# used below. We work around, by adjusting the strings to match and insert. +sourcePathPrefix=$sourceDir +destPathPrefix=$sourcesDest +if [ $sourcePathPrefix = "." ]; then + sourcePathPrefix="" + destPathPrefix="${sourcesDest}/" +fi + for sourcesDir in ${sourceDirsToCopy}; do echo " sources dir: ${sourcesDir}" # create all subdirectories subDirs=$(find ${sourcesDir} -type d | grep -v '.svn' | - sed -e "s@^${sourceDir}@${sourcesDest}@") + sed -e "s@^${sourcePathPrefix}@${destPathPrefix}@") $mkdir -p ${subDirs} - + # get all files and copy each one individually sourceFiles=$(find $sourcesDir -type f | grep -v '.svn') for sourceFile in $sourceFiles; do destSourceFile=$(echo $sourceFile | - sed -e "s@^${sourceDir}@${sourcesDest}@") + sed -e "s@^${sourcePathPrefix}@${destPathPrefix}@") $cp ${sPrefix}$sourceFile $destSourceFile done done