()
| 37 | } |
| 38 | |
| 39 | func InitInfo() { |
| 40 | mb := model.BaseInfo{} |
| 41 | if file.Exists(config.AppInfo.DBPath + "/baseinfo.conf") { |
| 42 | err := json.Unmarshal(file.ReadFullFile(config.AppInfo.DBPath+"/baseinfo.conf"), &mb) |
| 43 | if err != nil { |
| 44 | logger.Error("baseinfo.conf", zap.String("error", err.Error())) |
| 45 | } |
| 46 | } |
| 47 | if file.Exists("/etc/CHANNEL") { |
| 48 | channel := file.ReadFullFile("/etc/CHANNEL") |
| 49 | mb.Channel = string(channel) |
| 50 | } |
| 51 | mac, err := service.MyService.System().GetMacAddress() |
| 52 | if err != nil { |
| 53 | logger.Error("GetMacAddress", zap.String("error", err.Error())) |
| 54 | } |
| 55 | mb.Hash = encryption.GetMD5ByStr(mac) |
| 56 | mb.Version = common.VERSION |
| 57 | osRelease, _ := file1.ReadOSRelease() |
| 58 | |
| 59 | mb.DriveModel = osRelease["MODEL"] |
| 60 | if len(mb.DriveModel) == 0 { |
| 61 | mb.DriveModel = "Casa" |
| 62 | } |
| 63 | os.Remove(config.AppInfo.DBPath + "/baseinfo.conf") |
| 64 | by, err := json.Marshal(mb) |
| 65 | if err != nil { |
| 66 | logger.Error("init info err", zap.Any("err", err)) |
| 67 | return |
| 68 | } |
| 69 | file.WriteToFullPath(by, config.AppInfo.DBPath+"/baseinfo.conf", 0o666) |
| 70 | } |
| 71 | |
| 72 | func InitNetworkMount() { |
| 73 | time.Sleep(time.Second * 10) |
no test coverage detected