create_orig 1001 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. dirname=${PWD##*/}
  3. if ! [[ "$dirname" =~ ^lazpaint-[0-9]+(\.[0-9]+)*$ ]]; then
  4. echo "Parent folder name must be \"lazpaint-#[.#][.#]\" but is \"$dirname\" instead"
  5. echo "where #[.#][.#] is the app version number"
  6. exit 1
  7. fi
  8. if ! [ -d bgrabitmap ] || ! [ -d bgracontrols ]; then
  9. echo "Cannot find bgrabitmap or bgracontrols subdirectories."
  10. exit 1
  11. fi
  12. if [ -d bgrabitmap/test ] || [ -d lazpaint/release/windows ]; then
  13. echo "Lazarus custom packages have not been pruned. Call ./prune_lpk first"
  14. exit 1
  15. fi
  16. archive=${dirname/-/_}.orig.tar.gz
  17. read -p "Create \"../${archive}\" file (y/n)?" -n 1 -r
  18. echo
  19. if [[ $REPLY =~ ^[Yy]$ ]]
  20. then
  21. make distclean
  22. cd ..
  23. tar --exclude=./${dirname}/debian --exclude-vcs -zcvf ${archive} ./${dirname}
  24. cd "$dirname"
  25. echo "Done creating ../${archive}"
  26. echo
  27. read -p "Launch \"debuild -us -uc\" on the package now (y/n)?" -n 1 -r
  28. echo
  29. if [[ $REPLY =~ ^[Yy]$ ]]
  30. then
  31. debuild -us -uc
  32. fi
  33. fi