summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorJonathan Boyett <jonathan@failingservers.com>2010-12-03 12:35:23 -0800
committerJonathan Boyett <jonathan@failingservers.com>2010-12-03 12:35:23 -0800
commitfa80fc2b311b689c41b4ee2913f6bfb9f7c159c6 (patch)
tree9d383a8fe4dfb9ab140794ffb3d1c60b2dc165e6 /files
parent40245d9fccf1c2baa18fcc745e0f1f11d4b0db81 (diff)
add a -g flag to concatfragments.sh to disable GNU extensions to find, sort and xargs; makes concat work on Solaris.
Add a $gnu parameter to make use of the aforementioned -g flag, and a $order parameter to make use of the -n flag in concatfragments.sh
Diffstat (limited to 'files')
-rw-r--r--files/concatfragments.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/files/concatfragments.sh b/files/concatfragments.sh
index b486047..6ae4d83 100644
--- a/files/concatfragments.sh
+++ b/files/concatfragments.sh
@@ -26,6 +26,7 @@
# 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:
#
@@ -43,7 +44,10 @@ WORKDIR=""
TEST=""
FORCE=""
WARN=""
-SORTARG="-z"
+SORT1="-z"
+SORT2=""
+FINDARG="-print0"
+XARGSARG="-0"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
@@ -51,15 +55,18 @@ while getopts "o:s:d:tnw:f" options; do
case $options in
o ) OUTFILE=$OPTARG;;
d ) WORKDIR=$OPTARG;;
- n ) SORTARG="-zn";;
+ n ) SORT2="-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"
@@ -108,7 +115,7 @@ 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 -print0 |sort ${SORTARG}|xargs -0 cat >>"fragments.concat"
+find fragments/ -type f -follow $FINDARG |sort ${SORTARG}|xargs $XARGSARG cat >>"fragments.concat"
if [ x${TEST} = "x" ]; then
# This is a real run, copy the file to outfile