[fix] VerNum
This commit is contained in:
parent
68cedff1d9
commit
0827882bb3
30 changed files with 1651 additions and 240 deletions
58
scripts/build-release-bundle.sh
Normal file
58
scripts/build-release-bundle.sh
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "$#" -ne 6 ]]; then
|
||||
echo "usage: $0 BINARY_DIRECTORY PRODUCT_VERSION UPDATE_MANIFEST_URL UPDATE_PUBLIC_KEY UPDATE_SIGNATURE_URL OUTPUT.zip" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
binary_directory="$1"
|
||||
product_version="$2"
|
||||
update_manifest_url="$3"
|
||||
update_public_key="$4"
|
||||
update_signature_url="$5"
|
||||
output="$6"
|
||||
repository_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
contract="$repository_directory/iota-installer/bundle-files.txt"
|
||||
staging_directory="$(mktemp -d)"
|
||||
trap 'rm -rf "$staging_directory"' EXIT
|
||||
|
||||
if [[ ! "$product_version" =~ ^[0-9A-Za-z][0-9A-Za-z.+_-]*$ ]]; then
|
||||
echo "product version contains unsupported characters: $product_version" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$output")"
|
||||
output="$(cd "$(dirname "$output")" && pwd)/$(basename "$output")"
|
||||
bundle_files=()
|
||||
|
||||
while IFS= read -r bundle_path; do
|
||||
[[ -n "$bundle_path" ]] || continue
|
||||
bundle_files+=("$bundle_path")
|
||||
destination="$staging_directory/$bundle_path"
|
||||
mkdir -p "$(dirname "$destination")"
|
||||
|
||||
case "$bundle_path" in
|
||||
bin/*)
|
||||
install -m 0755 "$binary_directory/${bundle_path#bin/}" "$destination"
|
||||
;;
|
||||
manifest.json)
|
||||
printf '{"product_version":"%s"}\n' "$product_version" > "$destination"
|
||||
;;
|
||||
systemd/update.env)
|
||||
printf 'IOTA_UPDATE_MANIFEST=%s\nIOTA_UPDATE_PUBLIC_KEY=%s\nIOTA_UPDATE_SIGNATURE=%s\n' \
|
||||
"$update_manifest_url" \
|
||||
"$update_public_key" \
|
||||
"$update_signature_url" \
|
||||
> "$destination"
|
||||
;;
|
||||
*)
|
||||
install -m 0644 "$repository_directory/$bundle_path" "$destination"
|
||||
;;
|
||||
esac
|
||||
done < "$contract"
|
||||
|
||||
(
|
||||
cd "$staging_directory"
|
||||
zip -q "$output" "${bundle_files[@]}"
|
||||
)
|
||||
55
scripts/build-update-manifest.sh
Normal file
55
scripts/build-update-manifest.sh
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "$#" -ne 8 ]]; then
|
||||
echo "usage: $0 BINARY_DIRECTORY PRODUCT_VERSION CHANNEL PUBLISHED_AT OS ARCHITECTURE BASE_URL OUTPUT.json" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
binary_directory="$1"
|
||||
product_version="$2"
|
||||
channel="$3"
|
||||
published_at="$4"
|
||||
operating_system="$5"
|
||||
architecture="$6"
|
||||
base_url="$(printf '%s' "$7" | sed 's#/$##')"
|
||||
output="$8"
|
||||
repository_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
contract="$repository_directory/iota-updater/artifacts.tsv"
|
||||
staging_directory="$(mktemp -d)"
|
||||
artifacts="$staging_directory/artifacts.jsonl"
|
||||
trap 'rm -rf "$staging_directory"' EXIT
|
||||
|
||||
while IFS=$'\t' read -r role artifact_path; do
|
||||
[[ -n "$role" && -n "$artifact_path" ]] || continue
|
||||
asset_name="$(basename "$artifact_path")"
|
||||
source_path="$binary_directory/$asset_name"
|
||||
jq -n \
|
||||
--arg role "$role" \
|
||||
--arg os "$operating_system" \
|
||||
--arg architecture "$architecture" \
|
||||
--arg path "$artifact_path" \
|
||||
--arg url "$base_url/$asset_name" \
|
||||
--arg sha256 "$(sha256sum "$source_path" | cut -d ' ' -f 1)" \
|
||||
--argjson size "$(stat -c %s "$source_path")" \
|
||||
'{role: $role, os: $os, architecture: $architecture, path: $path, url: $url, sha256: $sha256, size: $size}' \
|
||||
>> "$artifacts"
|
||||
done < "$contract"
|
||||
|
||||
mkdir -p "$(dirname "$output")"
|
||||
jq -s \
|
||||
--arg product_version "$product_version" \
|
||||
--arg channel "$channel" \
|
||||
--arg published_at "$published_at" \
|
||||
--arg release_signing_key_id "primary" \
|
||||
'{
|
||||
product_version: $product_version,
|
||||
channel: $channel,
|
||||
published_at: $published_at,
|
||||
minimum_data_schema: 1,
|
||||
supported_ipc_min: 2,
|
||||
supported_ipc_max: 4,
|
||||
artifacts: .,
|
||||
release_signing_key_id: $release_signing_key_id,
|
||||
rollback_compatible: true
|
||||
}' "$artifacts" > "$output"
|
||||
Loading…
Reference in a new issue