comercial_package.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package UI
  2. import (
  3. "path/filepath"
  4. )
  5. type CommercialSoftwarePackage struct {
  6. BinLocation string
  7. MenuLocation string
  8. }
  9. func NewCommercialSoftwarePackage(b,m string) *CommercialSoftwarePackage{
  10. return &CommercialSoftwarePackage{b,m}
  11. }
  12. func (self *CommercialSoftwarePackage) Init() {
  13. script := filepath.Join(self.MenuLocation,"Setup.sh")
  14. MakeExecutable(script)
  15. script = filepath.Join(self.MenuLocation,"Run.sh")
  16. MakeExecutable(script)
  17. }
  18. func (self *CommercialSoftwarePackage) IsInstalled() bool {
  19. return FileExists(self.BinLocation)
  20. }
  21. func (self *CommercialSoftwarePackage) IsConfiged() bool {
  22. return FileExists(filepath.Join(self.MenuLocation,".done"))
  23. }
  24. func (self *CommercialSoftwarePackage) GetRunScript() string {
  25. return filepath.Join(self.MenuLocation,"Run.sh")
  26. }
  27. func (self *CommercialSoftwarePackage) RunSetup() {
  28. if self.IsConfiged() == false {
  29. script := filepath.Join(self.MenuLocation,"Setup.sh")
  30. MakeExecutable(script)
  31. System(script) /// Scripts with very short runtime
  32. }
  33. }