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 @@ -1184,19 +1184,32 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null
1184
1184
function parseCommandsByLineForSudo (Collection $ commands , Server $ server ): array
1185
1185
{
1186
1186
$ commands = $ commands ->map (function ($ line ) {
1187
- if (! str ($ line )->startsWith ('cd ' ) && ! str ($ line )->startsWith ('command ' ) && ! str ($ line )->startsWith ('echo ' ) && ! str ($ line )->startsWith ('true ' )) {
1187
+ if (! str (trim ($ line ))->startsWith ([
1188
+ 'cd ' ,
1189
+ 'command ' ,
1190
+ 'echo ' ,
1191
+ 'true ' ,
1192
+ 'if ' ,
1193
+ 'fi ' ,
1194
+ ])) {
1188
1195
return "sudo $ line " ;
1189
1196
}
1190
1197
1198
+ if (str (trim ($ line ))->startsWith ('if ' )) {
1199
+ return str_replace ('if ' , 'if sudo ' , $ line );
1200
+ }
1201
+
1191
1202
return $ line ;
1192
1203
});
1204
+
1193
1205
$ commands = $ commands ->map (function ($ line ) use ($ server ) {
1194
1206
if (Str::startsWith ($ line , 'sudo mkdir -p ' )) {
1195
1207
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 ' );
1196
1208
}
1197
1209
1198
1210
return $ line ;
1199
1211
});
1212
+
1200
1213
$ commands = $ commands ->map (function ($ line ) {
1201
1214
$ line = str ($ line );
1202
1215
if (str ($ line )->contains ('$( ' )) {
You can’t perform that action at this time.
0 commit comments