cookutils view lib/libcook.sh @ rev 460

libcook.sh: Add wan_db, dep_db, lib_db, and fullco variables.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Jun 07 15:23:30 2012 +0000 (2012-06-07)
parents b7fc4308e7b4
children b94be6aaa804
line source
1 #!/bin/sh
2 #
3 # Cook library - Shared configs and functions between cook, the cooker and
4 # cookiso. Read the README before adding or modifing any code in libcook.sh!
5 #
6 # Copyright (C) SliTaz GNU/Linux - GNU gpl v3
7 # Author: Christophe Lincoln <pankso@slitaz.org>
8 #
9 . /lib/libtaz.sh
10 . /usr/lib/slitaz/libpkg.sh
11 . /etc/slitaz/slitaz.conf
13 # System wide config can be overwriten by a cook.conf in current path.
14 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
15 [ -f "cook.conf" ] && . ./cook.conf
17 # Shared DB between Cook, the Cooker and Cookiso.
18 # In cookiso: repo= --> flavors
19 if [ "$(basename $0)" = "cookiso" ]; then
20 cache="$CACHE/cookiso"
21 #cookiso variables
22 repo="$SLITAZ/flavors"
23 iso="$SLITAZ/iso"
24 rollog="$cache/rolling.log"
25 synclog="$cache/rsync.log"
26 else
27 cache="$CACHE"
28 fi
30 flavors="$SLITAZ/flavors"
31 activity="$cache/activity"
32 commits="$cache/commits"
33 cooklist="$cache/cooklist"
34 cookorder="$cache/cookorder"
35 command="$cache/command"
36 blocked="$cache/blocked"
37 broken="$cache/broken"
38 cooknotes="$cache/cooknotes"
39 crontabs="/var/spool/cron/crontabs/root"
41 wan_db="$INCOMING/wanted.txt"
42 dep_db="$INCOMING/depends.txt"
43 lib_db="$INCOMING/libraries.txt"
44 # full cookorder
45 fullco="$PKGS/fullco.txt"
47 # Lograte activity.
48 [ -s "$activity" ] && tail -n 60 $activity > /tmp/tail-$$ && \
49 mv -f /tmp/tail-$$ $activity
51 # Log activities, we want first letter capitalized.
52 # TODO: use /lib/libtaz.sh log() but need to change all:
53 # echo "Message" | log --> log "Message"
54 log() {
55 grep ^[A-Z] | \
56 sed s"#^[A-Z]\([^']*\)#$(date '+%Y-%m-%d %H:%M') : \0#" >> $activity
57 }
59 # Log broken packages.
60 broken() {
61 if ! grep -q "^$pkg$" $broken; then
62 echo "$pkg" >> $broken
63 fi
64 }