cookutils annotate 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 |
rev | line source |
---|---|
al@1012 | 1 #!/bin/sh |
al@1012 | 2 # |
al@1012 | 3 # precheck - module of the SliTaz Cook |
al@1012 | 4 # Preliminary checks of the receipt, made before the beginning of work. |
al@1012 | 5 # Copyright (C) SliTaz GNU/Linux - GNU GPL v3 |
al@1012 | 6 # |
al@1012 | 7 |
al@1012 | 8 . /usr/lib/slitaz/libcook.sh |
al@1012 | 9 |
al@1012 | 10 |
al@1012 | 11 receipt="$(realpath $1)" |
al@1012 | 12 |
al@1012 | 13 _ 'QA: checking package receipt...' |
al@1012 | 14 |
al@1012 | 15 for var in PACKAGE VERSION CATEGORY SHORT_DESC MAINTAINER WEB_SITE; do |
al@1012 | 16 unset value |
al@1012 | 17 value="$(. $receipt; eval echo \$$var)" |
al@1012 | 18 # L10n: QA is quality assurance |
al@1012 | 19 [ -n "$value" ] || die 'QA: empty variable: %s' "$var=\"\"" |
al@1012 | 20 |
al@1012 | 21 case "$var" in |
al@1012 | 22 CATEGORY) |
al@1012 | 23 valid="$(echo $PKGS_CATEGORIES)" # avoid newlines |
al@1012 | 24 if ! echo " $valid " | grep -q " $value "; then |
al@1012 | 25 _ 'QA: unknown category "%s"' "$value" |
al@1012 | 26 die 'Please, use one of: %s' "$valid" |
al@1012 | 27 fi |
al@1012 | 28 ;; |
al@1012 | 29 WEB_SITE) |
al@1012 | 30 # We don't check WGET_URL since if dl is needed it will fail. |
al@1012 | 31 # Break also if we're not online. Here error is not fatal. |
al@1012 | 32 if ifconfig | grep -A1 '^[a-z]*[0-9]' | fgrep -q 'addr:' && |
al@1012 | 33 ! busybox wget -T 12 --spider $value 2>/dev/null; then |
al@1012 | 34 _ 'QA: unable to reach "%s"' "$value" |
al@1012 | 35 fi |
al@1012 | 36 ;; |
al@1012 | 37 esac |
al@1012 | 38 done |