@@ -57,7 +57,7 @@ public function checkCliTools(): ?CheckResult
5757
5858 $ required = match ($ distro ['dist ' ]) {
5959 'alpine ' => self ::TOOLS_ALPINE ,
60- 'redhat ' => self ::TOOLS_RHEL ,
60+ 'redhat ' , ' centos ' => self ::TOOLS_RHEL ,
6161 'arch ' => self ::TOOLS_ARCH ,
6262 default => self ::TOOLS_DEBIAN ,
6363 };
@@ -72,6 +72,7 @@ public function checkCliTools(): ?CheckResult
7272 'ubuntu ' ,
7373 'alpine ' ,
7474 'redhat ' ,
75+ 'centos ' ,
7576 'Deepin ' ,
7677 'arch ' ,
7778 'debian ' => CheckResult::fail (implode (', ' , $ missing ) . ' not installed on your system ' , 'install-linux-tools ' , [$ distro , $ missing ]),
@@ -121,13 +122,14 @@ public function fixBuildTools(array $distro, array $missing): bool
121122 'ubuntu ' , 'debian ' , 'Deepin ' => 'apt-get install -y ' ,
122123 'alpine ' => 'apk add ' ,
123124 'redhat ' => 'dnf install -y ' ,
125+ 'centos ' => 'yum install -y ' ,
124126 'arch ' => 'pacman -S --noconfirm ' ,
125127 default => throw new RuntimeException ('Current linux distro does not have an auto-install script for musl packages yet. ' ),
126128 };
127129 $ prefix = '' ;
128- if (get_current_user ( ) !== 'root ' ) {
130+ if (( $ user = exec ( ' whoami ' ) ) !== 'root ' ) {
129131 $ prefix = 'sudo ' ;
130- logger ()->warning ('Current user is not root, using sudo for running command ' );
132+ logger ()->warning ('Current user ( ' . $ user . ' ) is not root, using sudo for running command ' );
131133 }
132134 try {
133135 $ is_debian = in_array ($ distro ['dist ' ], ['debian ' , 'ubuntu ' , 'Deepin ' ]);
0 commit comments