2022-12-11 14:38:01 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
2023-03-08 15:08:59 +08:00
|
|
|
"strings"
|
2022-12-11 14:38:01 +08:00
|
|
|
|
2022-10-25 12:55:00 +08:00
|
|
|
"github.com/sagernet/sing-box/cmd/internal/build_shared"
|
2023-03-06 16:32:16 +08:00
|
|
|
C "github.com/sagernet/sing-box/constant"
|
2022-12-11 14:38:01 +08:00
|
|
|
"github.com/sagernet/sing-box/log"
|
2023-03-06 16:32:16 +08:00
|
|
|
"github.com/sagernet/sing/common"
|
2022-12-11 14:38:01 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2022-10-25 12:55:00 +08:00
|
|
|
build_shared.FindSDK()
|
2022-12-11 14:38:01 +08:00
|
|
|
|
2023-03-06 16:32:16 +08:00
|
|
|
currentTag, err := common.Exec("git", "describe", "--tags", "--abbrev=0").Read()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2023-03-08 15:08:59 +08:00
|
|
|
currentTag = strings.TrimSpace(currentTag)
|
|
|
|
|
2023-03-06 16:32:16 +08:00
|
|
|
if "v"+C.Version != currentTag {
|
2023-03-08 15:08:59 +08:00
|
|
|
log.Fatal("version mismatch, update constant.Version (", C.Version, ")", " to ", currentTag[1:])
|
2023-03-06 16:32:16 +08:00
|
|
|
}
|
|
|
|
|
2022-12-11 14:38:01 +08:00
|
|
|
command := exec.Command(os.Args[1], os.Args[2:]...)
|
|
|
|
command.Stdout = os.Stdout
|
|
|
|
command.Stderr = os.Stderr
|
2023-03-06 16:32:16 +08:00
|
|
|
err = command.Run()
|
2022-12-11 14:38:01 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|