rpm.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. APP=pybitmessage
  3. PREV_VERSION=0.3.5
  4. VERSION=0.3.5
  5. RELEASE=1
  6. SOURCEDIR=.
  7. ARCH_TYPE=`uname -m`
  8. CURRDIR=`pwd`
  9. SOURCE=~/rpmbuild/SOURCES/${APP}_${VERSION}.orig.tar.gz
  10. # Update version numbers automatically - so you don't have to
  11. sed -i 's/VERSION='${PREV_VERSION}'/VERSION='${VERSION}'/g' Makefile debian.sh arch.sh puppy.sh ebuild.sh slack.sh
  12. sed -i 's/Version: '${PREV_VERSION}'/Version: '${VERSION}'/g' rpmpackage/${APP}.spec
  13. sed -i 's/Release: '${RELEASE}'/Release: '${RELEASE}'/g' rpmpackage/${APP}.spec
  14. sed -i 's/pkgrel='${RELEASE}'/pkgrel='${RELEASE}'/g' archpackage/PKGBUILD
  15. sed -i 's/pkgver='${PREV_VERSION}'/pkgver='${VERSION}'/g' archpackage/PKGBUILD
  16. sed -i "s/-${PREV_VERSION}-/-${VERSION}-/g" puppypackage/*.specs
  17. sed -i "s/|${PREV_VERSION}|/|${VERSION}|/g" puppypackage/*.specs
  18. sed -i 's/VERSION='${PREV_VERSION}'/VERSION='${VERSION}'/g' puppypackage/pinstall.sh puppypackage/puninstall.sh
  19. sed -i 's/-'${PREV_VERSION}'.so/-'${VERSION}'.so/g' debian/*.links
  20. sudo yum groupinstall "Development Tools"
  21. sudo yum install rpmdevtools
  22. # setup the rpmbuild directory tree
  23. rpmdev-setuptree
  24. # create the source code in the SOURCES directory
  25. make clean
  26. mkdir -p ~/rpmbuild/SOURCES
  27. rm -f ${SOURCE}
  28. # having the root directory called name-version seems essential
  29. mv ../${APP} ../${APP}-${VERSION}
  30. tar -cvzf ${SOURCE} ../${APP}-${VERSION} --exclude-vcs
  31. # rename the root directory without the version number
  32. mv ../${APP}-${VERSION} ../${APP}
  33. # copy the spec file into the SPECS directory
  34. cp -f rpmpackage/${APP}.spec ~/rpmbuild/SPECS
  35. # build
  36. cd ~/rpmbuild/SPECS
  37. rpmbuild -ba ${APP}.spec
  38. cd ${CURRDIR}
  39. # Copy the results into the rpmpackage directory
  40. mkdir -p rpmpackage/${ARCH_TYPE}
  41. cp -r ~/rpmbuild/RPMS/${ARCH_TYPE}/${APP}* rpmpackage/${ARCH_TYPE}
  42. cp -r ~/rpmbuild/SRPMS/${APP}* rpmpackage