Inventarzugang sicher in Werkstatt-Build einbetten
Some checks failed
Tests / test (push) Has been cancelled
Some checks failed
Tests / test (push) Has been cancelled
This commit is contained in:
@@ -6,6 +6,7 @@ OUT=${1:-$ROOT/dist/csr-intake-x86_64.run}
|
||||
GUI="$ROOT/gui/target/release/intake-gui"
|
||||
SCANNER="$ROOT/scanner/target/release/pc-intake"
|
||||
MANIFEST="$ROOT/build/release.json"
|
||||
BUNDLE_CONFIG=${CSR_BUNDLE_CONFIG_DIR:-$ROOT/.bundle-secrets}
|
||||
|
||||
for file in "$GUI" "$SCANNER" "$MANIFEST"; do
|
||||
[[ -f $file ]] || {
|
||||
@@ -33,9 +34,31 @@ install -m755 "$GUI" "$TMP/app/intake-gui"
|
||||
install -m755 "$SCANNER" "$TMP/app/pc-intake"
|
||||
install -m644 "$MANIFEST" "$TMP/app/release.json"
|
||||
python3 "$ROOT/scripts/release-manifest.py" --verify-release "$TMP/app"
|
||||
|
||||
contains_credentials=0
|
||||
if [[ -f $BUNDLE_CONFIG/inventory-api-key && -f $BUNDLE_CONFIG/inventory-server.crt ]]; then
|
||||
key=$(tr -d '\r\n' < "$BUNDLE_CONFIG/inventory-api-key")
|
||||
[[ -n $key && $key != *[[:space:]]* ]] || {
|
||||
echo 'Bundled inventory API key is empty or malformed.' >&2
|
||||
exit 2
|
||||
}
|
||||
openssl x509 -in "$BUNDLE_CONFIG/inventory-server.crt" -noout -checkend 0 >/dev/null || {
|
||||
echo 'Bundled inventory certificate is invalid or expired.' >&2
|
||||
exit 2
|
||||
}
|
||||
mkdir -m700 "$TMP/app/default-config"
|
||||
install -m600 "$BUNDLE_CONFIG/inventory-api-key" "$TMP/app/default-config/inventory-api-key"
|
||||
install -m600 "$BUNDLE_CONFIG/inventory-server.crt" "$TMP/app/default-config/inventory-server.crt"
|
||||
printf '%s\n' '{"url":"https://192.168.178.17"}' > "$TMP/app/default-config/inventory.json"
|
||||
chmod 600 "$TMP/app/default-config/inventory.json"
|
||||
contains_credentials=1
|
||||
elif [[ -e $BUNDLE_CONFIG/inventory-api-key || -e $BUNDLE_CONFIG/inventory-server.crt ]]; then
|
||||
echo 'Both inventory-api-key and inventory-server.crt are required for bundled configuration.' >&2
|
||||
exit 2
|
||||
fi
|
||||
(
|
||||
cd "$TMP/app"
|
||||
sha256sum intake-gui pc-intake release.json > SHA256SUMS
|
||||
find . -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS
|
||||
)
|
||||
tar -C "$TMP/app" -czf "$TMP/payload.tar.gz" .
|
||||
|
||||
@@ -102,6 +125,18 @@ done
|
||||
exit 2
|
||||
}
|
||||
|
||||
if [ -d "\$app_dir/default-config" ]; then
|
||||
config_dir=\$data_dir/config
|
||||
mkdir -p "\$config_dir"
|
||||
chmod 700 "\$config_dir"
|
||||
for name in inventory.json inventory-api-key inventory-server.crt; do
|
||||
target=\$config_dir/\$name
|
||||
if [ ! -e "\$target" ]; then
|
||||
install -m600 "\$app_dir/default-config/\$name" "\$target"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
workshop_config=\$data_dir/config/workshop.json
|
||||
if [ -f "\$workshop_config" ]; then
|
||||
keyboard_layout=\$(python3 - "\$workshop_config" <<'PY' 2>/dev/null || true
|
||||
@@ -127,6 +162,14 @@ EOF
|
||||
payload_line=$(( $(wc -l < "$TMP/launcher") + 1 ))
|
||||
sed -i "s/__PAYLOAD_LINE__/$payload_line/" "$TMP/launcher"
|
||||
cat "$TMP/launcher" "$TMP/payload.tar.gz" > "$OUT"
|
||||
chmod 755 "$OUT"
|
||||
if [[ $contains_credentials -eq 1 ]]; then
|
||||
chmod 700 "$OUT"
|
||||
else
|
||||
chmod 755 "$OUT"
|
||||
fi
|
||||
"$OUT" --check-bundle
|
||||
echo "Standalone executable created: $OUT"
|
||||
if [[ $contains_credentials -eq 1 ]]; then
|
||||
echo "Standalone executable created with inventory configuration: $OUT"
|
||||
else
|
||||
echo "Standalone executable created: $OUT"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user