2020-07-07 16:36:22 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func sanityCheck() {
|
|
|
|
enhanceMsg := func(msg string, a ...interface{}) string {
|
|
|
|
return fmt.Sprintf("sanity check: "+msg+"; if running on local:exec, make sure to run `make` from the root of the oni repo", a...)
|
|
|
|
}
|
|
|
|
|
|
|
|
dir := "/var/tmp/filecoin-proof-parameters"
|
|
|
|
stat, err := os.Stat(dir)
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
panic(enhanceMsg("proofs parameters not available in /var/tmp/filecoin-proof-parameters"))
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
panic(enhanceMsg("failed to stat /var/tmp/filecoin-proof-parameters: %s", err))
|
|
|
|
}
|
|
|
|
|
|
|
|
if !stat.IsDir() {
|
|
|
|
panic(enhanceMsg("/var/tmp/filecoin-proof-parameters is not a directory; aborting"))
|
|
|
|
}
|
|
|
|
|
2022-09-09 11:53:40 +00:00
|
|
|
files, err := os.ReadDir(dir)
|
2020-07-07 16:36:22 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(enhanceMsg("failed list directory /var/tmp/filecoin-proof-parameters: %s", err))
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(files) == 0 {
|
|
|
|
panic(enhanceMsg("no files in /var/tmp/filecoin-proof-parameters"))
|
|
|
|
}
|
|
|
|
}
|