. XigmaNAS® is a registered trademark of Michael Zoon (zoon01@xigmanas.com). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the developer nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once 'auth.inc'; require_once 'guiconfig.inc'; require_once("bastille_manager-lib.inc"); $gt_selection_delete_confirm = gtext('Do you really want to destroy this base release?'); $pgtitle = [gtext("Extensions"), gtext('Bastille'),gtext('Releases')]; $sphere_array = []; $sphere_record = []; $pconfig = []; function get_rel_list() { global $rootfolder; global $jail_dir; $result = []; if (is_dir("{$rootfolder}/releases")): $entries = preg_grep('/^[0-9]+\.[0-9]+\-RELEASE|(Debian[0-9]{1,2}$)|(Ubuntu_[0-9]{4}$)/', scandir("{$rootfolder}/releases")); foreach($entries as $entry): $a = preg_split('/\t/',$entry); $r = []; $name = $a[0]; if(preg_match('/^[0-9]+\.[0-9]+\-RELEASE|(Debian[0-9]{1,2}$)|(Ubuntu_[0-9]{4}$)/', $name, $m)): $r['name'] = $m[0]; else: $r['name'] = 'unknown'; endif; $r['relname'] = $r['name']; $result[] = $r; endforeach; endif; return $result; } $zfs_status = get_state_zfs(); if($zfs_status == "Invalid ZFS configuration"): // Warning if invalid ZFS configuration. $input_errors[] = gtext("WARNING: Invalid ZFS configuration detected."); endif; $rel_list = get_rel_list(); $sphere_array = $rel_list; if ($linux_compat_support == "YES"): $a_action = [ '14.3-RELEASE' => gettext('14.3-RELEASE'), '14.2-RELEASE' => gettext('14.2-RELEASE'), '14.1-RELEASE' => gettext('14.1-RELEASE'), '14.0-RELEASE' => gettext('14.0-RELEASE'), '13.5-RELEASE' => gettext('13.5-RELEASE'), '13.4-RELEASE' => gettext('13.4-RELEASE'), // Linux base release bootstrap is allowed from command-line. //'ubuntu-jammy' => gettext('Ubuntu-noble'), //'ubuntu-jammy' => gettext('Ubuntu-Jammy'), //'ubuntu-focal' => gettext('Ubuntu-Focal'), //'ubuntu-bionic' => gettext('Ubuntu-Bionic'), //'debian-bookworm' => gettext('Debian-Bookworm'), //'debian-bullseye' => gettext('Debian-Bullseye'), //'debian-buster' => gettext('Debian-Buster'), //'debian-stretch' => gettext('Debian-Stretch'), ]; else: $a_action = [ '14.3-RELEASE' => gettext('14.3-RELEASE'), '14.2-RELEASE' => gettext('14.2-RELEASE'), '14.1-RELEASE' => gettext('14.1-RELEASE'), '14.0-RELEASE' => gettext('14.0-RELEASE'), '13.5-RELEASE' => gettext('13.4-RELEASE'), '13.4-RELEASE' => gettext('13.4-RELEASE'), ]; endif; if($_POST): unset($input_errors); unset($errormsg); unset($savemsg); $pconfig = $_POST; if(isset($_POST['Cancel']) && $_POST['Cancel']): header('Location: bastille_manager_gui.php'); exit; endif; if (isset($_POST['Download']) && $_POST['Download']): $lib32 = ""; $ports = ""; $src = ""; $get_release = $pconfig['release_item']; $check_release = ("{$rootfolder}/releases/{$get_release}"); $cmd = sprintf('/bin/echo "Y" | /usr/local/bin/bastille bootstrap %1$s > %2$s',$get_release,$logevent); $base_mandatory = "base"; $zfs_status = get_state_zfs(); //unset($lib32,$ports,$src); if (isset($_POST['lib32'])): $lib32 = "lib32"; endif; if (isset($_POST['ports'])): $ports = "ports"; endif; if (isset($_POST['src'])): $src = "src"; endif; $opt_tarballs = "$lib32 $ports $src"; // Download a FreeBSD base release. if ($_POST['Download']): if($zfs_status == "Invalid ZFS configuration"): // Abort bootstrap if invalid ZFS configuration. $input_errors[] = gtext("Cannot bootstrap with an invalid ZFS configuration."); else: $savemsg = ""; $errormsg = ""; if ($opt_tarballs): if ($config_path): // Override default distfiles once. exec("/usr/sbin/sysrc -f {$config_path} bastille_bootstrap_archives=\"$base_mandatory $opt_tarballs\""); endif; endif; $return_val = 0; $output = []; exec($cmd,$output,$return_val); if($return_val == 0): ob_start(); include("{$logevent}"); $ausgabe = ob_get_contents(); $ausgabe = preg_replace('/\e[[][A-Za-z0-9];?[0-9]*m?/', '', $ausgabe); ob_end_clean(); $savemsg .= str_replace("\n", "
", $ausgabe)."
"; // Set back default distfiles. exec("/usr/sbin/sysrc -f {$config_path} bastille_bootstrap_archives=\"$default_distfiles\""); else: $errormsg .= sprintf(gtext('%s Failed to download and/or extract release base.'),$get_release); endif; endif; endif; endif; if (isset($_POST['Destroy']) && $_POST['Destroy']): if ($_POST['Destroy']): $get_release = $pconfig['release_item']; if($get_release == 'ubuntu-bionic'): $get_release = "Ubuntu_1804"; elseif($get_release == 'ubuntu-focal'): $get_release = "Ubuntu_2004"; elseif($get_release == 'ubuntu-jammy'): $get_release = "Ubuntu_2204"; elseif($get_release == 'debian-stretch'): $get_release = "Debian9"; elseif($get_release == 'debian-buster'): $get_release = "Debian10"; elseif($get_release == 'debian-bullseye'): $get_release = "Debian11"; elseif($get_release == 'debian-bookworm'): $get_release = "Debian12"; endif; $check_release = ("{$rootfolder}/releases/{$get_release}"); $check_used = exec("/usr/bin/grep -wo {$get_release} {$jail_dir}/*/fstab 2>/dev/null"); $cmd = ("/usr/local/bin/bastille destroy {$get_release}"); if (!file_exists($check_release)): // FreeBSD base release check. $savemsg .= sprintf(gtext('%s base does not exist, nothing to do.'),$get_release); else: // Do not delete base releases with containers child. if ($check_used): $errormsg .= sprintf(gtext('%s base appears to have containers child.'),$get_release); else: // Delete the FreeBSD base release/directory. if ($_POST['Destroy']): unset($output,$retval);mwexec2($cmd,$output,$retval); if($retval == 0): //$savemsg .= sprintf(gtext('%s base deleted successfully.'),$get_release); header('Location: bastille_manager_tarballs.php'); else: $errormsg .= sprintf(gtext('%s failed to delete.'),$get_release); endif; endif; endif; endif; endif; endif; endif; include 'fbegin.inc'; ?> add_area_tabnav()-> push()-> add_tabnav_upper()-> ins_tabnav_record('bastille_manager_gui.php',gettext('Containers'),gettext('Reload page'),true)-> ins_tabnav_record('bastille_manager_info.php',gettext('Information'),gettext('Reload page'),true)-> ins_tabnav_record('bastille_manager_maintenance.php',gettext('Maintenance'),gettext('Reload page'),true)-> pop()->add_tabnav_lower()-> ins_tabnav_record('bastille_manager_config.php',gettext('Bastille Configuration'),gettext('Reload page'),true)-> ins_tabnav_record('bastille_manager_tarballs.php',gettext('Base Releases'),gettext('Reload page'),true); $document->render(); ?>
" onclick="enable_change(true)" /> "/> " />
Configuration] with: [http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/].")?>