cookutils view lib/libcook.sh @ rev 1148

cook: typo
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 09 15:36:25 2021 +0000 (2021-11-09)
parents 0f7c6348363c
children
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"
46 tasks="$SLITAZ/tasks"
49 # Lograte activity.
51 [ -s "$activity" ] && tail -n 1000 $activity > /tmp/tail-$$ && \
52 mv -f /tmp/tail-$$ $activity
55 # Log activities, we want first letter capitalized.
56 # TODO: use /lib/libtaz.sh log() but need to change all:
57 # echo "Message" | log --> log "Message"
59 log() {
60 grep '^[A-Z]' | \
61 sed s"#^[A-Z]\([^']*\)#$(date -u '+%F %R') : \0#" >> $activity
62 }
65 # Log broken packages.
67 broken() {
68 if ! grep -q "^$pkg$" $broken; then
69 echo "$pkg" >> $broken
70 fi
71 }