/sdk-installer/deb-builder.sh

https://bitbucket.org/mmeinhold/amps · Shell · 39 lines · 20 code · 12 blank · 7 comment · 3 complexity · c27fe6c2c6f79fe5e57b48d9766ec2a0 MD5 · raw file

  1. #!/bin/sh
  2. SDKVERSION=$1
  3. DEBVERSION=$2
  4. #make sure we use GNU sed (gsed from macports) on OSX
  5. OS=`uname`
  6. echo "OS = $OS"
  7. if [ "${OS}" == "Darwin" ]; then
  8. SED=gsed
  9. else
  10. SED=sed
  11. fi
  12. # Make sure we have a clean /usr/bin
  13. rm -rf target/deb-work/usr/bin/
  14. mkdir -p target/deb-work/usr/bin/
  15. # Add the symlinks we need from /usr/share to /usr/bin
  16. for f in `find target/deb-work/usr/share/atlassian-plugin-sdk-$SDKVERSION/bin/ -name "atlas-*" | xargs -n1 basename`; do
  17. ln -s /usr/share/atlassian-plugin-sdk-$SDKVERSION/bin/$f target/deb-work/usr/bin/$f
  18. done
  19. # Add the install size to our control file
  20. DIRSIZE=`du -ks target/deb-work/usr/share/atlassian-plugin-sdk-$SDKVERSION | cut -f 1`
  21. $SED -i -e "s/SIZE/$DIRSIZE/g" target/deb-work/DEBIAN/control
  22. # update version in control
  23. $SED -i -e "s/DEBVERSION/$DEBVERSION/g" target/deb-work/DEBIAN/control
  24. echo "using deb version: $DEBVERSION"
  25. # Make the deb file
  26. dpkg --build target/deb-work target/atlassian-plugin-sdk-$DEBVERSION.deb
  27. exit 0