自动更新管控端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
764 B

package main
import (
"aufs/config"
"fmt"
"os"
)
func main() {
// 执行的时候,没有附带参数默认为客户端
// 获取ip地址
lcip, err := config.GetLocalIP()
// 错误异常不为空,就输出
if err != nil {
fmt.Printf("get server ip faild %v", err)
}
// 判断输入
args := os.Args
if args == nil || len(args) < 2 {
// 编程客户端
fmt.Printf("run as client\n")
fmt.Printf("Usage: ./fss -t /home/\n")
os.Exit(1)
}
config.G.LocalIP = lcip
//
flag := args[1]
if flag == "-t" {
wkdir := args[2]
// 赋值给全局
config.G.FilePath = wkdir
} else {
//
curdir, err := os.Getwd()
if err != nil {
fmt.Printf("initlizer faild %v", err)
}
// current work directory
config.G.FilePath = curdir
}
}