[go: up one dir, main page]

File: make-specfile

package info (click to toggle)
comixcursors 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 876 kB
  • sloc: sh: 588; makefile: 153; python: 128
file content (71 lines) | stat: -rwxr-xr-x 1,908 bytes parent folder | download | duplicates (6)
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
#! /bin/bash
#
# bin/make-specfile
# Part of ComixCursors, a desktop cursor theme.
#
# Copyright © 2010–2013 Ben Finney <ben+opendesktop@benfinney.id.au>
# Copyright © 2010–2013 Jens Luetkens <j.luetkens@limitland.de>
#
# This work 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 3 of the License, or
# (at your option) any later version.
#
# This work 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 work. If not, see <http://www.gnu.org/licenses/>.

# Generate the RPM spec file.

bindir="$(dirname $0)"

# argument processing and usage
function show_usage_message {
    cat <<_EOT_
Usage: $0 [option]

Generate the ComixCursors RPM spec file.

Uses the environment variables PACKAGENAME and SUMMARY to determine
the parameters of the spec file.

Options:
    -h:    Display this help text, then exit.

_EOT_
}

while getopts ":uh" opt ; do
    case $opt in
        h)
            show_usage_message
            exit
            ;;
        *)
            printf "Unexpected option: -%s\n" "$OPTARG" >&2
            show_usage_message
            exit 2
            ;;
    esac
done

# start here

packagename="$PACKAGENAME"
version=$("${bindir}"/current-package-version)
summary="$SUMMARY"

specfile_template="ComixCursors.spec.in"
specfile_changelog="specfile-changelog"
specfile="${packagename}.spec"

sed \
    -e "s/PACKAGENAME/${packagename}/g" \
    -e "s/VERSION/${version}/g" \
    -e "s/SUMMARY/${summary}/g" \
    < "$specfile_template" > "${specfile}"
cat "${specfile_changelog}" >> "${specfile}"