mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Merge pull request #7 from yggdrasil-network/develop
Branch Develop: Branch to Patch
This commit is contained in:
		
						commit
						3bbe922f5f
					
				
					 5 changed files with 17 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -395,7 +395,7 @@ func (a *admin) listen() {
 | 
			
		|||
	for {
 | 
			
		||||
		conn, err := a.listener.Accept()
 | 
			
		||||
		if err == nil {
 | 
			
		||||
			a.handleRequest(conn)
 | 
			
		||||
			go a.handleRequest(conn)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue