From edb24eb1a0c0b862d4c2c7d8c9f7dbc7d2ba877b Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 28 Jun 2010 09:48:21 +0200 Subject: Simplify detection of changelog and install files Thise code was copied from makepkg --- makechrootpkg | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/makechrootpkg b/makechrootpkg index b54ad81..a20f92a 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -163,32 +163,16 @@ for f in ${source[@]}; do fi done -install_files=$(grep 'install=' PKGBUILD) -for pkg in ${pkgname[@]}; do - install_files+=' ' - install_files+=$(echo $install_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/") - install_files=$(eval echo $install_files |tr '[:blank:]' '\n'|sort |uniq) -done - -for f in $install_files;do - install="${f#"install="}" - if [ "$install" != "" -a -f "$install" ]; then - cp "$install" "$copydir/build/" - fi -done - -changelog_files=$(grep 'changelog=' PKGBUILD) -for pkg in ${pkgname[@]}; do - changelog_files+=' ' - changelog_files+=$(echo $changelog_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/") - changelog_files=$(eval echo $changelog_files |tr '[:blank:]' '\n'|sort |uniq) -done - -for f in $changelog_files;do - changelog="${f#"changelog="}" - if [ "$changelog" != "" -a -f "$changelog" ]; then - cp "$changelog" "$copydir/build/" - fi +for i in 'changelog' 'install'; do + local filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + local file + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [[ -f "$file" ]]; then + cp "$file" "$copydir/build/" + fi + done done chown -R nobody "$copydir/build" -- cgit v1.2.3-70-g09d2