示例#1
0
        if ($my_jail['type'] == 'full') {
            $conffile_list[] = $brig_root . "conf/freebsd-update.conf";
        } else {
            // The current jail is slim, so we have to use a special conf that excludes the shared basejail
            $conffile_list[] = $brig_root . "conf/freebsd-update_thin.conf";
            $base_selected = true;
        }
        // end of slim + basejail
        $basedir_list[] = $my_jail['jailpath'];
        $workdir_list[] = $my_jail['jailpath'] . "var/db/freebsd-update/";
    }
    // end of all jails foreach
    // We need to take care of the basejail!
    if ($base_selected) {
        $basejail = $config['thebrig']['basejail'];
        $basedir_list[] = $basejail['folder'];
        $workdir_list[] = $brig_update_db;
        $conffile_list[] = $brig_root . "conf/freebsd-update.conf";
    }
    // end of basejail selected
    // We need to take care of the template jail!
    if (is_dir($config['thebrig']['template'] . "usr/")) {
        $template_dir = $config['thebrig']['template'];
        $basedir_list[] = $template_dir;
        $workdir_list[] = $template_dir . "var/db/freebsd-update/";
        $conffile_list[] = $brig_root . "conf/freebsd-update.conf";
    }
    // end of template selected
    $response = thebrig_update($basedir_list, $workdir_list, $conffile_list, "Fetch");
}
// end of brig_update_ready
             // First calculate the unique hash for the install/rollback links
             $basedir_hash = exec("echo " . $template_dir . " | sha256 -q");
             // Check for the existence of the -install link
             if (!is_link($template_dir . "var/db/freebsd-update/" . $basedir_hash . "-install") && $pconfig['update_op'] == "Install") {
                 // We are attempting to install a jail that doesn't have any updates pending
                 $input_errors[] = "The TEMPLATE jail does not have any updates ready for installation. <br>Please run 'fetch' for this jail.";
             }
             // Check for a rollback
             if (!is_link($template_dir . "var/db/freebsd-update/" . $basedir_hash . "-rollback") && $pconfig['update_op'] == "Rollback") {
                 // We are attempting to rollback a jail that can't be
                 $input_errors[] = "The TEMPLATE jail cannot have its installation rolled back. <br>Sorry.";
             }
         }
         $response = 0;
         if (count($input_errors) == 0) {
             $response = thebrig_update($basedir_list, $workdir_list, $conffile_list, $pconfig['update_op']);
         } else {
             $input_errors[] = "No action was taken because of the above errors.";
         }
         if ($response == 1) {
             $input_errors[] = "Something bad happened while attempting to prep for the update operation";
         } elseif ($response == 2) {
             $input_errors[] = "Something bad happened while attempting to return Nas4Free to its previous state";
         }
     }
     // enf of else
 }
 // end of update_op
 // There are no input errors detected.
 if (!$input_errors) {
     // Now we have to do the accounting to make sure the config reflects all we know about the installation, if we carried out a