aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/mkimage-yaml.sh74
-rw-r--r--scripts/mkimage.sh14
2 files changed, 88 insertions, 0 deletions
diff --git a/scripts/mkimage-yaml.sh b/scripts/mkimage-yaml.sh
new file mode 100755
index 0000000000..b3e49626a0
--- /dev/null
+++ b/scripts/mkimage-yaml.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+progname=$(basename $0)
+
+usage() {
+ echo "usage: $progname --checksums <checksums> --arch <arch> FILE..."
+}
+
+checksums="sha256 sha512"
+while [ $# -gt 0 ]; do
+ opt="$1"
+ shift
+ case "$opt" in
+ --checksums) checksums="$1"; shift ;;
+ --arch) arch="$1"; shift ;;
+ --branch) branch="$1"; shift;;
+ --release) release="$1"; shift;;
+ --flavor) flavor="$1"; shift;;
+ --) break ;;
+ -*) usage; exit 1;;
+ esac
+done
+
+set -- $opt "$@"
+
+releasedir="$branch/releases/$arch"
+if [ -z "$branch" ]; then
+ git_branch="$(git rev-parse --abbrev-ref HEAD)"
+ case "$git_branch" in
+ *-stable) branch=${git_branch%-stable};;
+ *) branch=edge;;
+ esac
+fi
+
+[ -n "$arch" ] || arch=$(apk --print-arch)
+
+if [ -z "$release" ]; then
+ release=$(git describe --always)
+ if git describe --exact-match >/dev/null 2>&1; then
+ release=${release#v}
+ fi
+fi
+
+for image; do
+ filepath="$releasedir/${image##*/}"
+ datetime="$(stat -c "%y" $image)"
+ size="$(stat -c "%s" $image)"
+ date=${datetime%% *}
+ time=${datetime#* }
+ file=${filepath##*/}
+ flavor=${file%-${release}-${arch}.*}
+
+ cat <<-EOF
+ -
+ branch: $branch
+ arch: $arch
+ version: $release
+ flavor: $flavor
+ file: $file
+ iso: $file
+ date: $date
+ time: $time
+ size: $size
+EOF
+ # generate checksums if missing
+ for hash in ${checksums}; do
+ if ! [ -f "$image.$hash" ]; then
+ ${hash}sum $image > $image.$hash
+ fi
+ echo " $hash: $(cut -d' ' -f1 $image.$hash)"
+ done
+
+
+done
diff --git a/scripts/mkimage.sh b/scripts/mkimage.sh
index 806247213b..6ad9200434 100644
--- a/scripts/mkimage.sh
+++ b/scripts/mkimage.sh
@@ -53,6 +53,7 @@ usage() {
$0 [--tag RELEASE] [--outdir OUTDIR] [--workdir WORKDIR]
[--arch ARCH] [--profile PROFILE] [--hostkeys] [--simulate]
+ [--yaml FILE]
$0 --help
options:
@@ -64,6 +65,7 @@ options:
--simulate Don't execute commands
--tag Build images for tag RELEASE
--workdir Specify temporary working directory (cache)
+--yaml
known profiles: $(echo $all_profiles | sort -u)
@@ -172,6 +174,11 @@ build_profile() {
${_c}sum "$output_file" > "${output_file}.${_c}"
done
fi
+
+ if [ -n "$_yaml_out" ]; then
+ $mkimage_yaml --release $RELEASE \
+ "$output_file" >> "$_yaml_out"
+ fi
fi
}
@@ -179,6 +186,8 @@ build_profile() {
load_plugins "$(dirname $0)"
[ -z "$HOME" ] || load_plugins "$HOME/.mkimage"
+mkimage_yaml="$(dirname $0)"/mkimage-yaml.sh
+
# parse parameters
while [ $# -gt 0 ]; do
opt="$1"
@@ -193,6 +202,7 @@ while [ $# -gt 0 ]; do
--hostkeys) _hostkeys="--hostkeys";;
--simulate) _simulate="yes";;
--checksum) _checksum="yes";;
+ --yaml) _yaml="yes";;
--) break ;;
-*) usage; exit 1;;
esac
@@ -233,6 +243,10 @@ for ARCH in $req_arch; do
fi
abuild-apk update --root "$APKROOT"
+ if [ "$_yaml" = "yes" ]; then
+ _yaml_out=${OUTDIR:-.}/latest-release.yaml
+ echo "---" > "$_yaml_out"
+ fi
for PROFILE in $req_profiles; do
(build_profile) || exit 1
done