I was on a friend’s machine looking to copy some of his software.
$ dpkg-repack <pkg>
bash: dpkg-repack: command not found
So, here’s a hacky and woefully incomplete replacement for dpkg-repack.
#! /bin/sh
set -eu
[ 0 != $(id -u) ] && { echo "Must be run as (fake)root" 1>&2; exit 1; }pkg=$1; pkgdir=$(mktemp -d "$pkg.XXXXXX")
mkdir "$pkgdir"dpkg -L $pkg | tar cf - –no-recursion –files-from - | (cd "$pkgdir" && tar xvf -)
install -d -m 755 "$pkgdir/DEBIAN"
dpkg -s "$pkg" |sed '/^Status: /d' > "$pkgdir/DEBIAN/control"dpkg-deb -b "$pkgdir" .
rm -rf "$pkgdir"
Works For Me ™.
Update: it was pointed out that wordpress had prettified the code, turning pairs of dashes into em-dashes and other atrocities. so I've uploaded the script: [fake-repack]
dpkg -L $pkg | tar cf - –no-recursion –files-from - | (cd "$pkgdir" && tar xvf -)
I would use cpio instead:
dpkg -L "$pkg" | cpio -vmdp "$pkgdir"
Mm, thanks. cpio is something I avoided learning because I didn't see any value in it at first glance. I'll reappraise this.