fixdeb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. #
  3. # Create debian files from *.in files
  4. #
  5. # $1 = path to debian files
  6. # $2 = fpc target (i386-linux)
  7. # $3 = ppcXXX binary name (ppc386)
  8. #
  9. if [ $# != 3 ]; then
  10. echo 'Usage : fixdeb path fpctarget ppcbin'
  11. exit 1
  12. fi
  13. PACKAGEVERSION=`head -n 1 $1/changelog | awk '{ print $2 }' | tr -d '[()]'`
  14. FPCVERSION=`echo $PACKAGEVERSION | awk -F '-' '{ print $1 }'`
  15. DEBVERSION=`echo $PACKAGEVERSION | awk -F '-' '{ print $2 }'`
  16. FPCCVSTAG=`echo $FPCVERSION | awk -F '.' '{ print "RELEASE_"$1"_"$2"_"$3 }'`
  17. FPCTARGET="$2"
  18. PPCBIN="$3"
  19. # Snapshot ?
  20. if [ "$DEBVERSION" == "0" ]; then
  21. OLDPACKAGEVERSION=$PACKAGEVERSION
  22. DEBVERSION=`/bin/date --utc +%Y%m%d`
  23. PACKAGEVERSION=$FPCVERSION-$DEBVERSION
  24. sed s+$OLDPACKAGEVERSION+$PACKAGEVERSION+ $1/changelog > $1/changelog.tmp
  25. mv $1/changelog.tmp $1/changelog
  26. fi
  27. echo 'PackageVersion: ' $PACKAGEVERSION
  28. echo 'FPCVersion : ' $FPCVERSION
  29. echo 'FPCTarget : ' $FPCTARGET
  30. echo 'DebVersion : ' $DEBVERSION
  31. echo 'PPCBin : ' $PPCBIN
  32. echo 'CVSTag : ' $FPCCVSTAG
  33. for i in $1/*.in
  34. do
  35. j=${i/%.in/}
  36. sed -e 's/%{fpcversion}/'$FPCVERSION'/g;s/%{packageversion}/'$PACKAGEVERSION'/g;s/%{ppcbin}/'$PPCBIN'/g;s/%{fpctarget}/'$FPCTARGET'/g;s/%{fpccvstag}/'$FPCCVSTAG'/g' $i > $j
  37. done