Switch to upstream source from tarball ‘comixcursors_0.6.1.orig.tar.bz2’.
[debian_comixcursors.git] / build-all-packages.sh
blobfa2c98aa0fc660d1114b8b47f38e02af817d78d5
1 #!/bin/sh
4 # This script creates all four packages of ComixCursors for distribution
5 # from the sources.
6 # It's ment to be run from the directory containig the sources e.g.
8 # > ls -l
9 # -rw-r--r-- 1 user users 433 20. Jun 12:07 build-all-packages.sh
10 # drwxr-xr-x 4 user users 4096 20. Jun 11:56 ComixCursors-LH-opaque-sources-0.6.1
11 # drwxr-xr-x 8 user users 4096 20. Jun 11:56 ComixCursors-LH-sources-0.6.1
12 # drwxr-xr-x 8 user users 4096 20. Jun 11:56 ComixCursors-opaque-sources-0.6.1
13 # drwxr-xr-x 8 user users 4096 20. Jun 12:06 ComixCursors-sources-0.6.1
17 VERSION="0.6.1"
18 PKGS="ComixCursors-LH-opaque ComixCursors-LH ComixCursors-opaque ComixCursors"
19 BASEDIR=$PWD
20 DISTDIR=$PWD/dist
22 if [ ! -d $DISTDIR ] ; then mkdir $DISTDIR; fi
23 rm -rf $DISTDIR/*
25 for PKG in $PKGS; do
27 cd $BASEDIR
28 SUBDIR=$PKG-sources-$VERSION
30 if [ ! -d $SUBDIR ] ; then
31 echo "Error: directory $SUBDIR not found, exiting."
32 break
35 echo "Packaging $PKG $VERSION..."
38 # source packages
40 echo "Creating source package..."
42 cd $SUBDIR
43 make clean
44 cd $BASEDIR
45 TARFILE=$SUBDIR.tar.bz2
46 if [ -f $TARFILE ] ; then rm $TARFILE; fi
47 tar -cjf $TARFILE $SUBDIR
48 mv $TARFILE $DISTDIR
50 echo "Installing cursor files..."
52 cd $SUBDIR
53 ./install-all.sh
54 cp link-cursors.sh ~/.icons/
57 # cursors packages
59 echo "Creating cursors package..."
61 # now it's important that the $PKGS get processed in an "reverse" order,
62 # so only directories matching package name get packed.
64 cd ~/.icons/
65 TARFILE=$PKG-$VERSION.tar.bz2
66 if [ -f $TARFILE ] ; then rm $TARFILE; fi
67 tar -cjhf $TARFILE $PKG* link-cursors.sh
68 mv $TARFILE $DISTDIR
69 rm -rf $PKG*
72 # RPM packages
74 PKGDIR=/usr/src/packages
75 if [ -d $PKGDIR ] ; then
76 echo "Creating RPM package..."
77 cd $BASEDIR
78 cp $SUBDIR/$PKG.spec $PKGDIR/SPECS/$PKG.spec
79 cp $DISTDIR/$PKG-$VERSION.tar.bz2 $PKGDIR/SOURCES/$PKG-$VERSION.tar.bz2
80 cd $PKGDIR/SOURCES/
81 rpmbuild -bb $PKGDIR/SPECS/$PKG.spec
82 mv $PKGDIR/RPMS/noarch/$PKG* $DISTDIR
83 else
84 echo "Directory /usr/src/packages not found, skipping RPM packaging."
87 done