/ Published in: Bash
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)
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)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash dist=ubuntu backport=toro cd $1 for pkg in *.deb do pkg_ver=${pkg##*$dist} pkg_ver="${dist}${pkg_ver%%_*.deb}" pkg_dir=${pkg%%_*} debian="${pkg_dir}/DEBIAN" (dpkg-deb -X $pkg $pkg_dir && dpkg-deb -e $pkg $debian) || \ (echo "Error en $pkg" ; continue) sed -i "/^Version/s|${pkg_ver}|${pkg_ver}~toro|g" ${debian}/control dpkg -b $pkg_dir ${pkg/${pkg_ver}/${pkg_ver}~toro} done