File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
resources/views/actions/git Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -207,8 +207,11 @@ public function clone()
207
207
208
208
$ cloneUrl = 'git@ ' .$ gitSSHUrl ['provider ' ].': ' .$ gitSSHUrl ['owner ' ].'/ ' .$ gitSSHUrl ['name ' ].'.git ' ;
209
209
210
- $ shellFile = '/tmp/git-clone- ' . $ this ->id . '.sh ' ;
211
- $ shellLog = '/tmp/git-clone- ' . $ this ->id . '.log ' ;
210
+ $ shellFile = $ findDomain ->domain_root . '/git/tmp/git-clone- ' . $ this ->id . '.sh ' ;
211
+ $ shellLog = $ findDomain ->domain_root . '/git/tmp/git-clone- ' . $ this ->id . '.log ' ;
212
+
213
+ shell_exec ('mkdir -p ' . dirname ($ shellFile ));
214
+ shell_exec ('chown ' .$ findHostingSubscription ->system_username .': ' .$ findHostingSubscription ->system_username .' -R ' . dirname (dirname ($ shellFile )));
212
215
213
216
$ shellContent = view ('actions.git.clone-repo ' , [
214
217
'gitProvider ' => $ gitSSHUrl ['provider ' ],
@@ -217,12 +220,15 @@ public function clone()
217
220
'cloneUrl ' => $ cloneUrl ,
218
221
'projectDir ' => $ projectDir ,
219
222
'privateKeyFile ' => $ privateKeyFile ,
223
+ 'selfFile ' => $ shellFile ,
220
224
])->render ();
221
225
222
226
file_put_contents ($ shellFile , $ shellContent );
223
227
224
228
shell_exec ('chmod +x ' . $ shellFile );
225
- shell_exec ('bash ' .$ shellFile .' >> ' . $ shellLog . ' & ' );
229
+ shell_exec ('chown ' .$ findHostingSubscription ->system_username .': ' .$ findHostingSubscription ->system_username .' ' . $ shellFile );
230
+
231
+ shell_exec ('su -m ' . $ findHostingSubscription ->system_username . ' -c "bash ' .$ shellFile .' >> ' . $ shellLog . ' &" ' );
226
232
227
233
}
228
234
Original file line number Diff line number Diff line change 1
1
echo "Cloning started at {{ date (' Y-m-d H:i:s' ) } } "
2
2
3
- su -m {{ $systemUsername } } -c "export HOME=/home/{{ $systemUsername } } "
4
3
5
4
@if ($privateKeyFile )
6
5
7
6
ssh-keyscan {{ $gitProvider } } >> /home/{{ $systemUsername } } /.ssh/known_hosts
8
7
chmod 0600 /home/{{ $systemUsername } } /.ssh/known_hosts
9
8
chown {{ $systemUsername } } :{{ $systemUsername } } /home/{{ $systemUsername } } /.ssh/known_hosts
10
9
11
- su -m {{ $systemUsername } } -c ' git -c core.sshCommand="ssh -i {{ $privateKeyFile } } " clone {{ $cloneUrl } } {{ $projectDir } }'
10
+ git -c core.sshCommand="ssh -i {{ $privateKeyFile } } " clone {{ $cloneUrl } } {{ $projectDir } }
12
11
13
12
@else
14
13
15
- su -m {{ $systemUsername } } -c ' git clone {{ $cloneUrl } } {{ $projectDir } }'
14
+ git clone {{ $cloneUrl } } {{ $projectDir } }
16
15
17
16
@endif
18
17
19
- phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-cloned {{ $gitRepositoryId } }
20
-
21
- rm -rf /tmp/git-clone-{{ $gitRepositoryId } } .sh
18
+ rm -rf {{ $selfFile } }
You can’t perform that action at this time.
0 commit comments