]> piware.de Git - bin.git/blobdiff - ubuntu-backport-cockpit
Add ubuntu-backport-cockpit
[bin.git] / ubuntu-backport-cockpit
diff --git a/ubuntu-backport-cockpit b/ubuntu-backport-cockpit
new file mode 100755 (executable)
index 0000000..6346ed5
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+set -eu
+PACKAGE=${1:-cockpit}
+TARGET=${2:-impish}
+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*}
+}
+
+upload() {
+    cat ../${PACKAGE}*_source.changes
+
+    read -p "Upload? [y/N] " answer
+    if [ "$answer" = y ]; then
+        dput ubuntu ../${PACKAGE}_*_source.changes
+    fi
+
+    cd ..
+    rm *bpo*
+    rm -r ${PACKAGE}-*
+}
+
+mkdir /tmp/backport
+cd  /tmp/backport
+apt-get source $PACKAGE
+cd ${PACKAGE}-*
+
+case "$TARGET" in
+    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