File: get-orig-source

package info (click to toggle)
lojban-common 1.5%2Bdfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 888 kB
  • ctags: 4
  • sloc: sh: 51; makefile: 32
file content (81 lines) | stat: -rwxr-xr-x 2,265 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
#! /bin/bash

# debian/get-orig-source
# Part of the ‘lojban-common’ package.
#
# Copyright © 2005–2013 Ben Finney <ben+debian@benfinney.id.au>
# 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 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
        )

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))"

working_root=$(mktemp -t -d)
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}

rm -r ${working_root}

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