Rename debian/ubuntu backport packages


/ Published in: Bash
Save to your folder(s)

This script goes to the directory you pass as a parameter and change de version of all the packages found in there.
It was used for an amount of packages which were building from the sources but for an lower version of Ubuntu (actually for Guadalinex v4 which codename is 'toro'. That's why in variable 'backport' says 'toro').
The code wasn't touched so we didn't change the 'debian/changelog' and the packages were generates with its normal version.
The problem is the packages were compiled with lower version of libraries than the Ubuntu version the packages was saying.
To avoid binary problems and mark those packages as a 'backport' we changed the packages version after the generation with dpkg-deb.

It's quite nasty stuff, but was useful and maybe it could help some one on similar purposes. Also it could be a shellscripting example for more things (var expansions, for example)


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3. dist=ubuntu
  4. backport=toro
  5.  
  6. cd $1
  7.  
  8. for pkg in *.deb
  9. do
  10. pkg_ver=${pkg##*$dist}
  11. pkg_ver="${dist}${pkg_ver%%_*.deb}"
  12. pkg_dir=${pkg%%_*}
  13. debian="${pkg_dir}/DEBIAN"
  14. (dpkg-deb -X $pkg $pkg_dir && dpkg-deb -e $pkg $debian) || \
  15. (echo "Error en $pkg" ; continue)
  16. sed -i "/^Version/s|${pkg_ver}|${pkg_ver}~toro|g" ${debian}/control
  17. dpkg -b $pkg_dir ${pkg/${pkg_ver}/${pkg_ver}~toro}
  18. done

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.