Allow for distfiles download override

This commit is contained in:
Jose
2019-11-20 05:53:55 -04:00
parent 9cc370d4ad
commit 05e5e7ad5d
4 changed files with 42 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
======================
Version Description
1.0.9......Allow for distfiles download override.
1.0.8......Add option for thickjail creation if supported.
1.0.7......Added 12.1-RELEASE.
1.0.6......Reload page after base release download.

View File

@@ -51,6 +51,8 @@ $logfile = "{$rootfolder}/log/bastille_ext.log";
$logevent = "{$rootfolder}/log/bastille_last_event.log";
$backup_path = exec("/bin/cat {$configfile} | /usr/bin/grep 'BACKUP_DIR=' | /usr/bin/cut -d'\"' -f2");
$bastille_config = "{$rootfolder}/conf/bastille_config";
$config_path = exec("/bin/cat {$configfile} | /usr/bin/grep 'BASTILLE_CONFIG=' | /usr/bin/cut -d'\"' -f2");
$default_distfiles = exec("/bin/cat {$config_path} | /usr/bin/grep 'bastille_bootstrap_archives=' | /usr/bin/cut -d'\"' -f2");
$jail_dir = "{$rootfolder}/jails";
$image_dir = "ext/bastille/images";
$thick_jail = exec("/usr/local/bin/bastille create | grep -wo '\[option\]'");

View File

@@ -82,15 +82,37 @@ if($_POST):
$get_release = $pconfig['release_item'];
$check_release = ("{$rootfolder}/releases/{$get_release}");
$cmd = ("/usr/local/bin/bastille bootstrap {$get_release}");
$base_mandatory = "base";
unset($lib32,$ports,$src);
if ($_POST['lib32']):
$lib32 = "lib32";
endif;
if ($_POST['ports']):
$ports = "ports";
endif;
if ($_POST['src']):
$src = "src";
endif;
$opt_tarballs = "$lib32 $ports $src";
if(file_exists($check_release)):
// FreeBSD base release check.
$savemsg .= sprintf(gtext('%s base appears to be already extracted.'),$get_release);
else:
// Download a FreeBSD base release.
if ($_POST['Download']):
if ($opt_tarballs):
if ($config_path):
// Override default distfiles.
exec("/usr/sbin/sysrc -f {$config_path} bastille_bootstrap_archives=\"$base_mandatory $opt_tarballs\"");
endif;
endif;
unset($output,$retval);mwexec2($cmd,$output,$retval);
if($retval == 0):
//$savemsg .= sprintf(gtext('%s base downloaded and extracted successfully.'),$get_release);
// Set back default distfiles.
exec("/usr/sbin/sysrc -f {$config_path} bastille_bootstrap_archives=\"$default_distfiles\"");
header('Location: bastille_manager_tarballs.php');
else:
$errormsg .= sprintf(gtext('%s Failed to download and/or extract release base.'),$get_release);
@@ -182,12 +204,9 @@ $document->render();
<col class="area_data_settings_col_data">
</colgroup>
<thead>
<?php
html_titleline2(gettext('FreeBSD Base Releases'));
?>
</thead>
<tbody>
<?php
<?php
html_titleline2(gettext('FreeBSD Base Release Installed'));
foreach ($sphere_array as $sphere_record):
if (file_exists("{$rootfolder}/releases/{$sphere_record['relname']}/root/.profile")):
html_text2('releases',gettext('Installed Base:'),htmlspecialchars($sphere_record['relname']));
@@ -195,6 +214,14 @@ $document->render();
html_text2('releases',gettext('Unknown Base:'),htmlspecialchars($sphere_record['relname']));
endif;
endforeach;
?>
<?php
html_separator();
html_titleline2(gettext('FreeBSD Base Release Download'));
?>
</thead>
<tbody>
<?php
$a_action = [
//'12.1-RELEASE' => gettext('12.1-RELEASE'),
'12.1-RELEASE' => gettext('12.1-RELEASE'),
@@ -203,6 +230,10 @@ $document->render();
'11.2-RELEASE' => gettext('11.2-RELEASE'),
];
html_combobox2('release_item',gettext('Select Base Release'),$pconfig['release_item'],$a_action,'',true,false);
html_titleline2(gettext('Optional Distfiles (Overrides config)'));
html_checkbox2('lib32',gettext('32-bit Compatibility'),!empty($pconfig['lib32']) ? true : false,gettext('lib32.txz'),'',false);
html_checkbox2('ports',gettext('Ports tree'),!empty($pconfig['ports']) ? true : false,gettext('ports.txz'),'',false);
html_checkbox2('src',gettext('System source tree'),!empty($pconfig['src']) ? true : false,gettext('src.txz'),'',false);
?>
</tbody>
</table>

View File

@@ -1 +1 @@
1.0.8
1.0.9