Skip to content

Commit

Permalink
Update: [AzurePipeline] manifest.sh for OpenTTD/website#111
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 committed Nov 10, 2019
1 parent 4eab70f commit af34b1b
Showing 1 changed file with 36 additions and 15 deletions.
51 changes: 36 additions & 15 deletions azure-pipelines/manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,50 @@ DATE=$(cat .release_date | tr ' ' T | sed 's/TUTC/:00-00:00/')
VERSION=$(cat .version)
BASE="openttd-${VERSION}"

echo "name: ${NAME}" >> manifest.yaml
echo "name: ${NAME}" > manifest.yaml
echo "date: ${DATE}" >> manifest.yaml
echo "base: ${BASE}-" >> manifest.yaml
echo "files:" >> manifest.yaml

error=""
for i in $(ls ${FOLDER} | grep -v ".txt$\|.md$\|sum$" | sort); do
if [ -n "$(echo $i | grep pdb.xz)" ]; then continue; fi
if [ -n "$(echo $i | grep dbg.deb)" ]; then continue; fi

if [ ! -e ${FOLDER}/$i.md5sum ] || [ ! -e ${FOLDER}/$i.sha1sum ] || [ ! -e ${FOLDER}/$i.sha256sum ]; then
echo "ERROR: missing checksum file for ${i}" 1>&2
error="y"
continue
fi
FILES=
DEV_FILES=
for i in $(ls ${FOLDER} | grep -v ".txt$\|.md$\|sum$" | sort); do
case $i in
*dbg.deb |\
*pdb.xz )
DEV_FILES+=" $i"
;;

echo "- id: $i" >> manifest.yaml
echo " size: $(stat -c"%s" ${FOLDER}/$i)" >> manifest.yaml
echo " md5sum: $(cat ${FOLDER}/$i.md5sum | cut -d\ -f1)" >> manifest.yaml
echo " sha1sum: $(cat ${FOLDER}/$i.sha1sum | cut -d\ -f1)" >> manifest.yaml
echo " sha256sum: $(cat ${FOLDER}/$i.sha256sum | cut -d\ -f1)" >> manifest.yaml
*)
FILES+=" $i"
;;
esac
done

function output_files {
if [ "$#" -lt 2 ]; then return; fi
echo "$1:" >> manifest.yaml
shift
while (( "$#" )); do
if [ ! -e ${FOLDER}/$1.md5sum ] || [ ! -e ${FOLDER}/$1.sha1sum ] || [ ! -e ${FOLDER}/$1.sha256sum ]; then
echo "ERROR: missing checksum file for ${1}" 1>&2
error="y"
continue
fi

echo "- id: $1" >> manifest.yaml
echo " size: $(stat -c"%s" ${FOLDER}/$1)" >> manifest.yaml
echo " md5sum: $(cat ${FOLDER}/$1.md5sum | cut -d\ -f1)" >> manifest.yaml
echo " sha1sum: $(cat ${FOLDER}/$1.sha1sum | cut -d\ -f1)" >> manifest.yaml
echo " sha256sum: $(cat ${FOLDER}/$1.sha256sum | cut -d\ -f1)" >> manifest.yaml
shift
done
}

output_files files $FILES
output_files dev_files $DEV_FILES

if [ -n "${error}" ]; then
echo "ERROR: exiting due to earlier errors" 1>&2
exit 1
Expand Down

0 comments on commit af34b1b

Please sign in to comment.