From 3c497e638e83f97981912f6c13e964088c68e26c Mon Sep 17 00:00:00 2001 From: Sam Hegarty Date: Sun, 15 Sep 2013 09:37:39 +1200 Subject: [PATCH] Use a combination of find xargs and read to prevent file/dir name problems. --- packaging/linux/rpm/buildpackage.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packaging/linux/rpm/buildpackage.sh b/packaging/linux/rpm/buildpackage.sh index 86c188a666..ad287cfce9 100755 --- a/packaging/linux/rpm/buildpackage.sh +++ b/packaging/linux/rpm/buildpackage.sh @@ -14,26 +14,28 @@ rootdir=`readlink -f $2` sed -i "s|{ROOT_DIR}|$rootdir|" openra.spec # List files to avoid owning standard dirs. -for x in `find $rootdir/usr/bin -type f` +find $rootdir/usr/bin -type f -print0 | xargs -0 -n 1 echo | while read x do y="${x#$rootdir}" sed -i "/%files/ a ${y}" openra.spec done -for x in `find $rootdir/usr/share/icons -type f` +find $rootdir/usr/share/icons -type f -print0 | xargs -0 -n 1 echo | while read x do y="${x#$rootdir}" sed -i "/%files/ a ${y}" openra.spec done -for x in `find $rootdir/usr/share/applications -type f` +find $rootdir/usr/share/applications -type f -print0 | \ + xargs -0 -n 1 echo | \ + while read x do y="${x#$rootdir}" sed -i "/%files/ a ${y}" openra.spec done -# List directories only to avoid spam and problems with files containing spaces. -for x in `find $rootdir/usr/share/openra -type d` +# List directories only to avoid spam +find $rootdir/usr/share/openra -type d -print0 | xargs -0 -n 1 echo | while read x do y="${x#$rootdir}" sed -i "/%files/ a ${y}" openra.spec