(packages: string[], distro = detectLinuxDistro())
| 236 | * Builds an install command for packages on the current distribution |
| 237 | */ |
| 238 | export function buildInstallCommand(packages: string[], distro = detectLinuxDistro()): string { |
| 239 | if (distro.type === LinuxDistroType.UNKNOWN) { |
| 240 | return `# Unable to determine package manager. Please install manually: ${packages.join(', ')}`; |
| 241 | } |
| 242 | |
| 243 | const { packageManager } = distro; |
| 244 | const sudo = packageManager.requiresSudo ? 'sudo ' : ''; |
| 245 | |
| 246 | return `${sudo}${packageManager.installCommand} ${packages.join(' ')}`; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Gets the package name mappings for common dependencies |
no test coverage detected