tazpkg annotate modules/cache @ rev 844

Finish modularization. Beta release: still have few FIXMEs and TODOs.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Oct 05 03:53:47 2015 +0300 (2015-10-05)
parents
children 21ac83abe572
rev   line source
al@844 1 #!/bin/sh
al@844 2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
al@844 3 # cache - TazPkg module
al@844 4 # Work with package cache
al@844 5
al@844 6
al@844 7 # Connect function libraries
al@844 8 . /lib/libtaz.sh
al@844 9
al@844 10 # Get TazPkg working environment
al@844 11 . @@MODULES@@/getenv
al@844 12
al@844 13
al@844 14
al@844 15
al@844 16 case $1 in
al@844 17 clean)
al@844 18 num=$(find "$CACHE_DIR" -name *.tazpkg | wc -l)
al@844 19 size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||')
al@844 20 [ "$num" -eq 0 ] && size="0K"
al@844 21
al@844 22 title 'Cleaning cache directory...'
al@844 23 action 'Path: %s' "$CACHE_DIR"
al@844 24 find "$CACHE_DIR" -name '*.tazpkg' -delete
al@844 25 status
al@844 26
al@844 27 footer "$(_p \
al@844 28 '%s file removed from cache (%s).' \
al@844 29 '%s files removed from cache (%s).' "$num" \
al@844 30 "$(colorize 32 "$num")" "$size")"
al@844 31 ;;
al@844 32 esac