File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1179,19 +1179,32 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null
1179
1179
function parseCommandsByLineForSudo (Collection $ commands , Server $ server ): array
1180
1180
{
1181
1181
$ commands = $ commands ->map (function ($ line ) {
1182
- if (! str ($ line )->startsWith ('cd ' ) && ! str ($ line )->startsWith ('command ' ) && ! str ($ line )->startsWith ('echo ' ) && ! str ($ line )->startsWith ('true ' )) {
1182
+ if (! str (trim ($ line ))->startsWith ([
1183
+ 'cd ' ,
1184
+ 'command ' ,
1185
+ 'echo ' ,
1186
+ 'true ' ,
1187
+ 'if ' ,
1188
+ 'fi ' ,
1189
+ ])) {
1183
1190
return "sudo $ line " ;
1184
1191
}
1185
1192
1193
+ if (str (trim ($ line ))->startsWith ('if ' )) {
1194
+ return str_replace ('if ' , 'if sudo ' , $ line );
1195
+ }
1196
+
1186
1197
return $ line ;
1187
1198
});
1199
+
1188
1200
$ commands = $ commands ->map (function ($ line ) use ($ server ) {
1189
1201
if (Str::startsWith ($ line , 'sudo mkdir -p ' )) {
1190
1202
return "$ line && sudo chown -R $ server ->user : $ server ->user " .Str::after ($ line , 'sudo mkdir -p ' ).' && sudo chmod -R o-rwx ' .Str::after ($ line , 'sudo mkdir -p ' );
1191
1203
}
1192
1204
1193
1205
return $ line ;
1194
1206
});
1207
+
1195
1208
$ commands = $ commands ->map (function ($ line ) {
1196
1209
$ line = str ($ line );
1197
1210
if (str ($ line )->contains ('$( ' )) {
You can’t perform that action at this time.
0 commit comments