parent
18fbfd85cc
commit
3ad8056c8f
@ -1,31 +0,0 @@
|
|||||||
@echo off
|
|
||||||
SETLOCAL
|
|
||||||
|
|
||||||
mage -version >nul 2>&1
|
|
||||||
IF %ERRORLEVEL% EQU 0 (
|
|
||||||
echo Mage is already installed.
|
|
||||||
GOTO DOWNLOAD
|
|
||||||
)
|
|
||||||
|
|
||||||
go version >nul 2>&1
|
|
||||||
IF NOT %ERRORLEVEL% EQU 0 (
|
|
||||||
echo Go is not installed. Please install Go and try again.
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
echo Installing Mage...
|
|
||||||
go install github.com/magefile/mage@latest
|
|
||||||
|
|
||||||
mage -version >nul 2>&1
|
|
||||||
IF NOT %ERRORLEVEL% EQU 0 (
|
|
||||||
echo Mage installation failed.
|
|
||||||
echo Please ensure that %GOPATH%/bin is in your PATH.
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
echo Mage installed successfully.
|
|
||||||
|
|
||||||
:DOWNLOAD
|
|
||||||
go mod download
|
|
||||||
|
|
||||||
ENDLOCAL
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
|
|
||||||
TARGET_DIR="$HOME/.local/bin"
|
|
||||||
else
|
|
||||||
TARGET_DIR="/usr/local/bin"
|
|
||||||
echo "Using /usr/local/bin as the installation directory. Might require sudo permissions."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v mage &> /dev/null; then
|
|
||||||
echo "Installing Mage to $TARGET_DIR ..."
|
|
||||||
GOBIN=$TARGET_DIR go install github.com/magefile/mage@latest
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v mage &> /dev/null; then
|
|
||||||
echo "Mage installation failed."
|
|
||||||
echo "Please ensure that $TARGET_DIR is in your \$PATH."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Mage installed successfully."
|
|
||||||
|
|
||||||
go mod download
|
|
@ -1,38 +0,0 @@
|
|||||||
//go:build mage
|
|
||||||
// +build mage
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/openimsdk/tools/utils/mageutil"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Default = Build
|
|
||||||
|
|
||||||
func Build() {
|
|
||||||
platforms := os.Getenv("PLATFORMS")
|
|
||||||
if platforms == "" {
|
|
||||||
platforms = mageutil.DetectPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, platform := range strings.Split(platforms, " ") {
|
|
||||||
mageutil.CompileForPlatform(platform)
|
|
||||||
}
|
|
||||||
|
|
||||||
mageutil.PrintGreen("Compilation complete.")
|
|
||||||
}
|
|
||||||
|
|
||||||
func Start() {
|
|
||||||
setMaxOpenFiles()
|
|
||||||
mageutil.StartToolsAndServices()
|
|
||||||
}
|
|
||||||
|
|
||||||
func Stop() {
|
|
||||||
mageutil.StopAndCheckBinaries()
|
|
||||||
}
|
|
||||||
|
|
||||||
func Check() {
|
|
||||||
mageutil.CheckAndReportBinariesStatus()
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
//go:build mage && !windows
|
|
||||||
// +build mage,!windows
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/openimsdk/tools/utils/mageutil"
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
func setMaxOpenFiles() error {
|
|
||||||
var rLimit syscall.Rlimit
|
|
||||||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
rLimit.Max = uint64(mageutil.MaxFileDescriptors)
|
|
||||||
rLimit.Cur = uint64(mageutil.MaxFileDescriptors)
|
|
||||||
return syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
//go:build mage
|
|
||||||
// +build mage
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
func setMaxOpenFiles() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
serviceBinaries:
|
|
||||||
openim-no-port: 1
|
|
||||||
openim-test: 1
|
|
||||||
|
|
||||||
toolBinaries:
|
|
||||||
- check-free-memory
|
|
||||||
|
|
||||||
maxFileDescriptors: 10000
|
|
Loading…
Reference in new issue