Browse Source

Merge pull request #444 from oycol/mipsle_build

openwrt: mipsle version
Alex 3 years ago
parent
commit
5c623896e9
3 changed files with 89 additions and 0 deletions
  1. 11 0
      .github/workflows/buildandrelease.yml
  2. 39 0
      scripts/openwrt-daemon-2.sh
  3. 39 0
      scripts/openwrt-daemon.sh

+ 11 - 0
.github/workflows/buildandrelease.yml

@@ -39,6 +39,7 @@ jobs:
           env GOOS=linux GOARCH=arm GOARM=6 go build -o build/netclient-arm6/netclient main.go
           env GOOS=linux GOARCH=arm GOARM=7 go build -o build/netclient-arm7/netclient main.go
           env GOOS=linux GOARCH=arm64 go build -o build/netclient-arm64/netclient main.go
+          env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient
 
       - name: Upload x86 to Release
         uses: svenstaro/upload-release-action@v2
@@ -89,3 +90,13 @@ jobs:
           overwrite: true
           prerelease: true
           asset_name: netclient-arm64
+
+      - name: Upload mipsle to Release
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: netclient/build/netclient-mipsle/netclient
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: netclient-mipsle

+ 39 - 0
scripts/openwrt-daemon-2.sh

@@ -0,0 +1,39 @@
+#!/bin/sh /etc/rc.common
+#Created by oycol<[email protected]>
+
+EXTRA_COMMANDS="status"
+EXTRA_HELP="        status      Check service is running"
+START=99
+
+LOG_FILE="/tmp/netclient.logs"
+
+start() {
+  if [ ! -f "${LOG_FILE}" ];then
+      touch "${LOG_FILE}"
+  fi
+  local PID=$(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}')
+  if [ "${PID}" ];then
+    echo "service is running"
+    return
+  fi
+  bash -c "while [ 1 ]; do /etc/netclient/netclient checkin -n all >> ${LOG_FILE} 2>&1;sleep 15;\
+           if [ $(ls -l ${LOG_FILE}|awk '{print $5}') -gt 10240000 ];then tar zcf "${LOG_FILE}.tar" -C / "tmp/netclient.logs"  && > $LOG_FILE;fi;done &"
+  echo "start"
+}
+
+stop() {
+  local PID=$(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}')
+  if [ "${PID}" ];then
+    kill "${PID}"
+  fi
+  echo "stop"
+}
+
+status() {
+  local PID=$(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}')
+  if [ "${PID}" ];then
+    echo -e "netclient[${PID}] is running \n"
+  else
+    echo -e "netclient is not running \n"
+  fi
+}

+ 39 - 0
scripts/openwrt-daemon.sh

@@ -0,0 +1,39 @@
+#!/bin/bash /etc/rc.common
+#Created by oycol<[email protected]>
+
+EXTRA_COMMANDS="status"
+EXTRA_HELP="        status  	Check service is running"
+START=99
+
+LOG_FILE="/tmp/netclient.logs"
+
+start() {
+  if [ ! -f "${LOG_FILE}" ];then
+      touch "${LOG_FILE}"
+  fi
+  local PIDS=($(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}'))
+  if [ ${PIDS} ];then
+    echo "service is running"
+    return
+  fi
+  bash -c "while [ 1 ]; do /etc/netclient/netclient checkin -n all >> ${LOG_FILE} 2>&1;sleep 15;\
+           if [ $(ls -l ${LOG_FILE}|awk '{print $5}') -gt 10240000 ];then tar zcf "${LOG_FILE}.tar" -C / "tmp/netclient.logs"  && > ${LOG_FILE};fi;done &"
+  echo "start"
+}
+
+stop() {
+  local PIDS=($(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}'))
+  for i in "${PIDS[@]}"; do
+    kill $i
+  done
+  echo "stop"
+}
+
+status() {
+  local PIDS=($(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}'))
+  if [ ${PIDS} ];then
+    echo -e "netclient[${PIDS}] is running \n"
+  else
+    echo -e "netclient is not running \n"
+  fi
+}