summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-04-09 18:00:23 -0400
committerScott Moser <smoser@ubuntu.com>2013-04-09 18:00:23 -0400
commit1c2adfa3835e031a0f946cef0d99fcfe3dfc1c95 (patch)
tree13018bc982ac82c24c819984f1ffa0c16971db3e /tools
parent0d3c21c53369673529301f2c4e23bdb7bae7495b (diff)
parent90a6bbda5c181569a969edb0d191d19b6110755b (diff)
downloadvyos-cloud-init-1c2adfa3835e031a0f946cef0d99fcfe3dfc1c95.tar.gz
vyos-cloud-init-1c2adfa3835e031a0f946cef0d99fcfe3dfc1c95.zip
tools: fix [some] shell quoting problems
There were problems with these tools if the path had a space. This should make these tools safe. There are others that still have problems.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-dist-tarball14
-rwxr-xr-xtools/make-tarball12
-rwxr-xr-xtools/read-dependencies8
-rwxr-xr-xtools/read-version4
4 files changed, 14 insertions, 24 deletions
diff --git a/tools/make-dist-tarball b/tools/make-dist-tarball
index 7742caea..5b078515 100755
--- a/tools/make-dist-tarball
+++ b/tools/make-dist-tarball
@@ -10,16 +10,12 @@ EOF
}
topdir="$PWD"
-tag=${1}
+tag="$1"
[ -n "$tag" ] || { Usage 1>&2 ; exit 1; }
-tmpd=$(mktemp -d );
-trap "rm -Rf '${tmpd}'" 0
+out="${topdir}/cloud-init-${tag}.tar.gz"
-out=${topdir}/cloud-init-${tag}.tar.gz
-
-cd ${tmpd} &&
- bzr branch -r "tag:${tag}" "${topdir}" ./cloud-init-${tag} &&
- tar czf "${out}" cloud-init-${tag}/ --exclude cloud-init-${tag}/.bzr &&
- echo "Wrote ${out}"
+bzr export --format=tgz --root="cloud-init-$tag" \
+ "--revision=tag:${tag}" "$out" "$topdir" &&
+ echo "Wrote ${out}"
diff --git a/tools/make-tarball b/tools/make-tarball
index 47979f5b..27f5f374 100755
--- a/tools/make-tarball
+++ b/tools/make-tarball
@@ -18,18 +18,16 @@ if ! find_root; then
exit 1;
fi
+REVNO=$(bzr revno "$ROOT_DIR")
+
if [ ! -z "$1" ]; then
ARCHIVE_FN="$1"
else
- REVNO=$(bzr revno $ROOT_DIR)
- VERSION=$($ROOT_DIR/tools/read-version)
+ VERSION=$("$ROOT_DIR/tools/read-version")
ARCHIVE_FN="$PWD/cloud-init-$VERSION~bzr$REVNO.tar.gz"
fi
-FILES=$(cd $ROOT_DIR && bzr ls --versioned --recursive)
-echo "$FILES" | tar czf $ARCHIVE_FN \
- -C "$ROOT_DIR" \
- --transform "s,^,cloud-init-$VERSION~bzr$REVNO/," \
- --no-recursion --files-from -
+bzr export --format=tgz --root="cloud-init-$VERSION~bzr$REVNO" \
+ "--revision=${REVNO}" "${ARCHIVE_FN}" "$ROOT_DIR"
echo "$ARCHIVE_FN"
diff --git a/tools/read-dependencies b/tools/read-dependencies
index 4c88aa87..cadb09a8 100755
--- a/tools/read-dependencies
+++ b/tools/read-dependencies
@@ -21,15 +21,11 @@ fi
REQUIRES="$ROOT_DIR/Requires"
-if [ ! -e "$REQUIRES" ]
-then
+if [ ! -e "$REQUIRES" ]; then
echo "Unable to find 'Requires' file located at $REQUIRES"
exit 1
fi
# Filter out comments and empty liens
-DEPS=$(cat $REQUIRES | grep -Pv "^\s*#" | grep -Pv '^\s*$')
+DEPS=$(grep -Pv "^\s*#" "$REQUIRES" | grep -Pv '^\s*$')
echo "$DEPS" | sort -d -f
-
-
-
diff --git a/tools/read-version b/tools/read-version
index 323357fe..c76b24a9 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -27,5 +27,5 @@ then
exit 1
fi
-VERSION=$(grep -P "\d+.\d+.\d+:" $CHNG_LOG | cut -f1 -d ":" | head -n 1)
-echo $VERSION
+VERSION=$(grep -P "\d+.\d+.\d+:" "$CHNG_LOG" | cut -f1 -d ":" | head -n 1)
+echo "$VERSION"