1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #5364

Zetok Zalbavar (1):
      chore: refactor tools/create-tarballs.sh to deduplicate code
This commit is contained in:
sudden6 2018-10-03 12:07:07 +02:00
commit 96b5f5d1b5
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -15,16 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Create a `lzip` and a `gzip` archive and make a detached GPG signature for them.
# Create `lzip` and `gzip` archives and make detached GPG signatures for them.
#
# When tag name is supplied, it's used to create archive. If there is no tag
# When tag name is supplied, it's used to create archives. If there is no tag
# name supplied, latest tag is used.
# Requires:
# * GPG
# * git
# * lzip
# * gzip
# * lzip
# usage:
# ./$script [$tag_name]
@ -34,33 +34,28 @@
set -eu -o pipefail
archives_from_tag() {
git archive --format=tar "$@" \
| lzip --best \
> "$@".tar.lz
echo "$@.tar.lz archive has been created."
git archive --format=tar "$@" \
| gzip --best \
> "$@".tar.gz
echo "$@.tar.gz archive has been created."
archive() {
git archive --format=tar "${@%%.tar.*}" \
| "${@##*.tar.}"ip --best \
> "$@"
echo "$@ archive has been created."
}
sign_archives() {
sign_archive() {
gpg \
--armor \
--detach-sign \
"$@".tar.lz
echo "$@.tar.lz.asc signature has been created."
gpg \
--armor \
--detach-sign \
"$@".tar.gz
echo "$@.tar.gz.asc signature has been created."
"$@"
echo "$@.asc signature has been created."
}
create_and_sign() {
archives_from_tag "$@"
sign_archives "$@"
local archives=("$@".tar.{l,g}z)
for a in "${archives[@]}"
do
archive "$a"
sign_archive "$a"
done
}
get_tag() {