Skip to content

Commit 74986ff

Browse files
authored
Merge pull request #1724 from gravitl/develop
Develop
2 parents c7cc238 + 5ff5e5d commit 74986ff

File tree

4 files changed

+56
-5
lines changed

4 files changed

+56
-5
lines changed

.github/workflows/buildandrelease.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,48 @@ jobs:
306306
prerelease: true
307307
asset_name: netclient-mipsle
308308

309+
netclient-mips:
310+
runs-on: ubuntu-latest
311+
needs: version
312+
steps:
313+
- name: Checkout
314+
uses: actions/checkout@v2
315+
- name: Set Variables
316+
run: |
317+
TAG=${{needs.version.outputs.tag}}
318+
VERSION=${{needs.version.outputs.version}}
319+
echo "NETMAKER_VERSION=${TAG}" >> $GITHUB_ENV
320+
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
321+
- name: Setup go
322+
uses: actions/setup-go@v2
323+
with:
324+
go-version: 1.18
325+
- name: Build
326+
run: |
327+
cd netclient
328+
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
329+
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
330+
331+
- name: Upload mips to Release
332+
uses: svenstaro/upload-release-action@v2
333+
with:
334+
repo_token: ${{ secrets.GITHUB_TOKEN }}
335+
file: netclient/build/netclient-mips/netclient
336+
tag: ${{ env.NETMAKER_VERSION }}
337+
overwrite: true
338+
prerelease: true
339+
asset_name: netclient-mips
340+
341+
- name: Upload upx compressed version of mips to Release
342+
uses: svenstaro/upload-release-action@v2
343+
with:
344+
repo_token: ${{ secrets.GITHUB_TOKEN }}
345+
file: netclient/build/netclient-mips-upx/netclient
346+
tag: ${{ env.NETMAKER_VERSION }}
347+
overwrite: true
348+
prerelease: true
349+
asset_name: netclient-mips-upx
350+
309351
netclient-freebsd:
310352
runs-on: ubuntu-latest
311353
needs: version

logic/security.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func UserPermissions(reqAdmin bool, netname string, token string) ([]string, str
162162
if len(netname) > 0 && (!authenticateNetworkUser(netname, userNetworks) || len(userNetworks) == 0) {
163163
return nil, username, Unauthorized_Err
164164
}
165-
if !pro.IsUserNetAdmin(netname, username) {
165+
if isEE && !pro.IsUserNetAdmin(netname, username) {
166166
return nil, "", Unauthorized_Err
167167
}
168168
return userNetworks, username, nil

netclient/bin-maker.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ function build
2020
build $_goarch $_goose 5 && build $_goarch $_goose 6 && build $_goarch $_goose 7
2121
else
2222
echo $_out
23-
GOARM=$_goarm GOARCH=$_goarch GOOS=$_goose GOHOSTARCH=$__HOST_ARCH CGO_ENABLED=0 go build -ldflags="-X 'main.version=$VERSION'" -o $_out
23+
if [ "$_goarch" == "mips" ]; then
24+
# 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.
25+
GOARM=$_goarm GOMIPS=softfloat GOARCH=mipsle GOOS=$_goose GOHOSTARCH=$__HOST_ARCH CGO_ENABLED=0 go build -ldflags="-X 'main.version=$VERSION'" -o $_out
26+
else
27+
GOARM=$_goarm GOARCH=$_goarch GOOS=$_goose GOHOSTARCH=$__HOST_ARCH CGO_ENABLED=0 go build -ldflags="-X 'main.version=$VERSION'" -o $_out
28+
fi
2429
fi
2530
}
2631

scripts/netclient-install.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,11 @@ case $(uname | tr A-Z a-z) in
148148
arm*)
149149
dist=netclient-$CPU_ARCH
150150
;;
151-
mipsle)
151+
mipsle)
152152
dist=netclient-mipsle
153+
;;
154+
mips*)
155+
dist=netclient-$CPU_ARCH
153156
;;
154157
*)
155158
fatal "$CPU_ARCH : cpu architecture not supported"
@@ -240,6 +243,8 @@ if [ "${OS}" = "OpenWRT" ] || [ "${OS}" = "TurrisOS" ]; then
240243
else
241244
wget $curl_opts -O netclient.service.tmp https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/openwrt-daemon.sh
242245
fi
246+
elif [ "${OS}" = "OpenWRT" ] && [ "$CPU_ARCH" = "mips" ]; then
247+
wget $curl_opts -O netclient.service.tmp https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/openwrt-daemon.sh
243248
else
244249
cat << 'END_OF_FILE' > ./netclient.service.tmp
245250
#!/bin/sh /etc/rc.common
@@ -292,5 +297,4 @@ END_OF_FILE
292297
/etc/init.d/netclient start
293298
else
294299
rm -f netclient
295-
fi
296-
300+
fi

0 commit comments

Comments
 (0)