@@ -57,7 +57,7 @@ public function checkCliTools(): ?CheckResult
57
57
58
58
$ required = match ($ distro ['dist ' ]) {
59
59
'alpine ' => self ::TOOLS_ALPINE ,
60
- 'redhat ' => self ::TOOLS_RHEL ,
60
+ 'redhat ' , ' centos ' => self ::TOOLS_RHEL ,
61
61
'arch ' => self ::TOOLS_ARCH ,
62
62
default => self ::TOOLS_DEBIAN ,
63
63
};
@@ -72,6 +72,7 @@ public function checkCliTools(): ?CheckResult
72
72
'ubuntu ' ,
73
73
'alpine ' ,
74
74
'redhat ' ,
75
+ 'centos ' ,
75
76
'Deepin ' ,
76
77
'arch ' ,
77
78
'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
121
122
'ubuntu ' , 'debian ' , 'Deepin ' => 'apt-get install -y ' ,
122
123
'alpine ' => 'apk add ' ,
123
124
'redhat ' => 'dnf install -y ' ,
125
+ 'centos ' => 'yum install -y ' ,
124
126
'arch ' => 'pacman -S --noconfirm ' ,
125
127
default => throw new RuntimeException ('Current linux distro does not have an auto-install script for musl packages yet. ' ),
126
128
};
127
129
$ prefix = '' ;
128
- if (get_current_user ( ) !== 'root ' ) {
130
+ if (( $ user = exec ( ' whoami ' ) ) !== 'root ' ) {
129
131
$ 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 ' );
131
133
}
132
134
try {
133
135
$ is_debian = in_array ($ distro ['dist ' ], ['debian ' , 'ubuntu ' , 'Deepin ' ]);
0 commit comments