cookutils view lib/libcook.sh @ rev 813
cooker.cgi: show htm
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jul 05 21:55:50 2016 +0200 (2016-07-05) |
parents | 4a8b50205b09 |
children | dc6b6e10da97 |
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 modifying 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
14 # System wide config can be overwritten by a cook.conf in current path.
16 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
17 [ -f "cook.conf" ] && . ./cook.conf
20 # Shared DB between Cook, the Cooker and Cookiso.
21 # In cookiso: repo= --> flavors
23 if [ "$(basename $0)" = 'cookiso' ]; then
24 cache="$CACHE/cookiso"
25 #cookiso variables
26 repo="$SLITAZ/flavors"
27 iso="$SLITAZ/iso"
28 rollog="$cache/rolling.log"
29 synclog="$cache/rsync.log"
30 else
31 cache="$CACHE"
32 fi
34 flavors="$SLITAZ/flavors"
35 activity="$cache/activity"
36 commits="$cache/commits"
37 cooklist="$cache/cooklist"
38 cookorder="$cache/cookorder"
39 command="$cache/command"
40 blocked="$cache/blocked"
41 broken="$cache/broken"
42 wokrev="$cache/wokrev"
43 cooknotes="$cache/cooknotes"
44 cooktime="$cache/cooktime"
45 crontabs="/var/spool/cron/crontabs/root"
48 # Lograte activity.
50 [ -s "$activity" ] && tail -n 60 $activity > /tmp/tail-$$ && \
51 mv -f /tmp/tail-$$ $activity
54 # Log activities, we want first letter capitalized.
55 # TODO: use /lib/libtaz.sh log() but need to change all:
56 # echo "Message" | log --> log "Message"
58 log() {
59 grep ^[A-Z] | \
60 sed s"#^[A-Z]\([^']*\)#$(date -u '+%F %R') : \0#" >> $activity
61 }
64 # Log broken packages.
66 broken() {
67 if ! grep -q "^$pkg$" $broken; then
68 echo "$pkg" >> $broken
69 fi
70 }