4 # Part of ComixCursors, a desktop cursor theme.
6 # Copyright © 2010–2013 Ben Finney <ben+opendesktop@benfinney.id.au>
7 # Copyright © 2006–2013 Jens Luetkens <j.luetkens@limitland.de>
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.
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.
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/>.
22 # This script creates all distribution packages of ComixCursors from
23 # the sources. Run it as root from inside the source VCS working tree.
25 # Additional requirements:
26 # * Bazaar VCS program <http://bazaar.canonical.com/>
27 # * RPM package building tools <http://rpm.org/>
33 VERSION
=$
("${bindir}"/current-package-version
)
36 themename_root
="ComixCursors"
43 printf "Packaging %s %s...\n" "$themename_root" $VERSION
45 workdir
="$(mktemp -t -d)"
50 printf "Creating source package...\n"
53 srcname
="${themename_root}-sources-${VERSION}"
54 srcdir
="${workdir}/${srcname}"
55 mkdir
--parents "${srcdir}"
56 # bzr export "$srcdir"/
58 mkdir
--parents "$distdir"
61 tarfile
="${distdir}/${srcname}.tar.bz2"
62 tar -cjf "$tarfile" --exclude-vcs --directory "$workdir" "$srcname"/
65 # Now build the cursors for packaging.
68 printf "Installing cursor files...\n"
70 # Make a temporary directory for installing icons into.
71 ICONSDIR
="${workdir}/icons"
73 mkdir
--parents "${ICONSDIR}"
77 function package_variant
{
78 # Package the tarball for a specific variant of the cursors.
82 if [ -n "$variant" ] ; then
83 PACKAGENAME
="${themename_root}-${variant}"
85 PACKAGENAME
="${themename_root}"
88 printf "Creating cursors package %s...\n" "$PACKAGENAME"
90 # Now it's important that the variants get processed in an
91 # "reverse" order, so only directories matching package name get
94 packagedir
="${workdir}/${PACKAGENAME}"
95 mkdir
--parents "$packagedir"
96 mv "${ICONSDIR}/${PACKAGENAME}"* "$packagedir"/.
98 tarfile
="${distdir}/${PACKAGENAME}-${VERSION}.tar.bz2"
99 tar -cjf "$tarfile" --directory "$packagedir" --files-from <(
107 rpmdir
="/usr/src/packages"
108 if [ -d "$rpmdir" ] ; then
109 printf "Creating RPM package...\n"
110 specfilename
="${PACKAGENAME}.spec"
111 specfile
="${rpmdir}/SPECS/${specfilename}"
112 rpmsourcesdir
="${rpmdir}/SOURCES"
113 export PACKAGENAME SUMMARY
115 cp "$specfilename" "$specfile"
116 cp "$tarfile" "${rpmsourcesdir}"/.
119 rpmbuild
-bb "$specfile"
121 mv "${rpmdir}/RPMS/noarch/${PACKAGENAME}"* "$distdir"/.
123 printf "Directory $rpmdir not found, skipping RPM packaging.\n"
127 package_variant
"LH-Opaque" "The opaque left-handed Comix Cursors"
128 package_variant
"LH" "The left-handed Comix Cursors"
129 package_variant
"Opaque" "The opaque Comix Cursors"
130 package_variant
"" "The original Comix Cursors"
132 printf "Cleaning up temporary working area...\n"