mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
1f29b62827
commit
825fd7d050
2 changed files with 12 additions and 9 deletions
|
@ -207,8 +207,11 @@ class GitRepository extends Model
|
||||||
|
|
||||||
$cloneUrl = 'git@'.$gitSSHUrl['provider'].':'.$gitSSHUrl['owner'].'/'.$gitSSHUrl['name'].'.git';
|
$cloneUrl = 'git@'.$gitSSHUrl['provider'].':'.$gitSSHUrl['owner'].'/'.$gitSSHUrl['name'].'.git';
|
||||||
|
|
||||||
$shellFile = '/tmp/git-clone-' . $this->id . '.sh';
|
$shellFile = $findDomain->domain_root . '/git/tmp/git-clone-' . $this->id . '.sh';
|
||||||
$shellLog = '/tmp/git-clone-' . $this->id . '.log';
|
$shellLog = $findDomain->domain_root . '/git/tmp/git-clone-' . $this->id . '.log';
|
||||||
|
|
||||||
|
shell_exec('mkdir -p ' . dirname($shellFile));
|
||||||
|
shell_exec('chown '.$findHostingSubscription->system_username.':'.$findHostingSubscription->system_username.' -R ' . dirname(dirname($shellFile)));
|
||||||
|
|
||||||
$shellContent = view('actions.git.clone-repo', [
|
$shellContent = view('actions.git.clone-repo', [
|
||||||
'gitProvider' => $gitSSHUrl['provider'],
|
'gitProvider' => $gitSSHUrl['provider'],
|
||||||
|
@ -217,12 +220,15 @@ class GitRepository extends Model
|
||||||
'cloneUrl' => $cloneUrl,
|
'cloneUrl' => $cloneUrl,
|
||||||
'projectDir' => $projectDir,
|
'projectDir' => $projectDir,
|
||||||
'privateKeyFile' => $privateKeyFile,
|
'privateKeyFile' => $privateKeyFile,
|
||||||
|
'selfFile' => $shellFile,
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
file_put_contents($shellFile, $shellContent);
|
file_put_contents($shellFile, $shellContent);
|
||||||
|
|
||||||
shell_exec('chmod +x ' . $shellFile);
|
shell_exec('chmod +x ' . $shellFile);
|
||||||
shell_exec('bash '.$shellFile.' >> ' . $shellLog . ' &');
|
shell_exec('chown '.$findHostingSubscription->system_username.':'.$findHostingSubscription->system_username.' ' . $shellFile);
|
||||||
|
|
||||||
|
shell_exec('su -m ' . $findHostingSubscription->system_username . ' -c "bash '.$shellFile.' >> ' . $shellLog . ' &"');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
echo "Cloning started at {{ date('Y-m-d H:i:s') }}"
|
echo "Cloning started at {{ date('Y-m-d H:i:s') }}"
|
||||||
|
|
||||||
su -m {{$systemUsername}} -c "export HOME=/home/{{$systemUsername}}"
|
|
||||||
|
|
||||||
@if($privateKeyFile)
|
@if($privateKeyFile)
|
||||||
|
|
||||||
|
@ -8,14 +7,12 @@ ssh-keyscan {{$gitProvider}} >> /home/{{$systemUsername}}/.ssh/known_hosts
|
||||||
chmod 0600 /home/{{$systemUsername}}/.ssh/known_hosts
|
chmod 0600 /home/{{$systemUsername}}/.ssh/known_hosts
|
||||||
chown {{$systemUsername}}:{{$systemUsername}} /home/{{$systemUsername}}/.ssh/known_hosts
|
chown {{$systemUsername}}:{{$systemUsername}} /home/{{$systemUsername}}/.ssh/known_hosts
|
||||||
|
|
||||||
su -m {{$systemUsername}} -c 'git -c core.sshCommand="ssh -i {{$privateKeyFile}}" clone {{$cloneUrl}} {{$projectDir}}'
|
git -c core.sshCommand="ssh -i {{$privateKeyFile}}" clone {{$cloneUrl}} {{$projectDir}}
|
||||||
|
|
||||||
@else
|
@else
|
||||||
|
|
||||||
su -m {{$systemUsername}} -c 'git clone {{$cloneUrl}} {{$projectDir}}'
|
git clone {{$cloneUrl}} {{$projectDir}}
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-cloned {{$gitRepositoryId}}
|
rm -rf {{$selfFile}}
|
||||||
|
|
||||||
rm -rf /tmp/git-clone-{{$gitRepositoryId}}.sh
|
|
||||||
|
|
Loading…
Reference in a new issue