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.
59 lines
1.9 KiB
59 lines
1.9 KiB
8 years ago
|
#!/bin/sh
|
||
|
set -e
|
||
8 years ago
|
|
||
|
# DISCLAIMER
|
||
|
# Don't ever think of installing every single package generated with this script.
|
||
8 years ago
|
# While it *should* not cause any problems, doing so is simply overkill, untested, and not recommended in the least.
|
||
8 years ago
|
|
||
|
if [ "$#" -lt 2 ]; then
|
||
8 years ago
|
echo "Usage: $0 <slackware> <slackware64> [whitelist]" 1>&2
|
||
8 years ago
|
exit 1
|
||
|
fi
|
||
|
|
||
|
scriptdir="$(realpath "$(dirname "$0")")"
|
||
|
|
||
|
slackware="$1"
|
||
|
slackware64="$2"
|
||
8 years ago
|
whitelist="$3"
|
||
8 years ago
|
|
||
|
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?')"
|
||
|
|
||
8 years ago
|
if [ "$whitelist" ]; then
|
||
|
if ! grep -v '^#' "$whitelist" | fgrep -xq "$pkgname"; then
|
||
|
continue
|
||
|
fi
|
||
|
fi
|
||
|
|
||
8 years ago
|
case "$pkgarch" in
|
||
|
i?86) pkgarch=x86_64 ;;
|
||
8 years ago
|
# Architecture-independent stuff
|
||
|
noarch|fw) continue ;;
|
||
|
# Only kernel-headers uses x86 as pkgarch. That doesn't need conversion.
|
||
|
x86) continue ;;
|
||
|
*)
|
||
|
echo "WARNING: Package '$pkg' has an unsupported architecture: '$pkgarch'"
|
||
|
exit
|
||
|
;;
|
||
8 years ago
|
esac
|
||
|
|
||
8 years ago
|
if [ ! -f "$slackware64/$(dirname "$pkg")/$pkgname-$pkgver-$pkgarch-"*".$pkgext" ]; then
|
||
|
echo "WARNING: Package '$pkg' doesn't exist in slackware64, or there were multiple with different build versions."
|
||
8 years ago
|
continue
|
||
|
fi
|
||
|
|
||
|
rpkg="$(realpath "$slackware/$pkg")"
|
||
8 years ago
|
rpkg64="$(realpath "$slackware64/$(dirname "$pkg")/$pkgname-$pkgver-$pkgarch-"*".$pkgext")"
|
||
8 years ago
|
|
||
|
mkdir -p "$(dirname "$pkg")"
|
||
|
|
||
|
( cd "$(dirname "$pkg")"
|
||
|
"$scriptdir/convert32pkg.sh" "$rpkg" "$rpkg64"
|
||
|
)
|
||
|
done
|