예제 #1
0
function geli_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['geli']['vdisk'], "uuid");
            if (FALSE !== $cnid) {
                // Kill encrypted volume.
                disks_geli_kill($config['geli']['vdisk'][$cnid]['devicespecialfile']);
                // Reset disk file system type attribute ('fstype') in configuration.
                set_conf_disk_fstype($config['geli']['vdisk'][$cnid]['device'][0], "");
                unset($config['geli']['vdisk'][$cnid]);
                write_config();
            }
            break;
    }
    return $retval;
}
예제 #2
0
 if (empty($input_errors)) {
     $pconfig['do_action'] = true;
     $pconfig['init'] = isset($_POST['init']) ? true : false;
     $pconfig['name'] = $a_alldisk[$_POST['disk']]['name'];
     // e.g. da2
     $pconfig['devicespecialfile'] = $a_alldisk[$_POST['disk']]['devicespecialfile'];
     // e.g. /dev/da2
     $pconfig['aalgo'] = "none";
     // Check whether disk is mounted.
     if (disks_ismounted_ex($pconfig['devicespecialfile'], "devicespecialfile")) {
         $errormsg = sprintf(gettext("The disk is currently mounted! <a href='%s'>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$pconfig['devicespecialfile']}&action=umount");
         $pconfig['do_action'] = false;
     }
     if ($pconfig['do_action']) {
         // Set new file system type attribute ('fstype') in configuration.
         set_conf_disk_fstype($pconfig['devicespecialfile'], "geli");
         // Get disk information.
         $diskinfo = disks_get_diskinfo($pconfig['devicespecialfile']);
         $geli = array();
         $geli['uuid'] = uuid();
         $geli['name'] = $pconfig['name'];
         $geli['device'] = $pconfig['devicespecialfile'];
         $geli['devicespecialfile'] = "{$geli['device']}.eli";
         $geli['desc'] = "Encrypted disk";
         $geli['size'] = "{$diskinfo['mediasize_mbytes']}MB";
         $geli['aalgo'] = $pconfig['aalgo'];
         $geli['ealgo'] = $pconfig['ealgo'];
         $a_geli[] = $geli;
         write_config();
     }
 }
예제 #3
0
         $do_format[$key] = true;
         // Check whether disk is mounted.
         if (disks_ismounted_ex($disk, "devicespecialfile")) {
             $errormsg = sprintf(gettext("The disk is currently mounted! <a href='%s'>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount");
             $do_format[$key] = false;
         }
         // Check if user tries to format the OS disk.
         if (preg_match("/" . preg_quote($disk, "/") . "\\D+/", $cfdevice)) {
             $input_errors[] = gettext("Can't format the OS origin disk!");
             $do_format[$key] = false;
         }
         if ($do_format[$key]) {
             // Set new file system type attribute ('fstype') in configuration.
             $opt = array();
             $opt['zfsgpt'] = $zfsgpt ? "p1" : "";
             set_conf_disk_fstype($disk, $type, $opt);
             if (count($volumelabels) == 1 && count($disks) > 1) {
                 for ($i = 0; $i < count($disks); $i++) {
                     $_volumelabels[$i] = "{$volumelabels[0]}{$i}";
                 }
             } elseif (count($volumelabels) == 1 && count($disks) == 1) {
                 $_volumelabels[0] = $volumelabels[0];
             } else {
                 $_volumelabels = $volumelabels;
             }
             write_config();
             // Update list of configured disks.
             $a_disk = get_conf_all_disks_list_filtered();
         }
     }
 }
예제 #4
0
        $type = $_POST['type'];
        $minspace = $_POST['minspace'];
        $notinitmbr = $_POST['notinitmbr'];
        $volumelabel = $_POST['volumelabel'];
        // Check whether disk is mounted.
        if (disks_ismounted_ex($disk, "devicespecialfile")) {
            $errormsg = sprintf(gettext("The disk is currently mounted! <a href='%s'>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount");
            $do_format = false;
        }
        // Check if user tries to format the OS disk.
        if (preg_match("/" . preg_quote($disk, "/") . "\\D+/", $cfdevice)) {
            $input_errors[] = gettext("Can't format the OS origin disk!");
        }
        if ($do_format) {
            // Set new file system type attribute ('fstype') in configuration.
            set_conf_disk_fstype($disk, $type);
            write_config();
            // Update list of configured disks.
            $a_disk = get_conf_all_disks_list_filtered();
        }
    }
}
if (!isset($do_format)) {
    $do_format = false;
    $disk = '';
    $type = '';
    $minspace = '';
    $volumelabel = '';
}
include "fbegin.inc";
?>