|
@@ -6,7 +6,8 @@
|
|
|
#
|
|
|
# BASE = Gluon Version (tag or commit, i.e. v2014.4)
|
|
|
# BRANCH = Firmware Branch (stable/testing/experimental)
|
|
|
-# SITE = specific site repository commit-id (leave blank to use HEAD)
|
|
|
+# SITE = site repository to use
|
|
|
+# SITE_ID = specific site repository commit-id (leave blank to use HEAD)
|
|
|
# VERSION = the version tag (can only be empty if BRANCH=experimental)
|
|
|
# BUILD_TS = build timestamp (format: %Y-%m-%d %H:%M:%S)
|
|
|
# BROKEN = 0 (default) or 1, build the untested hardware model firmwares, too
|
|
@@ -70,12 +71,39 @@ if [ ! -d "$CODE_DIR" ]; then
|
|
|
fi
|
|
|
|
|
|
if [ "_${SITE_REPO_FETCH_METHOD}" != "_git" ]; then
|
|
|
- SITE_REPO_URL="https://git.c3pb.de/freifunk-pb/site-ffpb.git"
|
|
|
+ SITE_REPO_URL="https://git.c3pb.de/freifunk-pb/site-${SITE}.git"
|
|
|
else
|
|
|
- SITE_REPO_URL="git@git.c3pb.de:freifunk-pb/site-ffpb.git"
|
|
|
+ SITE_REPO_URL="git@git.c3pb.de:freifunk-pb/site-${SITE}.git"
|
|
|
fi
|
|
|
|
|
|
### INIT /src/site IF NECESSARY
|
|
|
+if [ -d "$CODE_DIR/site" ]; then
|
|
|
+ # verify the site-repo is the correct one ($SITE), otherwise delete the repo
|
|
|
+ pushd "$CODE_DIR/site"
|
|
|
+ url=$(git remote show origin | awk '/Fetch URL/ { print $3; }')
|
|
|
+ if [ "$SITE_REPO_URL" != "$url" ]; then
|
|
|
+ info "The site repository is not the correct one."
|
|
|
+ if ! git diff-index --quiet HEAD --; then
|
|
|
+ popd > /dev/null
|
|
|
+ abort "The site repo is the wrong one but has local modifications, please fix this manually."
|
|
|
+ fi
|
|
|
+ # check on the actual branch, not the target one given as parameter
|
|
|
+ local_branch=$(git branch --list --no-color | awk '/^*/ { print $2; }')
|
|
|
+ commits=$(git log origin/${local_branch}..HEAD)
|
|
|
+ if [ -n "$commits" ]; then
|
|
|
+ popd > /dev/null
|
|
|
+ abort "The site repo is the wrong one but has unpushed commits, please fix this manually."
|
|
|
+ fi
|
|
|
+
|
|
|
+ # remove the directory without asking further questions
|
|
|
+ popd > /dev/null
|
|
|
+ rm -Rf "$CODE_DIR/site" || abort "Failed to remove wrong site-repository."
|
|
|
+ success "Removed old site directory in order to be able to clone the correct one."
|
|
|
+ else
|
|
|
+ popd > /dev/null
|
|
|
+ fi
|
|
|
+fi
|
|
|
+
|
|
|
if [ ! -d "$CODE_DIR/site" ]; then
|
|
|
info "Site repository does not exist, fetching it ..."
|
|
|
git clone "$SITE_REPO_URL" "$CODE_DIR/site" || abort "Failed to fetch SITE repository."
|
|
@@ -98,7 +126,7 @@ GLUON_COMMIT=$(git rev-list --max-count=1 HEAD)
|
|
|
progress "Checking out SITE REPO ..."
|
|
|
cd site
|
|
|
# TODO: check if site got modified locally and bail out if necessary
|
|
|
-if [ "_$SITE" == "_" ]; then
|
|
|
+if [ "_${SITE_ID}" == "_" ]; then
|
|
|
# no specific site given - get the most current one
|
|
|
git checkout -q $BRANCH ; git pull
|
|
|
[ "$?" -eq "0" ] || abort "Failed to get newest '$BRANCH' in site repository, mimimi."
|
|
@@ -106,7 +134,7 @@ else
|
|
|
# fetch site repo updates
|
|
|
git fetch || true
|
|
|
# commit given - use this one
|
|
|
- git checkout -q $SITE || abort "Failed to checkout requested site commit, mimimi."
|
|
|
+ git checkout -q ${SITE_ID} || abort "Failed to checkout requested site commit, mimimi."
|
|
|
fi
|
|
|
SITE_COMMIT=$(git rev-list --max-count=1 HEAD)
|
|
|
|
|
@@ -150,6 +178,7 @@ touch $(dirname ${build_info_path})
|
|
|
echo "VERSION=${VERSION}" >> ${build_info_path}
|
|
|
echo "GLUON=${GLUON_COMMIT} # ${BASE}" >> ${build_info_path}
|
|
|
echo "BRANCH=${BRANCH}" >> ${build_info_path}
|
|
|
+echo "SITE_REPO=${SITE}" >> ${build_info_path}
|
|
|
echo "SITE=${SITE_COMMIT} # ${VERSION}" >> ${build_info_path}
|
|
|
echo "TARGETS=${TARGETS}" >> ${build_info_path}
|
|
|
echo "TS=${BUILD_TS}" >> ${build_info_path}
|