/ packages / unmaintained / puppy.sh
puppy.sh
 1  #!/bin/bash
 2  
 3  APP=pybitmessage
 4  PREV_VERSION=0.4.4
 5  VERSION=0.6.0
 6  RELEASE=1
 7  BUILDDIR=~/petbuild
 8  CURRDIR=$(pwd)
 9  PROJECTDIR=${BUILDDIR}/${APP}-${VERSION}-${RELEASE}
10  
11  # Update version numbers automatically - so you don't have to
12  sed -i 's/VERSION='${PREV_VERSION}'/VERSION='${VERSION}'/g' Makefile debian.sh rpm.sh arch.sh ebuild.sh slack.sh
13  sed -i 's/Version: '${PREV_VERSION}'/Version: '${VERSION}'/g' rpmpackage/${APP}.spec
14  sed -i 's/Release: '${RELEASE}'/Release: '${RELEASE}'/g' rpmpackage/${APP}.spec
15  sed -i 's/pkgrel='${RELEASE}'/pkgrel='${RELEASE}'/g' archpackage/PKGBUILD
16  sed -i 's/pkgver='${PREV_VERSION}'/pkgver='${VERSION}'/g' archpackage/PKGBUILD
17  sed -i "s/-${PREV_VERSION}-/-${VERSION}-/g" puppypackage/*.specs
18  sed -i "s/|${PREV_VERSION}|/|${VERSION}|/g" puppypackage/*.specs
19  sed -i 's/VERSION='${PREV_VERSION}'/VERSION='${VERSION}'/g' puppypackage/pinstall.sh puppypackage/puninstall.sh
20  sed -i 's/-'${PREV_VERSION}'.so/-'${VERSION}'.so/g' debian/*.links
21  
22  
23  # Make directories within which the project will be built
24  mkdir -p ${BUILDDIR}
25  mkdir -p ${PROJECTDIR}
26  
27  # Build the project
28  make clean
29  make
30  make install -B DESTDIR=${PROJECTDIR} PREFIX=/usr
31  
32  # Alter the desktop file categories
33  sed -i "s/Categories=Office;Email;/Categories=Internet;mailnews;/g" ${PROJECTDIR}/usr/share/applications/${APP}.desktop
34  
35  # Create directories specific to puppy
36  mkdir ${PROJECTDIR}/usr
37  mkdir ${PROJECTDIR}/usr/local
38  mkdir ${PROJECTDIR}/usr/local/bin
39  
40  # Copy anything in /usr/bin into /usr/local/bin
41  cp ${PROJECTDIR}/usr/bin/* ${PROJECTDIR}/usr/local/bin/
42  
43  # Copy the spec file into the build directory
44  cp ${CURRDIR}/puppypackage/${APP}-${VERSION}.pet.specs ${PROJECTDIR}
45  
46  # Copy the XPM mini icon into the build directory
47  cp ${CURRDIR}/desktop/icon14.xpm ${PROJECTDIR}/${APP}.xpm
48  
49  # Compress the build directory
50  cd ${BUILDDIR}
51  tar -c -f ${APP}-${VERSION}-${RELEASE}.tar .
52  sync
53  gzip ${APP}-${VERSION}-${RELEASE}.tar
54  mv ${APP}-${VERSION}-${RELEASE}.tar.gz ${CURRDIR}/puppypackage
55  cd ${CURRDIR}/puppypackage
56  
57  # Create the PET package
58  MD5SUM="`md5sum ${APP}-${VERSION}-${RELEASE}.tar.gz | cut -f 1 -d ' '`"
59  echo -n "$MD5SUM" >> ${APP}-${VERSION}-${RELEASE}.tar.gz
60  sync
61  mv -f ${APP}-${VERSION}-${RELEASE}.tar.gz ${APP}-${VERSION}-${RELEASE}.pet
62  sync
63  cd ${CURRDIR}
64  
65  # Remove the temporary build directory
66  rm -fr ${BUILDDIR}