mkdeb 760 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. export CWD=$(pwd)
  3. tmp=$(mktemp)
  4. rm -f $tmp ; mkdir $tmp
  5. cd $1
  6. if [ ! -d ./DEBIAN ] ; then
  7. echo "DEBIAN directory not found"
  8. exit 1
  9. fi
  10. export NAME=$(cat DEBIAN/control | grep "Package: " | sed "s/.*: //g")
  11. export ARCH=$(cat DEBIAN/control | grep "Architecture: " | sed "s/.*: //g")
  12. export VERS=$(cat DEBIAN/control | grep "Version: " | sed "s/.*: //g")
  13. tar czvf $tmp/data.tar.gz [a-z]* | sed "s/^/Adding: /g"
  14. cd DEBIAN
  15. touch md5sums
  16. find .. | grep -v DEBIAN | while read line
  17. do
  18. [ -f $line ] && md5sum $line | sed "s|^\./||g" >> md5sums
  19. done
  20. tar czf $tmp/control.tar.gz *
  21. cd ../..
  22. echo 2.0 > $tmp/debian-binary
  23. cd $tmp
  24. ar r "${NAME}_${ARCH}_${VERS}.deb" debian-binary control.tar.gz data.tar.gz
  25. mv $tmp/*.deb $CWD/
  26. rm -rf $tmp/
  27. cd $CWD