Is there a script to remove old packages from local disk
Fergus
fergus@bonhard.uklinux.net
Wed Jun 17 12:30:00 GMT 2009
Assume your local Cygwin repository is under some /pathname/ for example:
/g/users/yourname/cygfiles/setup.ini AND
/g/users/yourname/cygfiles/release/*
or you can have spaces if you like:
/h/my name/cygnus solutions/setup.ini AND /h/my name/cygnus
solutions/release/*
As setup.ini advances with time and you augment the subdirectory
release/, it becomes bloated with more and more redundant files. It can
be cleaned out using the following script with the syntax
clean /pathname/
for example
clean /g/users/yourname/cygfiles/ # note leading and trailing /s
or
clean /h/my\ name/cygnus\ solutions/ # note handling of spaces achieved
eg by Tab-completion
(By the way: the reason the script looks so horrible is entirely because
it is constructed to cope with the possibility of spaces in the
repository pathname. If there were guaranteed no spaces, the
line-by-line syntax would be much easier. But the job the script does is
very simple.)
This is the script:
#! /bin/sh
# clean
cat "$1setup.ini" | sed -n '/release\//p' | sed 's/^.*release\///g' |\
sed 's/\( [a-f0-9]*\)*$//g' | sort | uniq > setup.1
find "$1release/" -type f | sed -e 's/^.*release\///g' | sort > setup.2
diff setup.1 setup.2 | grep ">" > setup.3
cat setup.3 | sed -e 's:> :rm -vfr "'"$1"'release\/:g ; s/$/"/g' | bash
If you are nervous about what you might delete you can replace the last
line with
cat setup.3 | sed -e 's:> :rm -vfr "'"$1"'release\/:g ; s/$/"/g' > setup.4
and then
bash setup.4
when you are happy with what the script does.
Key:
setup.1 lists all the release files referred to in setup.ini, including
[prev] and *src*
setup.2 lists all the release files in your repository /pathname/
setup.3 identifies those files in your repository not referred to in
setup.ini
setup.4 is the script that deletes all these unnecessary files
Fergus
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list