diff --git a/build.sh b/build.sh index d33eea1..fa3607a 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,9 @@ #! /usr/bin/env sh -FIRMWARE_URL="http://downloads.bremen.freifunk.net/firmware/" -LOCAL_SUFFIX="bremen" +LOCAL_SUFFIX="breminale" GLUON_DIR="gluon/" KEYFILE="$HOME/.ecdsakey" +local_version=1 set -eu @@ -24,21 +24,6 @@ get_GLUON_TAG() { fi } -get_last_release() { - branch="$1" - wget -q -O- "${FIRMWARE_URL}/${branch}/sysupgrade/${branch}.manifest" | \ - awk 'parse == 1 { print $2; exit } /^$/ { parse=1 }' -} - -is_based_on() { - [ "${1#$2}" != "${1}" ] - return $? -} - -extract_local_version() { - local_version_tmp="${1#*+${LOCAL_SUFFIX}}" - echo "${local_version_tmp%~testing}" -} debug= if [ "$#" -gt 0 ]; then @@ -64,53 +49,11 @@ GLUON_TAG="$(get_GLUON_TAG)" # remove prefixed "v" GLUON_TAG="${GLUON_TAG#v}" -statefile="${GLUON_SITEDIR}/.build.${GLUON_BRANCH}.${GLUON_TAG}" -cont=false +echo "Building Gluon ${GLUON_TAG} as ${GLUON_BRANCH}" +auto_determined_release="${GLUON_TAG}+${LOCAL_SUFFIX}${local_version}" +read -p "Release name for this build [default: ${auto_determined_release}]: " GLUON_RELEASE +GLUON_RELEASE="${GLUON_RELEASE:-$auto_determined_release}" -if [ -f "$statefile" ]; then - echo "A previous build for this version was aborted." - echo "These were the parameters:" - cat "$statefile" - echo "You can now either continue the previous build or begin a new one" - echo "and overwrite the old state file." - read -p "Do you want to continue the previous build? [Yn] " answer - case "${answer:-y}" in - [yY]*) - . "$statefile" - cont=true - ;; - *) - rm "$statefile" - ;; - esac -fi -if ! $cont; then - echo "Building Gluon ${GLUON_TAG} as ${GLUON_BRANCH}" - last_release_testing="$(get_last_release testing)" - last_release_stable="$(get_last_release stable)" - last_release="$(/bin/echo -e "${last_release_testing}\n${last_release_stable}" | sort -V | tail -n1)" - echo "Last release was ${last_release}" - if is_based_on "$last_release" "$GLUON_TAG"; then - local_version="$(extract_local_version "$last_release")" - local_version="$(($local_version + 1))" - else - # new gluon version => reset local version number - local_version=1 - fi - auto_determined_release="${GLUON_TAG}+${LOCAL_SUFFIX}${local_version}" - read -p "Release name for this build [default: ${auto_determined_release}]: " GLUON_RELEASE - GLUON_RELEASE="${GLUON_RELEASE:-$auto_determined_release}" - - cat > "$statefile" <> "$statefile" done -make manifest -make manifest GLUON_BRANCH=testing GLUON_PRIORITY=0 -cd .. - -if [ -n "$KEYFILE" -a -r "$KEYFILE" ]; then - "${GLUON_DIR}/contrib/sign.sh" "$KEYFILE" "${GLUON_DIR}/output/images/sysupgrade/${GLUON_BRANCH}.manifest" -fi - -rm "$statefile"