debian-backport-cockpit: Support other package names
authorMartin Pitt <martin@piware.de>
Thu, 4 Nov 2021 09:35:04 +0000 (10:35 +0100)
committerMartin Pitt <martin@piware.de>
Thu, 4 Nov 2021 09:35:04 +0000 (10:35 +0100)
So that the script works for e.g. cockpit-{machines,podman}.

debian-backport-cockpit

index 5e12c72507bfda206f47c28e3e3a0c51a0a0f3fe..be86c41f0c68d00afdb1aeeba1e3c9016da3ebe9 100755 (executable)
@@ -1,32 +1,33 @@
 #!/bin/sh
 set -eu
+PACKAGE=${1:-cockpit}
 
 series_ver() {
-    ver=$(wget -q -O- http://ftp.debian.org/debian/dists/${1}/main/source/Sources.xz | xz -d | grep-dctrl -n -sVersion -P cockpit | sort -u | tail -n1)
+    ver=$(wget -q -O- http://ftp.debian.org/debian/dists/${1}/main/source/Sources.xz | xz -d | grep-dctrl -n -sVersion -XP $PACKAGE | sort -u | tail -n1)
     ver=${ver%~bpo*}
 }
 
 upload() {
-    cat ../cockpit_*_source.changes
+    cat ../${PACKAGE}*_source.changes
 
     read -p "Upload? [y/N] " answer
     if [ "$answer" = y ]; then
-        dput ../cockpit_*_source.changes
+        dput ../${PACKAGE}_*_source.changes
     fi
 
     cd ..
     rm *bpo*
-    rm -r cockpit-*
+    rm -r ${PACKAGE}-*
 }
 
 mkdir /tmp/backport
 cd  /tmp/backport
-apt-get source cockpit
-cd cockpit-*
+apt-get source $PACKAGE
+cd ${PACKAGE}-*
 
 # bullseye
 series_ver bullseye-backports
-debian/adjust-for-release bullseye
+[ ! -x debian/adjust-for-release ] || debian/adjust-for-release bullseye
 dch --local ~bpo11+ --distribution bullseye-backports --force-distribution "No-change backport to Debian Bullseye"
 debuild -S -sd -nc -v$ver
 upload