diff --git a/.circleci/config.yml b/.circleci/config.yml index f3092ba..e548aa1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ jobs: name: Create tags (master branch only) command: > if [ "${CIRCLE_BRANCH}" == "master" ]; then - git tag -f -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push -f --tags; + (git tag -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push --tags) || true; else echo "Only runs for master branch (this is ${CIRCLE_BRANCH})"; fi; diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index 0eb2188..6c8f955 100644 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -25,7 +25,7 @@ if [ $PKGARCH = "amd64" ]; then GOARCH=amd64 GOOS=linux ./build elif [ $PKGARCH = "i386" ]; then GOARCH=386 GOOS=linux ./build elif [ $PKGARCH = "mipsel" ]; then GOARCH=mipsle GOOS=linux ./build elif [ $PKGARCH = "mips" ]; then GOARCH=mips64 GOOS=linux ./build -elif [ $PKGARCH = "armhf" ]; then GOARCH=arm GOOS=linux GOARM=7 ./build +elif [ $PKGARCH = "armhf" ]; then GOARCH=arm GOOS=linux GOARM=6 ./build elif [ $PKGARCH = "arm64" ]; then GOARCH=arm64 GOOS=linux ./build else echo "Specify PKGARCH=amd64,i386,mips,mipsel,armhf,arm64" @@ -73,7 +73,7 @@ cat > /tmp/$PKGNAME/debian/postinst << EOF #!/bin/sh if ! getent group yggdrasil 2>&1 > /dev/null; then - addgroup --system --quiet yggdrasil + groupadd --system --force yggdrasil || echo "Failed to create group 'yggdrasil' - please create it manually and reinstall" fi if [ -f /etc/yggdrasil.conf ]; diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 6b4bfcb..fb4fbfa 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -2,6 +2,9 @@ FROM docker.io/golang:alpine as builder COPY . /src WORKDIR /src + +ENV CGO_ENABLED=0 + RUN apk add git && ./build FROM docker.io/alpine diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index eab5ab8..03b5da2 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -3,14 +3,14 @@ # Merge commits from this branch are counted DEVELOPBRANCH="yggdrasil-network/develop" -# Get the last tag that denotes moving to a major version number +# Get the last tag TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.0" 2>/dev/null) # Get last merge to master MERGE=$(git rev-list $TAG..master --grep "from $DEVELOPBRANCH" 2>/dev/null | head -n 1) # Get the number of merges since the last merge to master -PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" 2>/dev/null) +PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" --first-parent master 2>/dev/null) # Decide whether we should prepend the version with "v" - the default is that # we do because we use it in git tags, but we might not always need it @@ -51,13 +51,17 @@ else printf '%s%d.%d.%d' "$PREPEND" "$MAJOR" "$MINOR" "$PATCH" fi +# Get the number of merges on the current branch since the last tag +TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" --first-parent master 2>/dev/null) +BUILD=$(git rev-list $TAG.. --count) + # Add the build tag on non-master branches if [ $BRANCH != "master" ]; then - # Get the number of merges on the current branch since the last tag - BUILDTAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null) - BUILD=$(git rev-list $BUILDTAG..HEAD --count --merges) - if [ $BUILD != 0 ]; then printf -- "-%04d" "$BUILD" fi +else + if [ $BUILD != 0 ]; then + printf -- "-%d" "$(($BUILD+1))" + fi fi diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 5028c9b..bd3c905 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -395,7 +395,7 @@ func (a *admin) listen() { for { conn, err := a.listener.Accept() if err == nil { - a.handleRequest(conn) + go a.handleRequest(conn) } } }