File: get-orig-source

package info (click to toggle)
lojban-common 1.5%2Bdfsg.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 888 kB
  • ctags: 12
  • sloc: sh: 60; makefile: 30
file content (95 lines) | stat: -rwxr-xr-x 2,541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/bash

# debian/get-orig-source
# Part of the ‘lojban-common’ package.
#
# Copyright © 2005–2016 Ben Finney <bignose@debian.org>
# This is free software; you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License, version 3 or later.
# No warranty expressed or implied.
# See the file ‘/usr/share/common-licenses/GPL-3’ for details.

set -o errexit
set -o errtrace
set -o pipefail
set -o nounset

PACKAGE_NAME=lojban-common
PACKAGE_VERSION=$(
        dpkg-parsechangelog --count 1 \
        | grep '^Version: ' \
        | cut -d ' ' -f 2 \
        | sed -e 's/-[^-]\+$//' \
        )

LOJBAN_FILES_URL=http://www.lojban.org/publications
upstream_urls=(
        ${LOJBAN_FILES_URL}/wordlists/gismu.txt
        ${LOJBAN_FILES_URL}/wordlists/cmavo.txt
        ${LOJBAN_FILES_URL}/wordlists/rafsi.txt
        ${LOJBAN_FILES_URL}/wordlists/lujvo.txt
        )

working_root="$(mktemp -d -t)"

exit_sigspecs="ERR EXIT SIGTERM SIGHUP SIGINT SIGQUIT"

function cleanup_exit() {
    exit_status=$?
    trap - $exit_sigspecs

    rm -rf "${working_root}"
    printf "Cleaned up working directory ‘%s’\n" "${working_root}"

    exit $exit_status
}
trap cleanup_exit $exit_sigspecs

function command_not_found_handle() {
    # Bash will (as per ‘bash(1)’ § “COMMAND EXECUTION”) invoke this
    # function on failure of a search through PATH for a command.
    local command="$1"
    local -a command_args="$@"

    case "$command" in
      wget | /usr/bin/wget)
        printf \
                "This program depends on the program ‘%s’, installed from the Debian package ‘%s’.\n" \
                "wget" "wget"
        ;;
      *)
        ;;
    esac

    printf "%s: %s: command not found\n" "$SHELL" "$command"
    return 127
}

program_dir="$(dirname $(readlink --canonicalize-existing $0))"

upstream_archive_name=${PACKAGE_NAME}-${PACKAGE_VERSION}
archive_working_dir=${working_root}/${upstream_archive_name}
mkdir ${archive_working_dir}

WGET_OPTS="--timestamping --directory-prefix ${archive_working_dir}"
wget ${WGET_OPTS} "${upstream_urls[@]}"

sha1sums_file="${program_dir}/upstream.sha1sums"
(
    cd ${archive_working_dir}
    sha1sum -c "${sha1sums_file}"
    )

TARBALL_SUFFIX=".tar.gz"
tarball_name=${PACKAGE_NAME}_${PACKAGE_VERSION}.orig${TARBALL_SUFFIX}
(
    cd ${working_root}
    tar -cf - ${upstream_archive_name}
    ) | gzip --best > ${tarball_name}


# Local variables:
# coding: utf-8
# mode: sh
# End:
# vim: fileencoding=utf-8 filetype=sh :