You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
#!/bin/sh -e
|
|
|
|
# DISCLAIMER
|
|
# Don't ever think of installing every single package generated with this script.
|
|
# While it *should* not cause any problems, doing so is simply overkill, untested, and not recommended in the least.
|
|
|
|
if [ "$#" -lt 2 ]; then
|
|
echo "Usage: $0 <slackware> <slackware64> [whitelist]" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
scriptdir="$(realpath "$(dirname "$0")")"
|
|
|
|
slackware="$1"
|
|
slackware64="$2"
|
|
whitelist="$3"
|
|
|
|
find "$slackware" -type f -name "*.t?z" -printf '%P\n' | sort | while read -r pkg; do
|
|
# See /sbin/installpkg
|
|
pkgbase="$(echo "$pkg" | sed -e 's?.*/??;s/\.t[bglx]z$//')"
|
|
pkgext="$(echo "$pkg" | sed -e 's?.*/??;s/.*\.\(t[bglx]z\)$/\1/')"
|
|
pkgname="$(echo "$pkgbase" | sed -e 's?-[^-]*-[^-]*-[^-]*$??')"
|
|
pkgver="$(echo "$pkgbase" | sed -e 's?.*-\([^-]*\)-[^-]*-[^-]*$?\1?')"
|
|
pkgarch="$(echo "$pkgbase" | sed -e 's?.*-[^-]*-\([^-]*\)-[^-]*$?\1?')"
|
|
pkgbuild="$(echo "$pkgbase" | sed -e 's?.*-[^-]*-[^-]*-\([^-]*\)$?\1?')"
|
|
|
|
if [ "$whitelist" ]; then
|
|
if ! grep -v '^#' "$whitelist" | fgrep -xq "$pkgname"; then
|
|
continue
|
|
fi
|
|
fi
|
|
|
|
case "$pkgarch" in
|
|
i?86) pkgarch=x86_64 ;;
|
|
*) continue ;;
|
|
esac
|
|
|
|
pkg64="$(dirname "$pkg")/$pkgname-$pkgver-$pkgarch-$pkgbuild.$pkgext"
|
|
|
|
if [ ! -f "$slackware64/$pkg64" ]; then
|
|
continue
|
|
fi
|
|
|
|
rpkg="$(realpath "$slackware/$pkg")"
|
|
rpkg64="$(realpath "$slackware64/$pkg64")"
|
|
|
|
mkdir -p "$(dirname "$pkg")"
|
|
|
|
( cd "$(dirname "$pkg")"
|
|
"$scriptdir/convert32pkg.sh" "$rpkg" "$rpkg64"
|
|
)
|
|
done
|
|
|