CheckResult::fail('musl-libc is not installed on your system', 'fix-musl', [$distro]), default => CheckResult::fail('musl-libc is not installed on your system'), }; } /** * @throws RuntimeException * @noinspection PhpUnused */ #[AsFixItem('fix-musl')] public function fixMusl(array $distro): bool { $install_cmd = match ($distro['dist']) { 'ubuntu', 'debian' => 'apt-get install musl musl-tools -y', 'alpine' => 'apk add musl musl-utils musl-dev', default => throw new RuntimeException('Current linux distro is not supported for auto-install musl packages'), }; $prefix = ''; if (get_current_user() !== 'root') { $prefix = 'sudo '; logger()->warning('Current user is not root, using sudo for running command'); } try { shell(true)->exec($prefix . $install_cmd); return true; } catch (RuntimeException) { return false; } } }