diff --git a/Makefile b/Makefile index 0fd1d7a922f..ef2130f452e 100644 --- a/Makefile +++ b/Makefile @@ -331,3 +331,11 @@ docsgen: print-%: @echo $*=$($*) + +# Sentinel build mode +lotus-sentinel: $(BUILD_DEPS) + rm -f lotus + go build $(GOFLAGS) -ldflags="-X=github.com/filecoin-project/lotus/build.SentinelMode=true" -o lotus ./cmd/lotus + go run github.com/GeertJohan/go.rice/rice append --exec lotus -i ./build + +.PHONY: lotus diff --git a/build/sentinel.go b/build/sentinel.go new file mode 100644 index 00000000000..e8575f644f5 --- /dev/null +++ b/build/sentinel.go @@ -0,0 +1,3 @@ +package build + +var SentinelMode string = "false" diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index c810520f681..1e4b7abf01e 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -13,6 +13,7 @@ import ( "net/http" "os" "runtime/pprof" + "strconv" "strings" paramfetch "github.com/filecoin-project/go-paramfetch" @@ -128,10 +129,6 @@ var DaemonCmd = &cli.Command{ Usage: "start lotus in lite mode", Hidden: true, }, - &cli.BoolFlag{ - Name: "sentinel", - Usage: "start lotus in sentinel mode.", - }, &cli.StringFlag{ Name: "pprof", Usage: "specify name of file for writing cpu profile to", @@ -517,7 +514,10 @@ func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool) func getDaemonMode(cctx *cli.Context) (daemonMode, error) { isLite := cctx.Bool("lite") - isSentinel := cctx.Bool("sentinel") + isSentinel, err := strconv.ParseBool(build.SentinelMode) + if err != nil { + return modeUnknown, err + } switch { case !isLite && !isSentinel: