summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-06-28 09:48:21 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-06-28 09:48:21 +0200
commitedb24eb1a0c0b862d4c2c7d8c9f7dbc7d2ba877b (patch)
tree3684a72e80ec800e4d02cd525772a6911dd1a5c9
parenta2132bc899d5a3780ca0bb4caff289b70c954c14 (diff)
Simplify detection of changelog and install files
Thise code was copied from makepkg
-rwxr-xr-xmakechrootpkg36
1 files 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"