Cheers, Geoff
Does anyone have a straightforward method for removing old versions of a package from a local repo? There will be cases where we discover a security flaw in an old release, and just want to delete all but the most recent version.
Cheers, Geoff
--
You received this message because you are subscribed to the Google Groups "aptly-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aptly-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to aptly-discuss+unsubscribe@googlegroups.com.
#!/bin/sh
set -x
set -e
repo=_my_repo_
arch=amd64
dup=false
for p in `aptly repo search $repo "Architecture ($arch)" | sort -V`
do
pkg=`echo $p | sed 's,_.*,,'`
if test "$pkg" = "$pkg_old"
then
dup=true
elif $dup
then
dup=false
# $p_old is latest version of some package with more than one version
# Output a search spec for all versions older than this
# Version is 2nd field in output of aptly repo search, separated by _
v_old=`echo $p_old | cut -d_ -f2`
aptly repo remove $repo "$pkg_old (<< $v_old) Architecture ($arch)"
fi
p_old="$p"
pkg_old="$pkg"
done