-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from essentialkaos/develop
Version 12.119.0
- Loading branch information
Showing
13 changed files
with
292 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
* + fsutil | ||
* + hash | ||
* + httputil | ||
* ! initsystem | ||
* - initsystem | ||
* + jsonutil | ||
* + knf | ||
* + knf/united | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package initsystem | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
// // | ||
// Copyright (c) 2024 ESSENTIAL KAOS // | ||
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> // | ||
// // | ||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/essentialkaos/check" | ||
) | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
func Test(t *testing.T) { TestingT(t) } | ||
|
||
type InitSuite struct{} | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
var _ = Suite(&InitSuite{}) | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
func (s *InitSuite) TestLaunchdIsPresent(c *C) { | ||
c.Assert(IsPresent("com.apple.unknown"), Equals, false) | ||
c.Assert(IsPresent("com.apple.homed"), Equals, true) | ||
c.Assert(IsPresent("com.apple.cloudphotod"), Equals, true) | ||
} | ||
|
||
func (s *InitSuite) TestLaunchdIsWorks(c *C) { | ||
isWorks, err := IsWorks("com.apple.homed") | ||
|
||
c.Assert(err, IsNil) | ||
c.Assert(isWorks, Equals, true) | ||
|
||
isWorks, err = IsWorks("com.apple.cloudphotod") | ||
|
||
c.Assert(err, IsNil) | ||
c.Assert(isWorks, Equals, false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
// Package services provides methods for collecting information about system services | ||
package services | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
// // | ||
// Copyright (c) 2024 ESSENTIAL KAOS // | ||
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> // | ||
// // | ||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
import ( | ||
"github.com/essentialkaos/ek/v12/initsystem" | ||
"github.com/essentialkaos/ek/v12/support" | ||
) | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
// Collect collect info about services | ||
func Collect(services ...string) []support.Service { | ||
var result []support.Service | ||
|
||
for _, s := range services { | ||
service := support.Service{Name: s, Status: support.STATUS_UNKNOWN} | ||
|
||
if initsystem.IsPresent(s) { | ||
service.IsPresent = true | ||
service.IsEnabled, _ = initsystem.IsEnabled(s) | ||
|
||
isWorks, err := initsystem.IsWorks(s) | ||
|
||
switch { | ||
case err == nil && isWorks: | ||
service.Status = support.STATUS_WORKS | ||
case err == nil && !isWorks: | ||
service.Status = support.STATUS_STOPPED | ||
} | ||
} | ||
|
||
result = append(result, service) | ||
} | ||
|
||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Package services provides methods for collecting information about system services | ||
package services | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
// // | ||
// Copyright (c) 2024 ESSENTIAL KAOS // | ||
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> // | ||
// // | ||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
import "github.com/essentialkaos/ek/v12/support" | ||
|
||
// ////////////////////////////////////////////////////////////////////////////////// // | ||
|
||
// ❗ Collect collect info about services | ||
func Collect(services ...string) []support.Service { | ||
panic("UNSUPPORTED") | ||
} |
Oops, something went wrong.