File build.nightly.sh of Package zeek-nightly

#!/usr/bin/env bash
# Submit a nightly build of Bro to the OpenSUSE build service

set -e
set -u

osc up > /dev/null
# Create new version of tar.bz2
rm -rf ./zeek-nightly ./zeek-nightly.tar.bz
# submodules print stuff even with -q :(
git clone -q https://github.com/zeek/zeek.git zeek-nightly

set +e
diff VERSION zeek-nightly/VERSION > /dev/null
if [ "$?" -eq "0" ]; then
	rm -rf zeek-nightly
	exit 0
fi
set -e

pushd zeek-nightly > /dev/null
git submodule update -q --recursive --init
python3 ci/collect-repo-info.py --only-git > repo-info.json
popd > /dev/null
rm -rf zeek-nightly/.git
find ./zeek-nightly -type f -name ".git*" -exec rm {} \;

tar cfj zeek-nightly.tar.bz2 zeek-nightly

# Create the required build files from our skeletons
perl replace-version.pl zeek-nightly.spec.template > zeek-nightly.spec

for i in debian-template.*
do NEWNAME=debian.${i#debian-template.}
  perl replace-version.pl $i > ${NEWNAME//-KIND/-nightly}
done
mv debian.zeek-nightly.dsc zeek-nightly.dsc

cp zeek-nightly/VERSION ./VERSION
rm -rf zeek-nightly
VERSION=`cat VERSION`

osc commit -m "nightly build for version $VERSION" > /dev/null
openSUSE Build Service is sponsored by