Add a version query fallback for the first backport in a series.
#!/bin/sh
set -eu
PACKAGE=${1:-cockpit}
-TARGET=${2:-impish}
+TARGET=${2:-jammy}
POCKET="${TARGET}-backports"
series_ver() {
ver=$(wget -q -O- http://de.archive.ubuntu.com/ubuntu/dists/$1/universe/source/Sources.xz | xz -d | grep-dctrl -n -sVersion -XP $PACKAGE | sort -u | tail -n1)
ver=${ver%~bpo*}
+ if [ -z "$ver" ]; then
+ ver=$(wget -q -O- http://de.archive.ubuntu.com/ubuntu/dists/${1%-*}/universe/source/Sources.xz | xz -d | grep-dctrl -n -sVersion -XP $PACKAGE | sort -u | tail -n1)
+ fi
}
upload() {
cd ${PACKAGE}-*
case "$TARGET" in
+ jammy) VER=22.04 ;;
impish) VER=21.10 ;;
focal) VER=20.04 ;;
*) echo "Unknown target $TARGET" >&2; exit 1 ;;
esac
series_ver "$POCKET"
-[ ! -x debian/adjust-for-release ] || debian/adjust-for-release $TARGET
dch --local ~bpo${VER}. --distribution $POCKET --force-distribution "No-change backport to $TARGET"
dpkg-buildpackage -S -sd -nc -v$ver
upload