fixdeb 869 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. #
  3. # Create debian files from *.in files
  4. #
  5. # $1 = path to debian files
  6. #
  7. if [ $# != 1 ]; then
  8. echo 'Usage : fixdeb path'
  9. exit 1
  10. fi
  11. PACKAGEVERSION=`head -n 1 $1/changelog | awk '{ print $2 }' | tr -d '[()]'`
  12. FPCVERSION=`echo $PACKAGEVERSION | awk -F '-' '{ print $1 }'`
  13. DEBVERSION=`echo $PACKAGEVERSION | awk -F '-' '{ print $2 }'`
  14. # Snapshot ?
  15. if [ "$DEBVERSION" == "0" ]; then
  16. OLDPACKAGEVERSION=$PACKAGEVERSION
  17. DEBVERSION=`/bin/date --utc +%Y%m%d`
  18. PACKAGEVERSION=$FPCVERSION-$DEBVERSION
  19. sed s+$OLDPACKAGEVERSION+$PACKAGEVERSION+ $1/changelog > $1/changelog.tmp
  20. mv $1/changelog.tmp $1/changelog
  21. fi
  22. echo 'PackageVersion: ' $PACKAGEVERSION
  23. echo 'FPCVersion : ' $FPCVERSION
  24. echo 'DebVersion : ' $DEBVERSION
  25. for i in $1/*.in
  26. do
  27. j=${i/.in/}
  28. sed -e 's/%{fpcversion}/'$FPCVERSION'/g;s/%{packageversion}/'$PACKAGEVERSION'/g' $i > $j
  29. done