28 lines
983 B
Bash
Executable File
28 lines
983 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
source /opt/rustbox-package-builder/scripts/lib.sh
|
|
WORK="$DATA_DIR/work/source"
|
|
REPOSITORY="$DATA_DIR/repository"
|
|
if [[ ! -d "$WORK/.git" ]]; then
|
|
rm -rf "$WORK"
|
|
git clone --no-tags "$SOURCE_REPO" "$WORK"
|
|
fi
|
|
cd "$WORK"
|
|
git remote set-url origin "$SOURCE_REPO"
|
|
git fetch --no-tags --prune origin "$SOURCE_BRANCH"
|
|
SHA=$(git rev-parse FETCH_HEAD)
|
|
CURRENT_SHA=""
|
|
CURRENT_REV=""
|
|
if [[ -r "$REPOSITORY/current/DEBIAN-BUILD-INFO.txt" ]]; then
|
|
CURRENT_SHA=$(sed -n 's/^source_commit=//p' "$REPOSITORY/current/DEBIAN-BUILD-INFO.txt" | head -n1)
|
|
CURRENT_REV=$(sed -n 's/^packaging_revision=//p' "$REPOSITORY/current/DEBIAN-BUILD-INFO.txt" | head -n1)
|
|
fi
|
|
if [[ "$CURRENT_SHA" == "$SHA" && "$CURRENT_REV" == "$PACKAGING_REVISION" ]]; then
|
|
log "no new RustBox build: commit=$SHA packaging_revision=$PACKAGING_REVISION"
|
|
exit 0
|
|
fi
|
|
git reset --hard "$SHA"
|
|
git clean -fdx
|
|
export SHA SRC="$WORK"
|
|
/opt/rustbox-package-builder/scripts/build-release.sh
|