1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#!/bin/bash
# BNW container tool check -- verify that every unix tool the BNW
# source code calls externally is present in the container.
#
# Run INSIDE the container (e.g. over ssh):
# ./test/check_container_tools.sh
#
# The tool list is derived from a scan of the BNW sources
# (shell_exec/system/proc_open calls, octave system() calls, script
# shebangs and hardcoded paths). See README.md for the mapping.
set -u
FAILED=0
check_tool() {
# check_tool <name> [where-used]
local name="$1" usage="${2:-}"
if command -v "$name" >/dev/null 2>&1; then
echo "OK $name ($usage)"
else
echo "MISSING $name ($usage)"
FAILED=$((FAILED+1))
fi
}
check_path() {
# check_path <absolute-path> <what-provides-it>
local path="$1" note="$2"
if [ -e "$path" ]; then
echo "OK $path ($note)"
else
echo "MISSING $path ($note)"
FAILED=$((FAILED+1))
fi
}
echo "== BNW required tools =="
# --- core shell / coreutils (bnw container packages) ---
check_tool bash "run.sh, examplefilecopy.sh, delete_cv_pred.sh, wrappers"
check_tool sh "php shell_exec()/system() shell"
check_tool mkdir "run.sh, octave prepareInput.m"
check_tool rm "run.sh, delete_cv_pred.sh"
check_tool cp "filecopy.sh, examplefilecopy.sh, octave copyfile"
check_tool cut "home.php cpu check pipeline"
check_tool wc "var_lib_genenet_bnw/run.sh"
check_tool cat "misc pipeline glue"
# --- interpreters ---
# octave and python are not on the container PATH; the guix package
# patches every shebang (run_scripts/* -> store octave-cli, the .py
# scripts -> store python3), so check the store binaries instead.
if ls /gnu/store/*-octave-cli*/bin/octave >/dev/null 2>&1; then
echo "OK octave (store octave-cli, via patched shebangs)"
else
echo "MISSING octave (store octave-cli)"; FAILED=$((FAILED+1))
fi
if ls /gnu/store/*-python-3*/bin/python3 >/dev/null 2>&1; then
echo "OK python3 (store python, via patched shebangs)"
else
echo "MISSING python3 (store python)"; FAILED=$((FAILED+1))
fi
# --- compiled BNW binaries (var_lib_genenet_bnw, data dir) ---
for bin in network_score structure; do
check_path "/var/lib/genenet/bnw/$bin" "structure learning"
done
for bin in get_kbest_nets get_kbest_parents; do
check_path "/var/lib/genenet/bnw/k-best/src/$bin" "k-best model averaging"
done
# --- third-party binaries ---
check_tool dot "network layout (php /usr/bin/dot, octave createSVG)"
# --- php-side unix calls (home.php 'top -b -n 2 -u apache | grep ...') ---
check_tool top "home.php CPU check (vestigial)"
check_tool grep "home.php CPU check pipeline"
echo
if [ "$FAILED" -eq 0 ]; then
echo "== all required tools present =="
exit 0
fi
echo "== $FAILED tool(s) missing =="
exit 1
|