From patchwork Thu Jul 26 09:34:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/6] auto-packager: Add mktar.sh to make the release tarball Date: Wed, 25 Jul 2012 23:34:57 -0000 From: Keng-Yu Lin X-Patchwork-Id: 173382 Message-Id: <1343295300-17440-4-git-send-email-kengyu@canonical.com> To: fwts-devel@lists.ubuntu.com The script makes the tarball for release and generate the checksum. Signed-off-by: Keng-Yu Lin Acked-by: Colin Ian King Acked-by: Ivan Hu --- auto-packager/mktar.sh | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100755 auto-packager/mktar.sh diff --git a/auto-packager/mktar.sh b/auto-packager/mktar.sh new file mode 100755 index 0000000..364ab12 --- /dev/null +++ b/auto-packager/mktar.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +# +# Copyright (C) 2010-2012 Canonical +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + + +# +# Get fwts sources, strip out .git directory, add in necessary debian packaging +# files, build source package ready for upload. +# +REPO=git://kernel.ubuntu.com/hwe/fwts.git +FWTS=fwts + +# +# Clone the repo +# +get_source() +{ + echo "Getting source" + pushd "$version" >& /dev/null + git clone $REPO + popd >& /dev/null +} + +# +# Checkout version +# +checkout_version() +{ + echo "Checking out version" + pushd "$version/$FWTS" >& /dev/null + git checkout -b latest $version + popd >& /dev/null +} + +# +# Remove the source +# +rm_source() +{ + rm -rf "$version/$FWTS" +} + +# +# Create source package ready for upload and build +# +mk_tarball() +{ + pushd "$version/$FWTS" >& /dev/null + git archive --format tar -o ../fwts-$version.tar $version + gzip ../fwts-$version.tar + popd >& /dev/null +} + +# +# Create checksums +# + +mk_checksums() +{ + pushd "$version" >& /dev/null + sha256sum fwts-$version.tar.gz >> SHA256SUMS + popd >& /dev/null +} + +# +# Here we go.. +# +if [ $# -eq 1 ]; then + version=$1 + mkdir $version +else + echo "Please specify a version" + exit +fi + +rm_source +get_source + +checkout_version + +mk_tarball +mk_checksums + +rm_source