build-debian-toolbox: Install openssh-client
[bin.git] / ubuntu-backport-cockpit
1 #!/bin/sh
2 set -eu
3 PACKAGE=${1:-cockpit}
4 TARGET=${2:-impish}
5 POCKET="${TARGET}-backports"
6
7 series_ver() {
8     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)
9     ver=${ver%~bpo*}
10 }
11
12 upload() {
13     cat ../${PACKAGE}*_source.changes
14
15     read -p "Upload? [y/N] " answer
16     if [ "$answer" = y ]; then
17         dput ubuntu ../${PACKAGE}_*_source.changes
18     fi
19
20     cd ..
21     rm *bpo*
22     rm -r ${PACKAGE}-*
23 }
24
25 mkdir /tmp/backport
26 cd  /tmp/backport
27 apt-get source $PACKAGE
28 cd ${PACKAGE}-*
29
30 case "$TARGET" in
31     impish) VER=21.10 ;;
32     focal) VER=20.04 ;;
33     *) echo "Unknown target $TARGET" >&2; exit 1 ;;
34 esac
35
36 series_ver "$POCKET"
37 [ ! -x debian/adjust-for-release ] || debian/adjust-for-release $TARGET
38 dch --local ~bpo${VER}. --distribution $POCKET --force-distribution "No-change backport to $TARGET"
39 dpkg-buildpackage -S -sd -nc -v$ver
40 upload