cookutils view modules/precheck @ rev 1012
Separate modules/precheck from cook (next will be modules/getsrc); cook: fix bug preventing meta-packages to be included in receipt v2; lighttpd/index.cgi: show cooker state in the title (web browser show special icon if background page title has changed).
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Nov 24 14:39:52 2017 +0200 (2017-11-24) |
parents | |
children | 772ff37fe068 |
line source
1 #!/bin/sh
2 #
3 # precheck - module of the SliTaz Cook
4 # Preliminary checks of the receipt, made before the beginning of work.
5 # Copyright (C) SliTaz GNU/Linux - GNU GPL v3
6 #
8 . /usr/lib/slitaz/libcook.sh
11 receipt="$(realpath $1)"
13 _ 'QA: checking package receipt...'
15 for var in PACKAGE VERSION CATEGORY SHORT_DESC MAINTAINER WEB_SITE; do
16 unset value
17 value="$(. $receipt; eval echo \$$var)"
18 # L10n: QA is quality assurance
19 [ -n "$value" ] || die 'QA: empty variable: %s' "$var=\"\""
21 case "$var" in
22 CATEGORY)
23 valid="$(echo $PKGS_CATEGORIES)" # avoid newlines
24 if ! echo " $valid " | grep -q " $value "; then
25 _ 'QA: unknown category "%s"' "$value"
26 die 'Please, use one of: %s' "$valid"
27 fi
28 ;;
29 WEB_SITE)
30 # We don't check WGET_URL since if dl is needed it will fail.
31 # Break also if we're not online. Here error is not fatal.
32 if ifconfig | grep -A1 '^[a-z]*[0-9]' | fgrep -q 'addr:' &&
33 ! busybox wget -T 12 --spider $value 2>/dev/null; then
34 _ 'QA: unable to reach "%s"' "$value"
35 fi
36 ;;
37 esac
38 done