sysutils/git-backup - reference defined git. (https://github.com/opnsense/plugins/issues/2994)

This commit is contained in:
Ad Schellevis
2022-07-29 19:46:11 +02:00
parent ca778bc0d9
commit db2e4bcb06
@@ -159,10 +159,10 @@ class Git extends Base implements IBackupProvider
} else {
$url = substr($url, 0, $pos + 2) . urlencode((string)$mdl->user) . "@" . substr($url, $pos + 2);
}
exec("cd {$targetdir} && git remote remove origin");
exec("cd {$targetdir} && git remote add origin " . escapeshellarg($url));
exec("cd {$targetdir} && {$git} remote remove origin");
exec("cd {$targetdir} && {$git} remote add origin " . escapeshellarg($url));
$pushtxt = shell_exec(
"(cd {$targetdir} && git push origin " . escapeshellarg("master:{$mdl->branch}") .
"(cd {$targetdir} && {$git} push origin " . escapeshellarg("master:{$mdl->branch}") .
" && echo '__exit_ok__') 2>&1"
);
if (strpos($pushtxt, '__exit_ok__')) {