mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-21 19:25:52 +08:00
commit
74986ff478
4 changed files with 56 additions and 5 deletions
42
.github/workflows/buildandrelease.yml
vendored
42
.github/workflows/buildandrelease.yml
vendored
|
@ -306,6 +306,48 @@ jobs:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
asset_name: netclient-mipsle
|
asset_name: netclient-mipsle
|
||||||
|
|
||||||
|
netclient-mips:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: version
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set Variables
|
||||||
|
run: |
|
||||||
|
TAG=${{needs.version.outputs.tag}}
|
||||||
|
VERSION=${{needs.version.outputs.version}}
|
||||||
|
echo "NETMAKER_VERSION=${TAG}" >> $GITHUB_ENV
|
||||||
|
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||||
|
- name: Setup go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.18
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cd netclient
|
||||||
|
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "-s -w -X 'main.version=$NETMAKER_VERSION'" -o build/netclient-mips/netclient main.go
|
||||||
|
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "-s -w -X 'main.version=$NETMAKER_VERSION'" -o build/netclient-mips-upx/netclient main.go && upx build/netclient-mips-upx/netclient
|
||||||
|
|
||||||
|
- name: Upload mips to Release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: netclient/build/netclient-mips/netclient
|
||||||
|
tag: ${{ env.NETMAKER_VERSION }}
|
||||||
|
overwrite: true
|
||||||
|
prerelease: true
|
||||||
|
asset_name: netclient-mips
|
||||||
|
|
||||||
|
- name: Upload upx compressed version of mips to Release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: netclient/build/netclient-mips-upx/netclient
|
||||||
|
tag: ${{ env.NETMAKER_VERSION }}
|
||||||
|
overwrite: true
|
||||||
|
prerelease: true
|
||||||
|
asset_name: netclient-mips-upx
|
||||||
|
|
||||||
netclient-freebsd:
|
netclient-freebsd:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: version
|
needs: version
|
||||||
|
|
|
@ -162,7 +162,7 @@ func UserPermissions(reqAdmin bool, netname string, token string) ([]string, str
|
||||||
if len(netname) > 0 && (!authenticateNetworkUser(netname, userNetworks) || len(userNetworks) == 0) {
|
if len(netname) > 0 && (!authenticateNetworkUser(netname, userNetworks) || len(userNetworks) == 0) {
|
||||||
return nil, username, Unauthorized_Err
|
return nil, username, Unauthorized_Err
|
||||||
}
|
}
|
||||||
if !pro.IsUserNetAdmin(netname, username) {
|
if isEE && !pro.IsUserNetAdmin(netname, username) {
|
||||||
return nil, "", Unauthorized_Err
|
return nil, "", Unauthorized_Err
|
||||||
}
|
}
|
||||||
return userNetworks, username, nil
|
return userNetworks, username, nil
|
||||||
|
|
|
@ -20,7 +20,12 @@ function build
|
||||||
build $_goarch $_goose 5 && build $_goarch $_goose 6 && build $_goarch $_goose 7
|
build $_goarch $_goose 5 && build $_goarch $_goose 6 && build $_goarch $_goose 7
|
||||||
else
|
else
|
||||||
echo $_out
|
echo $_out
|
||||||
GOARM=$_goarm GOARCH=$_goarch GOOS=$_goose GOHOSTARCH=$__HOST_ARCH CGO_ENABLED=0 go build -ldflags="-X 'main.version=$VERSION'" -o $_out
|
if [ "$_goarch" == "mips" ]; then
|
||||||
|
# If the binary created through `GOMIPS=softfloat GOARCH=mipsle` is not compatible with your hardware, try changing these variables and creating a binary file compatible with your hardware.
|
||||||
|
GOARM=$_goarm GOMIPS=softfloat GOARCH=mipsle GOOS=$_goose GOHOSTARCH=$__HOST_ARCH CGO_ENABLED=0 go build -ldflags="-X 'main.version=$VERSION'" -o $_out
|
||||||
|
else
|
||||||
|
GOARM=$_goarm GOARCH=$_goarch GOOS=$_goose GOHOSTARCH=$__HOST_ARCH CGO_ENABLED=0 go build -ldflags="-X 'main.version=$VERSION'" -o $_out
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,8 +148,11 @@ case $(uname | tr A-Z a-z) in
|
||||||
arm*)
|
arm*)
|
||||||
dist=netclient-$CPU_ARCH
|
dist=netclient-$CPU_ARCH
|
||||||
;;
|
;;
|
||||||
mipsle)
|
mipsle)
|
||||||
dist=netclient-mipsle
|
dist=netclient-mipsle
|
||||||
|
;;
|
||||||
|
mips*)
|
||||||
|
dist=netclient-$CPU_ARCH
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
fatal "$CPU_ARCH : cpu architecture not supported"
|
fatal "$CPU_ARCH : cpu architecture not supported"
|
||||||
|
@ -240,6 +243,8 @@ if [ "${OS}" = "OpenWRT" ] || [ "${OS}" = "TurrisOS" ]; then
|
||||||
else
|
else
|
||||||
wget $curl_opts -O netclient.service.tmp https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/openwrt-daemon.sh
|
wget $curl_opts -O netclient.service.tmp https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/openwrt-daemon.sh
|
||||||
fi
|
fi
|
||||||
|
elif [ "${OS}" = "OpenWRT" ] && [ "$CPU_ARCH" = "mips" ]; then
|
||||||
|
wget $curl_opts -O netclient.service.tmp https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/openwrt-daemon.sh
|
||||||
else
|
else
|
||||||
cat << 'END_OF_FILE' > ./netclient.service.tmp
|
cat << 'END_OF_FILE' > ./netclient.service.tmp
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
@ -293,4 +298,3 @@ END_OF_FILE
|
||||||
else
|
else
|
||||||
rm -f netclient
|
rm -f netclient
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue