#!/usr/bin/env bash set -x set -euo pipefail IFS=$'\n\t' TAG=HEAD PKG_NAME=acl-libs PKG_VERSION=$(grep '^Version:' ${PKG_NAME}.spec | awk '{print $2}') function pack() { cd .. git archive --format=tar --prefix=${PKG_NAME}-${PKG_VERSION}/ ${TAG} | tar xpf - #git show ${TAG} --oneline | head -1 > ${PKG_NAME}-${PKG_VERSION}/commit-id tar zcpf ${PKG_NAME}-${PKG_VERSION}.tar.gz ${PKG_NAME}-${PKG_VERSION} /bin/mv -f ${PKG_NAME}-${PKG_VERSION}.tar.gz packaging rm -rf ${PKG_NAME}-${PKG_VERSION} cd - } function help() { echo "$0 build|pack" } if [ "$1" == "" ]; then help elif [ "$1" == "pack" ];then pack elif [ "$1" == "test" ];then run_test else help fi