2019-01-05 19:11:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Usage: $0 <folder-with-bundles>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
FOLDER=$1
|
|
|
|
|
|
|
|
if [ ! -e .version ] || [ ! -e .release_date ]; then
|
|
|
|
echo "This script should be executed in the root of an extracted source tarball"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Find the name based on the version
|
2019-02-09 19:13:28 +00:00
|
|
|
if [ -e .is_stable ]; then
|
2019-01-05 19:11:29 +00:00
|
|
|
isTesting=$(cat .version | grep "RC\|beta" || true)
|
|
|
|
if [ -z "${isTesting}" ]; then
|
|
|
|
NAME="stable"
|
|
|
|
else
|
|
|
|
NAME="testing"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
NAME=$(cat .version | cut -d- -f2 | cut -d- -f-2)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Convert the date to a YAML date
|
|
|
|
DATE=$(cat .release_date | tr ' ' T | sed 's/TUTC/:00-00:00/')
|
|
|
|
VERSION=$(cat .version)
|
|
|
|
BASE="openttd-${VERSION}"
|
|
|
|
|
2019-11-06 14:31:41 +00:00
|
|
|
echo "name: ${NAME}" > manifest.yaml
|
2019-01-05 19:11:29 +00:00
|
|
|
echo "date: ${DATE}" >> manifest.yaml
|
|
|
|
echo "base: ${BASE}-" >> manifest.yaml
|
|
|
|
|
|
|
|
error=""
|
|
|
|
|
2019-11-06 14:31:41 +00:00
|
|
|
FILES=
|
|
|
|
DEV_FILES=
|
|
|
|
for filename in $(ls ${FOLDER} | grep -v ".txt$\|.md$\|sum$" | sort); do
|
|
|
|
case ${filename} in
|
2019-11-10 20:29:08 +00:00
|
|
|
*docs* |\
|
|
|
|
*source* |\
|
2019-11-06 14:31:41 +00:00
|
|
|
*dbg.deb |\
|
|
|
|
*pdb.xz )
|
2019-11-13 20:25:53 +00:00
|
|
|
DEV_FILES="${DEV_FILES} ${filename}"
|
2019-11-06 14:31:41 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2019-11-13 20:25:53 +00:00
|
|
|
FILES="${FILES} ${filename}"
|
2019-11-06 14:31:41 +00:00
|
|
|
;;
|
|
|
|
esac
|
2019-01-05 19:11:29 +00:00
|
|
|
done
|
|
|
|
|
2019-11-06 14:31:41 +00:00
|
|
|
# output_files key filename...
|
2019-11-16 14:23:25 +00:00
|
|
|
output_files() {
|
2019-11-06 14:31:41 +00:00
|
|
|
if [ "$#" -lt 2 ]; then return; fi
|
|
|
|
key=$1
|
|
|
|
echo "${key}:" >> manifest.yaml
|
|
|
|
shift
|
2019-11-16 14:23:25 +00:00
|
|
|
while [ "$#" -gt 0 ]; do
|
2019-11-06 14:31:41 +00:00
|
|
|
filename=$1
|
|
|
|
if [ ! -e ${FOLDER}/${filename}.md5sum ] || [ ! -e ${FOLDER}/${filename}.sha1sum ] || [ ! -e ${FOLDER}/${filename}.sha256sum ]; then
|
|
|
|
echo "ERROR: missing checksum file for ${filename}" 1>&2
|
|
|
|
error="y"
|
2020-05-19 20:21:11 +00:00
|
|
|
shift
|
2019-11-06 14:31:41 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "- id: ${filename}" >> manifest.yaml
|
|
|
|
echo " size: $(stat -c"%s" ${FOLDER}/${filename})" >> manifest.yaml
|
|
|
|
echo " md5sum: $(cat ${FOLDER}/${filename}.md5sum | cut -d\ -f1)" >> manifest.yaml
|
|
|
|
echo " sha1sum: $(cat ${FOLDER}/${filename}.sha1sum | cut -d\ -f1)" >> manifest.yaml
|
|
|
|
echo " sha256sum: $(cat ${FOLDER}/${filename}.sha256sum | cut -d\ -f1)" >> manifest.yaml
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
output_files files ${FILES}
|
|
|
|
output_files dev_files ${DEV_FILES}
|
|
|
|
|
2019-01-05 19:11:29 +00:00
|
|
|
if [ -n "${error}" ]; then
|
|
|
|
echo "ERROR: exiting due to earlier errors" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|