* initial completion of the sharing function

* Adjusting multi-partition disk mounts

* Add file sharing function

* update usb auto mount shell

* update samba config

* add umount disk function

* update change log

* update usb auto mount \

* update usb auto mount

* Update periodical.go
This commit is contained in:
link
2022-08-15 11:37:21 +08:00
committed by GitHub
parent 848ee63386
commit cee34ec1c2
46 changed files with 2167 additions and 592 deletions

View File

@@ -49,6 +49,7 @@ type SystemService interface {
CreateFile(path string) (int, error)
RenameFile(oldF, newF string) (int, error)
MkdirAll(path string) (int, error)
IsServiceRunning(name string) bool
}
type systemService struct {
}
@@ -232,9 +233,9 @@ func (s *systemService) GetTimeZone() string {
func (s *systemService) ExecUSBAutoMountShell(state string) {
if state == "False" {
command2.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;USB_Remove_File")
command2.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;USB_Stop_Auto")
} else {
command2.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;USB_Move_File")
command2.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;USB_Start_Auto")
}
}
@@ -287,6 +288,12 @@ func GetDeviceAllIP() []string {
}
return address
}
func (s *systemService) IsServiceRunning(name string) bool {
status := command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;CheckServiceStatus smbd")
return strings.TrimSpace(status) == "running"
}
func NewSystemService() SystemService {
return &systemService{}
}