Skip to content

Commit 8c3a4a8

Browse files
committed
zerocracy#277 make factbase filename configurable
The factbase filename was hardcoded as "base.fb". If the server or baza.rb ever changes the filename (or stores multiple factbases), entry.sh silently fails with a confusing error from judges. Now accepts three sources (first wins): 1. The third argument: entry.sh <id> <home> <fb_file> 2. FB_FILE environment variable 3. Default: "base.fb" (backwards compatible) No breaking changes — existing callers without $3 keep working with the default filename.
1 parent e429c0f commit 8c3a4a8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

entry.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fi
1313

1414
home=$2
1515
if [ -z "${home}" ]; then
16-
echo "The second argument must be the directory where 'base.fb' is located"
16+
echo "The second argument must be the directory with the factbase"
1717
exit 1
1818
fi
1919

@@ -22,6 +22,8 @@ if [ ! -d "${home}" ]; then
2222
exit 1
2323
fi
2424

25+
fb_file=${3:-${FB_FILE:-base.fb}}
26+
2527
if ! command -v judges &>/dev/null; then
2628
echo "'judges' executable not found. Make sure the 'judges' gem is installed."
2729
exit 1
@@ -30,4 +32,4 @@ fi
3032
self=$(dirname "$(readlink -f "$0")")
3133

3234
judges update --summary --max-cycles=3 --no-log \
33-
--option "id=${id}" --lib "${self}/lib" "${self}/judges" "${home}/base.fb"
35+
--option "id=${id}" --lib "${self}/lib" "${self}/judges" "${home}/${fb_file}"

0 commit comments

Comments
 (0)