Build legacy drivers and publish per-OS packages with web activation and DEB

This commit is contained in:
2026-11-27 20:55:31 +00:00
96 changed files with 3204 additions and 25 deletions

View File

@@ -18,12 +18,17 @@ cat > "$cfg" <<'CONF'
99 PRESERVE
CONF
chmod 600 "$cfg"
start(){ ./build/mars_vme --config "$cfg" --www "$PWD/websetup" --bind 127.0.0.1 --port "$port" --no-services >"$d/log" 2>&1 & pid=$!; for i in $(seq 1 70); do if curl -fsS "$base/login" >/dev/null 2>&1 && kill -0 "$pid"; then return; fi; sleep .1; done; cat "$d/log" >&2; return 1; }
mkdir -p "$d/www/drivers"
cp websetup/* "$d/www/"
printf 'ZIP fixture bytes' > "$d/www/drivers/WIN95.zip"
printf '{"platforms":["WIN95"],"map":"test"}' > "$d/www/drivers/enabled.json"
start(){ ./build/mars_vme --config "$cfg" --www "$d/www" --bind 127.0.0.1 --port "$port" --no-services >"$d/log" 2>&1 & pid=$!; for i in $(seq 1 70); do if curl -fsS "$base/login" >/dev/null 2>&1 && kill -0 "$pid"; then return; fi; sleep .1; done; cat "$d/log" >&2; return 1; }
get(){ curl -fsS -b "$d/cookie" "$base/$1"; }
post(){ curl -fsS -b "$d/cookie" -c "$d/cookie" -H "Origin: $base" -H 'Content-Type: application/json' -H "X-Mars-CSRF: ${csrf:-}" -d "$2" "$base/$1"; }
status(){ curl -sS -o "$d/response" -w '%{http_code}' "$@"; }
start
[[ $(status "$base/api/state") == 401 ]]
[[ $(status "$base/drivers/WIN95.zip") == 401 ]]
[[ $(status -H 'Host: evil.example' "$base/login") == 403 ]]
[[ $(status -H 'Content-Type: application/json' -d '{"user":"admin","password":"admin"}' "$base/api/login") == 403 ]]
post api/login '{"user":"admin","password":"admin"}' | jq -e .ok >/dev/null
@@ -34,6 +39,10 @@ post api/password '{"current":"admin","new":"NativeTestPassword123","repeat":"Na
[[ $(status -b "$d/old-cookie" "$base/api/state") == 401 ]]
post api/login '{"user":"admin","password":"NativeTestPassword123"}' | jq -e .ok >/dev/null
s=$(get api/state); jq -e '(.defaultPassword|not) and (.text|contains("99 PRESERVE"))' <<<"$s" >/dev/null
get drivers/WIN95.zip > "$d/download.zip"
cmp "$d/download.zip" "$d/www/drivers/WIN95.zip"
[[ $(status -b "$d/cookie" "$base/drivers/WINXP.zip") == 404 ]]
get api/drivers | jq -e '.platforms==["WIN95"]' >/dev/null
csrf=$(jq -r .csrf <<<"$s"); rev=$(jq -r .revision <<<"$s"); dev=$(jq -r '.devices[0].name // empty' <<<"$s")
if [[ -n $dev ]]; then
request=$(jq -nc --arg rev "$rev" --arg dev "$dev" '{revision:$rev,mode:"guided",groups:{"2":["NEW"],"4":[("0x101 "+$dev+" 802.3 1")]}}')