Display the last used repository and branch and add a couple more descriptions.

This commit is contained in:
Erik Fonnesbeck 2011-02-04 05:52:30 -07:00
parent 891012ce07
commit b5efd82a93

View File

@ -179,18 +179,53 @@ function enable_altfirmwareurl(enable_over) {
<?=gettext("After updating, sync with the following repository/branch before reboot."); ?>
</td>
</tr>
<?php
if(is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) {
exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git config remote.origin.url", $output_str);
if(is_array($output_str) && !empty($output_str[0]))
$lastrepositoryurl = $output_str[0];
unset($output_str);
}
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Repository URL"); ?></td>
<td width="78%" class="vtable">
<input name="repositoryurl" type="input" class="formfld url" id="repositoryurl" size="64" value="<?php if ($gitcfg['repositoryurl']) echo $gitcfg['repositoryurl']; ?>">
<?php if($lastrepositoryurl): ?>
<br />
<?=sprintf(gettext("The most recently used repository was %s"), $lastrepositoryurl); ?>
<br />
<?=gettext("This will be used if the field is left blank."); ?>
<?php endif; ?>
</td>
</tr>
<?php
if(is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) {
exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git branch", $output_str);
if(is_array($output_str)) {
foreach($output_str as $output_line) {
if(strstr($output_line, '* ')) {
$lastbranch = substr($output_line, 2);
break;
}
}
}
unset($output_str);
}
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Branch name"); ?></td>
<td width="78%" class="vtable">
<input name="branch" type="input" class="formfld unknown" id="branch" size="64" value="<?php if ($gitcfg['branch']) echo $gitcfg['branch']; ?>">
<?php if($lastbranch): ?>
<br />
<?=gettext("Sync will not be performed if a branch is not specified."); ?>
<?=sprintf(gettext("The most recently used branch was %s"), $lastbranch); ?>
<?php else: ?>
<br />
<?=gettext("Usually the branch name is master"); ?>
<?php endif; ?>
<br />
<?=gettext("Note: Sync will not be performed if a branch is not specified."); ?>
</td>
</tr>
<?php endif; ?>