summaryrefslogtreecommitdiff
path: root/files/concatfragments.sh
diff options
context:
space:
mode:
Diffstat (limited to 'files/concatfragments.sh')
-rwxr-xr-xfiles/concatfragments.sh17
1 files changed, 6 insertions, 11 deletions
diff --git a/files/concatfragments.sh b/files/concatfragments.sh
index a761b7e..c939797 100755
--- a/files/concatfragments.sh
+++ b/files/concatfragments.sh
@@ -26,7 +26,6 @@
# is generated by puppet
# -f Enables the creation of empty output files when no fragments are found
# -n Sort the output numerically rather than the default alpha sort
-# -g Do NOT use the GNU entensions to find, xargs and sort; might cause problems on suitably funky filenames
#
# the command:
#
@@ -44,10 +43,7 @@ WORKDIR=""
TEST=""
FORCE=""
WARN=""
-SORT1="-z"
-SORT2=""
-FINDARG="-print0"
-XARGSARG="-0"
+SORTARG=""
PATH=/sbin:/usr/sbin:/bin:/usr/bin
@@ -55,22 +51,19 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
## http://nexenta.org/projects/site/wiki/Personalities
unset SUN_PERSONALITY
-while getopts "o:s:d:tnw:fg" options; do
+while getopts "o:s:d:tnw:f" options; do
case $options in
o ) OUTFILE=$OPTARG;;
d ) WORKDIR=$OPTARG;;
- n ) SORT2="-n";;
+ n ) SORTARG="-n";;
w ) WARNMSG="$OPTARG";;
f ) FORCE="true";;
t ) TEST="true";;
- g ) FINDARG="" ; XARGSARG="" ; SORT1="" ;;
* ) echo "Specify output file with -o and fragments directory with -d"
exit 1;;
esac
done
-SORTARG="$SORT1 $SORT2"
-
# do we have -o?
if [ x${OUTFILE} = "x" ]; then
echo "Please specify an output file with -o"
@@ -119,7 +112,9 @@ else
fi
# find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir
-find fragments/ -type f -follow $FINDARG |sort ${SORTARG}|xargs $XARGSARG cat >>"fragments.concat"
+find fragments/ -type f -follow | sort ${SORTARG} | while read fragfile; do
+ cat "$fragfile" >> "fragments.concat"
+done
if [ x${TEST} = "x" ]; then
# This is a real run, copy the file to outfile