cookutils diff lib/libcook.sh @ rev 431

move internal vars to libcook.sh and broken function
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 20 01:40:43 2012 +0200 (2012-05-20)
parents 50cd87593dae
children b7fc4308e7b4
line diff
     1.1 --- a/lib/libcook.sh	Sat May 19 05:17:29 2012 +0200
     1.2 +++ b/lib/libcook.sh	Sun May 20 01:40:43 2012 +0200
     1.3 @@ -13,3 +13,35 @@
     1.4  # System wide config can be overwriten by a cook.conf in current path.
     1.5  [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
     1.6  [ -f "cook.conf" ] && . ./cook.conf
     1.7 +
     1.8 +# Shared DB between Cook, the Cooker and Cookiso.
     1.9 +# In cookiso: repo= --> flavors
    1.10 +flavors="$SLITAZ/flavors"
    1.11 +activity="$CACHE/activity"
    1.12 +commits="$CACHE/commits"
    1.13 +cooklist="$CACHE/cooklist"
    1.14 +cookorder="$CACHE/cookorder"
    1.15 +command="$CACHE/command"
    1.16 +blocked="$CACHE/blocked"
    1.17 +broken="$CACHE/broken"
    1.18 +cooknotes="$CACHE/cooknotes"
    1.19 +crontabs="/var/spool/cron/crontabs/root"
    1.20 +
    1.21 +# Lograte activity.
    1.22 +[ -s "$activity" ] && tail -n 60 $activity > /tmp/tail-$$ && \
    1.23 +	mv -f /tmp/tail-$$ $activity
    1.24 +
    1.25 +# Log activities, we want first letter capitalized.
    1.26 +# TODO: use /lib/libtaz.sh log() but need to change all:
    1.27 +# echo "Message" | log --> log "Message"
    1.28 +log() {
    1.29 +	grep ^[A-Z] | \
    1.30 +		sed s"#^[A-Z]\([^']*\)#$(date '+%Y-%m-%d %H:%M') : \0#" >> $activity
    1.31 +}
    1.32 +
    1.33 +# Log broken packages.
    1.34 +broken() {
    1.35 +	if ! grep -q "^$pkg$" $broken; then
    1.36 +		echo "$pkg" >> $broken
    1.37 +	fi
    1.38 +}