diff options
author | Mihai Moldovan <ionic@ionic.de> | 2015-04-26 23:45:42 +0200 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2015-04-26 23:45:42 +0200 |
commit | e68c36625d9d76d96ebe0d94ba02803bee574783 (patch) | |
tree | 0deb9161063baa2d73872b3d2f324b28ddd69a17 /debian/roll-tarballs.sh | |
parent | f2fd794161fbb87b8b2e4ddc49e2777d82bbdd10 (diff) | |
download | nx-libs-e68c36625d9d76d96ebe0d94ba02803bee574783.tar.gz nx-libs-e68c36625d9d76d96ebe0d94ba02803bee574783.tar.bz2 nx-libs-e68c36625d9d76d96ebe0d94ba02803bee574783.zip |
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.)
Diffstat (limited to 'debian/roll-tarballs.sh')
-rwxr-xr-x | debian/roll-tarballs.sh | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/debian/roll-tarballs.sh b/debian/roll-tarballs.sh index c7cac5f08..c2819cfc8 100755 --- a/debian/roll-tarballs.sh +++ b/debian/roll-tarballs.sh @@ -33,7 +33,7 @@ usage() { PROJECT="nx-libs" NULL="" -test -d .git || usage +test -d ".git" || usage RELEASE="$1" test -n "${RELEASE}" || usage CHECKOUT="$2" @@ -52,14 +52,14 @@ else fi if [ x"$RELEASE" == "xHEAD" ]; then - CHECKOUT=HEAD + CHECKOUT="HEAD" fi 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 " Please specify one of the following releases:" echo "HEAD" - git tag -l | grep ^redist | cut -f2 -d/ | sort -u + git tag -l | grep "^redist" | cut -f2 -d"/" | sort -u exit 1 fi @@ -71,42 +71,42 @@ TEMP_DIR="$(mktemp -d)" trap "rm -f \"${MANIFEST}\"; rm -rf \"${TEMP_DIR}\"" 0 # 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" cd "$TEMP_DIR/${PROJECT}-${RELEASE}/" -mkdir -p doc/applied-patches +mkdir -p "doc/applied-patches" # prepare patches for lite and full tarball 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 - cp -v debian/patches/$file doc/applied-patches - echo ${file##*/} >> doc/applied-patches/series + cp -v "debian/patches/$file" "doc/applied-patches/" + echo "${file##*/}" >> "doc/applied-patches/series" done else rm -Rf "nxcompshad"* rm -Rf "nxcompext"* 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 - cp -v debian/patches/$file doc/applied-patches - echo ${file##*/} >> doc/applied-patches/series + cp -v "debian/patches/$file" "doc/applied-patches/" + echo "${file##*/}" >> "doc/applied-patches/series" done fi # 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 - 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 echo "No patches applied at all. Very old release?" fi # very old release did not add any README for f in $(ls README* 2>/dev/null); do - mv -v $f doc/; + mv -v "$f" "doc/"; done # remove folders that we do not want to roll into the tarball @@ -116,7 +116,7 @@ rm -Rf "debian/" # remove files, that we do not want in the tarballs (build cruft) rm -Rf nx*/configure nx*/autom4te.cache* -cd $OLDPWD +cd "$OLDPWD" # create target location for tarball mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/" @@ -124,7 +124,7 @@ mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/" # roll the ball... cd "$TEMP_DIR" find "${PROJECT}-${RELEASE}" -type f | sort > "$MANIFEST" -cd $OLDPWD +cd "$OLDPWD" tar c -C "$TEMP_DIR" \ --owner 0 \ |