Skip to content

Commit 292df38

Browse files
committed
isInstalled for GoXcaddy
1 parent a483c42 commit 292df38

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/SPC/store/pkg/GoXcaddy.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@
1010

1111
class GoXcaddy extends CustomPackage
1212
{
13+
public static function isInstalled(): bool
14+
{
15+
$arch = arch2gnu(php_uname('m'));
16+
$os = match (PHP_OS_FAMILY) {
17+
'Windows' => 'win',
18+
'Darwin' => 'macos',
19+
'BSD' => 'freebsd',
20+
default => 'linux',
21+
};
22+
23+
$packageName = "go-xcaddy-{$arch}-{$os}";
24+
$pkgroot = PKG_ROOT_PATH;
25+
$folder = "{$pkgroot}/{$packageName}";
26+
27+
return is_dir($folder) && is_file("{$folder}/bin/go") && is_file("{$folder}/bin/xcaddy");
28+
}
29+
1330
public function getSupportName(): array
1431
{
1532
return [

0 commit comments

Comments
 (0)