| 1 |
#! /bin/bash |
| 2 |
# |
| 3 |
# bin/make-specfile |
| 4 |
# Part of ComixCursors, a desktop cursor theme. |
| 5 |
# |
| 6 |
# Copyright © 2010–2013 Ben Finney <[email protected]> |
| 7 |
# Copyright © 2010–2013 Jens Luetkens <[email protected]> |
| 8 |
# |
| 9 |
# This work is free software: you can redistribute it and/or modify it |
| 10 |
# under the terms of the GNU General Public License as published by |
| 11 |
# the Free Software Foundation, either version 3 of the License, or |
| 12 |
# (at your option) any later version. |
| 13 |
# |
| 14 |
# This work is distributed in the hope that it will be useful, but |
| 15 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
# General Public License for more details. |
| 18 |
# |
| 19 |
# You should have received a copy of the GNU General Public License |
| 20 |
# along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 21 |
|
| 22 |
# Generate the RPM spec file. |
| 23 |
|
| 24 |
bindir="$(dirname $0)" |
| 25 |
|
| 26 |
# argument processing and usage |
| 27 |
function show_usage_message { |
| 28 |
cat <<_EOT_ |
| 29 |
Usage: $0 [option] |
| 30 |
|
| 31 |
Generate the ComixCursors RPM spec file. |
| 32 |
|
| 33 |
Uses the environment variables PACKAGENAME and SUMMARY to determine |
| 34 |
the parameters of the spec file. |
| 35 |
|
| 36 |
Options: |
| 37 |
-h: Display this help text, then exit. |
| 38 |
|
| 39 |
_EOT_ |
| 40 |
} |
| 41 |
|
| 42 |
while getopts ":uh" opt ; do |
| 43 |
case $opt in |
| 44 |
h) |
| 45 |
show_usage_message |
| 46 |
exit |
| 47 |
;; |
| 48 |
*) |
| 49 |
printf "Unexpected option: -%s\n" "$OPTARG" >&2 |
| 50 |
show_usage_message |
| 51 |
exit 2 |
| 52 |
;; |
| 53 |
esac |
| 54 |
done |
| 55 |
|
| 56 |
# start here |
| 57 |
|
| 58 |
packagename="$PACKAGENAME" |
| 59 |
version=$("${bindir}"/current-package-version) |
| 60 |
summary="$SUMMARY" |
| 61 |
|
| 62 |
specfile_template="ComixCursors.spec.in" |
| 63 |
specfile_changelog="specfile-changelog" |
| 64 |
specfile="${packagename}.spec" |
| 65 |
|
| 66 |
sed \ |
| 67 |
-e "s/PACKAGENAME/${packagename}/g" \ |
| 68 |
-e "s/VERSION/${version}/g" \ |
| 69 |
-e "s/SUMMARY/${summary}/g" \ |
| 70 |
< "$specfile_template" > "${specfile}" |
| 71 |
cat "${specfile_changelog}" >> "${specfile}" |