LauncherGoDev/sysgo/UI/comercial_package.go
2023-01-26 07:17:15 +00:00

45 lines
1.0 KiB
Go

package UI
import (
"path/filepath"
)
type CommercialSoftwarePackage struct {
BinLocation string
MenuLocation string
}
func NewCommercialSoftwarePackage(b,m string) *CommercialSoftwarePackage{
return &CommercialSoftwarePackage{b,m}
}
func (self *CommercialSoftwarePackage) Init() {
script := filepath.Join(self.MenuLocation,"Setup.sh")
MakeExecutable(script)
script = filepath.Join(self.MenuLocation,"Run.sh")
MakeExecutable(script)
}
func (self *CommercialSoftwarePackage) IsInstalled() bool {
return FileExists(self.BinLocation)
}
func (self *CommercialSoftwarePackage) IsConfiged() bool {
return FileExists(filepath.Join(self.MenuLocation,".done"))
}
func (self *CommercialSoftwarePackage) GetRunScript() string {
return filepath.Join(self.MenuLocation,"Run.sh")
}
func (self *CommercialSoftwarePackage) RunSetup() {
if self.IsConfiged() == false {
script := filepath.Join(self.MenuLocation,"Setup.sh")
MakeExecutable(script)
System(script) /// Scripts with very short runtime
}
}