tazpkg view modules/cache @ rev 898

Module 'get': fix temp dir; module 'find-depends': faster search, add debug messages
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Dec 29 22:00:47 2015 +0200 (2015-12-29)
parents 21ac83abe572
children
line source
1 #!/bin/sh
2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
3 # cache - TazPkg module
4 # Work with package cache
7 # Connect function libraries
8 . /lib/libtaz.sh
10 # Get TazPkg working environment
11 . @@MODULES@@/getenv
16 num=$(find "$CACHE_DIR" -name '*.tazpkg' | wc -l)
17 size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||')
18 [ "$num" -eq 0 ] && size="0K"
20 case $1 in
21 clean)
22 title 'Cleaning cache directory...'
23 action 'Path: %s' "$CACHE_DIR"
24 find "$CACHE_DIR" -name '*.tazpkg' -delete
25 status
27 footer "$(_p \
28 '%s file removed from cache (%s).' \
29 '%s files removed from cache (%s).' "$num" \
30 "$(colorize 32 "$num")" "$size")"
31 ;;
33 list)
34 title 'Packages cache'
35 find "$CACHE_DIR" -name '*.tazpkg' -exec busybox ls -lh \{\} \; | \
36 awk '{printf "%s (%s)\n", $9, $5}'
37 footer "$(_p \
38 '%s file (%s)' \
39 '%s files (%s)' "$num" \
40 "$(colorize 32 "$num")" "$size")"
41 ;;
43 esac