Small tool to skip downloading both packages and their respective patches. Useful for those with frequent new installs, esp multiple machines.
Code:
#!/bin/bash
# Generate an rsync filter containing any original package that has
# a corresponding patch package. Avoid double download penality
# for installations with patches.
#
# After normal installation and before reboot: 'installpkg patches/packages/*.txz'
# rather than 'upgradepkg'
# tested on: slackware64, slackwarearm-15.0. -current is ALL patches ;)
RSYNC=rsync://slackware.uk/slackwarearm/slackwarearm-15.0/
RSYNC=rsync://slackware.osuosl.org/slackware/slackware64-15.0/
RSYNC_ADD="" # like exclude-from=
PATCHES=/tmp/patches.list
PACKAGES=/tmp/packages.list
EXCLUDES=/tmp/excludes.list
###########
RSYNC_OPS="--include='/*' --include='/slackware*/***' --include='/patches/packages/***' --exclude='*'"
echo "$RSYNC $RSYNC_ADD ===
lists ..."
for LIST in $PATCHES $PACKAGES $EXCLUDES; do
echo "# $RSYNC $( date )" > $LIST
done
rsync -avn $RSYNC $RSYNC_OPS $RSYNC_ADD |
awk -F / -v Patches=$PATCHES -v Packages=$PACKAGES '\
/ patches\/packages\/.*txz$/ { print $NF >> Patches; system("") }
/ slackware.*\/.*txz$/ { print $(NF-1)"/"$NF >> Packages; system("") }
/^d/ && NF<4 { print substr($NF,12); next }'
echo "filter ..."
for PATCH in $( grep -v '^#' $PATCHES ); do
KEY="\/$( echo $PATCH | sed 's/-[0-9].*/-[0-9]/' )"
sed -n "/$KEY/{s/^/- /; s/.txz/\*/p}" $PACKAGES
done | sort >> $EXCLUDES
echo "exclude-from file: $EXCLUDES"
Code:
$ excludes; for i in /tmp/{excludes,patches,packages}.list; do head -vn 5 $i; done
rsync://slackware.osuosl.org/slackware/slackware64-15.0/ ===
lists ...
.
EFI
extra
isolinux
kernels
pasture
patches
slackware64
source
testing
usb-and-pxe-installers
filter ...
exclude-from file: /tmp/excludes.list
==> /tmp/excludes.list <==
# rsync://slackware.osuosl.org/slackware/slackware64-15.0/ Tue May 21 17:52:38 PDT 2024
- a/aaa_base-15.0-x86_64-3*
- a/aaa_glibc-solibs-2.33-x86_64-5*
- a/coreutils-9.0-x86_64-3*
- a/dcron-4.5-x86_64-11*
==> /tmp/patches.list <==
# rsync://slackware.osuosl.org/slackware/slackware64-15.0/ Tue May 21 17:52:38 PDT 2024
Cython-0.29.36-x86_64-1_slack15.0.txz
LibRaw-0.20.2-x86_64-4_slack15.0.txz
aaa_base-15.0-x86_64-4_slack15.0.txz
aaa_glibc-solibs-2.33-x86_64-6_slack15.0.txz
==> /tmp/packages.list <==
# rsync://slackware.osuosl.org/slackware/slackware64-15.0/ Tue May 21 17:52:38 PDT 2024
a/aaa_base-15.0-x86_64-3.txz
a/aaa_glibc-solibs-2.33-x86_64-5.txz
a/aaa_libraries-15.0-x86_64-19.txz
a/aaa_terminfo-6.3-x86_64-1.txz