]> git.pld-linux.org Git - projects/cleanbuild.git/blame - bin/cleanpoldekcache
Add verbosity to build output what script is doing
[projects/cleanbuild.git] / bin / cleanpoldekcache
CommitLineData
1eafe265 1#!/usr/bin/sudo /bin/sh
2
3CACHEDIR="$PWD/poldekcache"
4
7bd74451 5ignore() { }
4d64e496 6[ -r .cleanbuildrc ] && . ./.cleanbuildrc
1eafe265 7
8export LC_ALL=C
9unset LANGUAGE
10unset LANG
11
12cd "$CACHEDIR" || exit 1
7bd74451 13SIZE_IN=$(du -s . | sed 's/\t.*//')
1eafe265 14
15cleandir()
16{
17 DIR="$1"
18 /usr/bin/poldek --skip-installed -s "$DIR" --cachedir="$CACHEDIR" \
19 --shcmd="ls" > cleanpoldekcache.pkgs
20 for PKG in $(ls $DIR); do
21 case "$PKG" in
22 dirindex.pndir.tndb* | packages.ndir.*)
23 ;;
24 *)
25 if ! grep -q "${PKG%%.rpm}" cleanpoldekcache.pkgs; then
26 rm -v $DIR/$PKG
27 fi
28 ;;
29 esac
30 done
31 rm cleanpoldekcache.pkgs
32}
33
34for FILE in *; do
35 case "$FILE" in
36 ftp*.packages.i|http*.packages.i)
37 echo "removing $FILE if empty"
38 rmdir -v "$FILE"
39 ;;
40 ftp*|http*)
41 echo "cleaning inside $FILE"
42 cleandir "$FILE"
43 ;;
44 _* | tmpmd)
45 echo "removing $FILE"
46 rm -rv "$FILE"
47 ;;
48 *)
49 echo "removing $FILE"
50 rm -v "$FILE"
51 ;;
52 esac
53done
54
7bd74451 55SIZE_OUT=$(du -s . | sed 's/\t.*//')
56echo "Removed $(expr $SIZE_IN - $SIZE_OUT) kilobytes of data from poldek cache"
57
1eafe265 58# vim: ts=4 sw=4 filetype=sh
This page took 1.562611 seconds and 4 git commands to generate.