Commit e68c3662 authored by Mihai Moldovan's avatar Mihai Moldovan

debian/roll-tarballs.sh: use more quotes.

Fixes potential bugs, including one triggered by an unquoted hash within the command line. BASH accepts this. Other shells do not (i.e., treat everything following the hash character as a comment.)
parent f2fd7941
...@@ -33,7 +33,7 @@ usage() { ...@@ -33,7 +33,7 @@ usage() {
PROJECT="nx-libs" PROJECT="nx-libs"
NULL="" NULL=""
test -d .git || usage test -d ".git" || usage
RELEASE="$1" RELEASE="$1"
test -n "${RELEASE}" || usage test -n "${RELEASE}" || usage
CHECKOUT="$2" CHECKOUT="$2"
...@@ -52,14 +52,14 @@ else ...@@ -52,14 +52,14 @@ else
fi fi
if [ x"$RELEASE" == "xHEAD" ]; then if [ x"$RELEASE" == "xHEAD" ]; then
CHECKOUT=HEAD CHECKOUT="HEAD"
fi fi
if ! git rev-parse --verify -q "$CHECKOUT" >/dev/null; then if ! git rev-parse --verify -q "$CHECKOUT" >/dev/null; then
echo " '${RELEASE}' is not a valid release number because there is no git tag named $CHECKOUT." echo " '${RELEASE}' is not a valid release number because there is no git tag named $CHECKOUT."
echo " Please specify one of the following releases:" echo " Please specify one of the following releases:"
echo "HEAD" echo "HEAD"
git tag -l | grep ^redist | cut -f2 -d/ | sort -u git tag -l | grep "^redist" | cut -f2 -d"/" | sort -u
exit 1 exit 1
fi fi
...@@ -71,42 +71,42 @@ TEMP_DIR="$(mktemp -d)" ...@@ -71,42 +71,42 @@ TEMP_DIR="$(mktemp -d)"
trap "rm -f \"${MANIFEST}\"; rm -rf \"${TEMP_DIR}\"" 0 trap "rm -f \"${MANIFEST}\"; rm -rf \"${TEMP_DIR}\"" 0
# create local copy of Git project at temp location # create local copy of Git project at temp location
git archive --format=tar ${CHECKOUT} --prefix=${PROJECT}-${RELEASE}/ | ( cd $TEMP_DIR; tar xf - ) git archive --format=tar "${CHECKOUT}" --prefix="${PROJECT}-${RELEASE}/" | ( cd "$TEMP_DIR"; tar xf - )
echo "Created tarball for $CHECKOUT" echo "Created tarball for $CHECKOUT"
cd "$TEMP_DIR/${PROJECT}-${RELEASE}/" cd "$TEMP_DIR/${PROJECT}-${RELEASE}/"
mkdir -p doc/applied-patches mkdir -p "doc/applied-patches"
# prepare patches for lite and full tarball # prepare patches for lite and full tarball
if [ "x$MODE" = "xfull" ]; then if [ "x$MODE" = "xfull" ]; then
cat debian/patches/series | sort | grep -v ^# | egrep "([0-9]+_.*\.(full|full\+lite)\.patch)" | while read file cat "debian/patches/series" | sort | grep -v '^#' | egrep "([0-9]+_.*\.(full|full\+lite)\.patch)" | while read file
do do
cp -v debian/patches/$file doc/applied-patches cp -v "debian/patches/$file" "doc/applied-patches/"
echo ${file##*/} >> doc/applied-patches/series echo "${file##*/}" >> "doc/applied-patches/series"
done done
else else
rm -Rf "nxcompshad"* rm -Rf "nxcompshad"*
rm -Rf "nxcompext"* rm -Rf "nxcompext"*
rm -Rf "nx-X11"* rm -Rf "nx-X11"*
cat debian/patches/series | sort | grep -v ^# | egrep "([0-9]+_.*\.full\+lite\.patch)" | while read file cat "debian/patches/series" | sort | grep -v '^#' | egrep "([0-9]+_.*\.full\+lite\.patch)" | while read file
do do
cp -v debian/patches/$file doc/applied-patches cp -v "debian/patches/$file" "doc/applied-patches/"
echo ${file##*/} >> doc/applied-patches/series echo "${file##*/}" >> "doc/applied-patches/series"
done done
fi fi
# apply all patches shipped in debian/patches and create a copy of them that we ship with the tarball # apply all patches shipped in debian/patches and create a copy of them that we ship with the tarball
if [ -s "doc/applied-patches/series" ]; then if [ -s "doc/applied-patches/series" ]; then
QUILT_PATCHES=doc/applied-patches quilt --quiltrc /dev/null push -a -q QUILT_PATCHES="doc/applied-patches" quilt --quiltrc /dev/null push -a -q
else else
echo "No patches applied at all. Very old release?" echo "No patches applied at all. Very old release?"
fi fi
# very old release did not add any README # very old release did not add any README
for f in $(ls README* 2>/dev/null); do for f in $(ls README* 2>/dev/null); do
mv -v $f doc/; mv -v "$f" "doc/";
done done
# remove folders that we do not want to roll into the tarball # remove folders that we do not want to roll into the tarball
...@@ -116,7 +116,7 @@ rm -Rf "debian/" ...@@ -116,7 +116,7 @@ rm -Rf "debian/"
# remove files, that we do not want in the tarballs (build cruft) # remove files, that we do not want in the tarballs (build cruft)
rm -Rf nx*/configure nx*/autom4te.cache* rm -Rf nx*/configure nx*/autom4te.cache*
cd $OLDPWD cd "$OLDPWD"
# create target location for tarball # create target location for tarball
mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/" mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/"
...@@ -124,7 +124,7 @@ mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/" ...@@ -124,7 +124,7 @@ mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/"
# roll the ball... # roll the ball...
cd "$TEMP_DIR" cd "$TEMP_DIR"
find "${PROJECT}-${RELEASE}" -type f | sort > "$MANIFEST" find "${PROJECT}-${RELEASE}" -type f | sort > "$MANIFEST"
cd $OLDPWD cd "$OLDPWD"
tar c -C "$TEMP_DIR" \ tar c -C "$TEMP_DIR" \
--owner 0 \ --owner 0 \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment