tazpkg diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/cache	Mon Oct 05 03:53:47 2015 +0300
     1.3 @@ -0,0 +1,32 @@
     1.4 +#!/bin/sh
     1.5 +# TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
     1.6 +# cache - TazPkg module
     1.7 +# Work with package cache
     1.8 +
     1.9 +
    1.10 +# Connect function libraries
    1.11 +. /lib/libtaz.sh
    1.12 +
    1.13 +# Get TazPkg working environment
    1.14 +. @@MODULES@@/getenv
    1.15 +
    1.16 +
    1.17 +
    1.18 +
    1.19 +case $1 in
    1.20 +	clean)
    1.21 +		num=$(find "$CACHE_DIR" -name *.tazpkg | wc -l)
    1.22 +		size=$(du -hs "$CACHE_DIR" | cut -f1 | sed 's|\.0||')
    1.23 +		[ "$num" -eq 0 ] && size="0K"
    1.24 +
    1.25 +		title 'Cleaning cache directory...'
    1.26 +		action 'Path: %s' "$CACHE_DIR"
    1.27 +		find "$CACHE_DIR" -name '*.tazpkg' -delete
    1.28 +		status
    1.29 +
    1.30 +		footer "$(_p \
    1.31 +			'%s file removed from cache (%s).' \
    1.32 +			'%s files removed from cache (%s).' "$num" \
    1.33 +			"$(colorize 32 "$num")" "$size")"
    1.34 +		;;
    1.35 +esac
    1.36 \ No newline at end of file