示例#1
0
 public ApiBoolResponseDTO CreateDefaultBootMenu(BootMenuGenOptionsDTO defaultMenuOptions)
 {
     new DefaultBootMenu(defaultMenuOptions).Execute();
     return(new ApiBoolResponseDTO {
         Value = true
     });
 }
        protected void CreateStandardMenu()
        {
            var listSettings = new List<SettingEntity>
            {
                new SettingEntity
                {
                    Name = "Ipxe Requires Login",
                    Value = chkIpxeLogin.Checked.ToString(),
                    Id = Call.SettingApi.GetSetting("Ipxe Requires Login").Id
                }
            };

            Call.SettingApi.UpdateSettings(listSettings);

            var defaultBootMenuOptions = new BootMenuGenOptionsDTO();
            var pxeMode = GetSetting(SettingStrings.PxeMode);
            if (pxeMode.Contains("grub"))
            {
                defaultBootMenuOptions.GrubUserName = txtGrubUsername.Text;
                defaultBootMenuOptions.GrubPassword = txtGrubPassword.Text;
            }
            else
            {
                defaultBootMenuOptions.DebugPwd = consoleSha.Value;
                defaultBootMenuOptions.AddPwd = addcomputerSha.Value;
                defaultBootMenuOptions.OndPwd = ondsha.Value;
                defaultBootMenuOptions.DiagPwd = diagsha.Value;
            }
            defaultBootMenuOptions.Kernel = ddlComputerKernel.SelectedValue;
            defaultBootMenuOptions.BootImage = ddlComputerBootImage.SelectedValue;
            defaultBootMenuOptions.Type = "standard";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);
        }
示例#3
0
 public DefaultBootMenu(BootMenuGenOptionsDTO defaultBootMenu)
 {
     _defaultBoot             = defaultBootMenu;
     _bootEntryServices       = new BootEntryServices();
     _secondaryServerServices = new SecondaryServerServices();
     _registration            = SettingServices.GetSettingValue(SettingStrings.RegistrationEnabled) == "No" ? " skip_registration=true " : string.Empty;
 }
示例#4
0
        public bool CreateDefaultBootMenu(BootMenuGenOptionsDTO defaultMenuOptions)
        {
            Request.Method   = Method.POST;
            Request.Resource = string.Format("api/{0}/CreateDefaultBootMenu/", Resource);
            Request.AddJsonBody(defaultMenuOptions);
            var response = _apiRequest.Execute <ApiBoolResponseDTO>(Request);

            return(response != null && response.Value);
        }
示例#5
0
        protected void CreateStandardMenu()
        {
            var defaultBootMenuOptions = new BootMenuGenOptionsDTO();

            defaultBootMenuOptions.Kernel    = "4.5x64";
            defaultBootMenuOptions.BootImage = "initrd.xz";
            defaultBootMenuOptions.Type      = "standard";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);
        }
 public DefaultBootMenu(BootMenuGenOptionsDTO defaultBootMenu)
 {
     _defaultBoot             = defaultBootMenu;
     _bootEntryServices       = new BootEntryServices();
     _secondaryServerServices = new SecondaryServerServices();
     _registration            = SettingServices.GetSettingValue(SettingStrings.RegistrationEnabled) == "No" ? " skip_registration=true " : string.Empty;
     _keepNamePrompt          = SettingServices.GetSettingValue(SettingStrings.OnDemandNamePrompt) == "Yes"
      ? " keep_name_prompt=true "
      : string.Empty;
 }
示例#7
0
        protected void CreateProxyMenu()
        {
            var defaultBootMenuOptions = new BootMenuGenOptionsDTO();

            defaultBootMenuOptions.Kernel    = "4.5";
            defaultBootMenuOptions.BootImage = "initrd.xz";
            defaultBootMenuOptions.Type      = "bios";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);

            defaultBootMenuOptions.Kernel    = "4.5";
            defaultBootMenuOptions.BootImage = "initrd.xz";
            defaultBootMenuOptions.Type      = "efi32";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);

            defaultBootMenuOptions.Kernel    = "4.5x64";
            defaultBootMenuOptions.BootImage = "initrd.xz";
            defaultBootMenuOptions.Type      = "efi64";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);
        }
        protected void CreateProxyMenu()
        {
            var listSettings = new List<SettingEntity>
            {
                new SettingEntity
                {
                    Name = "Ipxe Requires Login",
                    Value = chkIpxeProxy.Checked.ToString(),
                    Id = Call.SettingApi.GetSetting("Ipxe Requires Login").Id
                }
            };

            Call.SettingApi.UpdateSettings(listSettings);

            var defaultBootMenuOptions = new BootMenuGenOptionsDTO
            {
                DebugPwd = consoleShaProxy.Value,
                AddPwd = addcomputerShaProxy.Value,
                OndPwd = ondshaProxy.Value,
                DiagPwd = diagshaProxy.Value,
                GrubUserName = txtGrubProxyUsername.Text,
                GrubPassword = txtGrubProxyPassword.Text
            };

            defaultBootMenuOptions.Kernel = ddlBiosKernel.SelectedValue;
            defaultBootMenuOptions.BootImage = ddlBiosBootImage.SelectedValue;
            defaultBootMenuOptions.Type = "bios";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);

            defaultBootMenuOptions.Kernel = ddlEfi32Kernel.SelectedValue;
            defaultBootMenuOptions.BootImage = ddlEfi32BootImage.SelectedValue;
            defaultBootMenuOptions.Type = "efi32";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);

            defaultBootMenuOptions.Kernel = ddlEfi64Kernel.SelectedValue;
            defaultBootMenuOptions.BootImage = ddlEfi64BootImage.SelectedValue;
            defaultBootMenuOptions.Type = "efi64";
            Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);
        }
示例#9
0
 public DefaultBootMenu(BootMenuGenOptionsDTO defaultBootMenu)
 {
     _defaultBoot             = defaultBootMenu;
     _bootEntryServices       = new BootEntryServices();
     _secondaryServerServices = new SecondaryServerServices();
 }
示例#10
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            string unixDist = null;

            if (ValidateForm())
            {
                var adminUser = Call.CloneDeployUserApi.GetByName("clonedeploy");
                adminUser.Salt     = Utility.CreateSalt(64);
                adminUser.Password = Utility.CreatePasswordHash(txtUserPwd.Text, adminUser.Salt);
                adminUser.Token    = Utility.GenerateKey();
                Call.CloneDeployUserApi.Put(adminUser.Id, adminUser);

                string tftpPath = null;
                if (Environment.OSVersion.ToString().Contains("Unix"))
                {
                    string dist     = null;
                    var    distInfo = new ProcessStartInfo
                    {
                        UseShellExecute        = false,
                        FileName               = "uname",
                        RedirectStandardOutput = true,
                        RedirectStandardError  = true
                    };

                    using (var process = Process.Start(distInfo))
                        if (process != null)
                        {
                            dist = process.StandardOutput.ReadToEnd();
                        }

                    unixDist = dist != null && dist.ToLower().Contains("bsd") ? "bsd" : "linux";
                    tftpPath = unixDist == "bsd" ? "/usr/pbi/clonedeploy-amd64/tftpboot/" : "/tftpboot/";
                }
                else
                {
                    tftpPath = Call.FilesystemApi.GetServerPaths("defaultTftp", "");
                }

                var physicalPath = "";
                if (Environment.OSVersion.ToString().Contains("Unix"))
                {
                    physicalPath = unixDist == "bsd" ? "/usr/pbi/clonedeploy-amd64/cd_dp" : "/cd_dp";
                }
                else
                {
                    physicalPath = Call.FilesystemApi.GetServerPaths("defaultDp", "");
                }

                var listSettings = new List <SettingEntity>
                {
                    new SettingEntity
                    {
                        Name  = "Server IP",
                        Value = txtServerIP.Text,
                        Id    = Call.SettingApi.GetSetting("Server IP").Id
                    },
                    new SettingEntity
                    {
                        Name  = "Tftp Path",
                        Value = tftpPath,
                        Id    = Call.SettingApi.GetSetting("Tftp Path").Id
                    },
                    new SettingEntity
                    {
                        Name  = "Tftp Server IP",
                        Value = txtServerIP.Text,
                        Id    = Call.SettingApi.GetSetting("Tftp Server IP").Id
                    }
                };

                if (unixDist == "bsd")
                {
                    listSettings.Add(new SettingEntity
                    {
                        Name  = "Sender Args",
                        Value = "--interface " + txtServerIP.Text,
                        Id    = Call.SettingApi.GetSetting("Sender Args").Id
                    });
                }

                Call.SettingApi.UpdateSettings(listSettings);

                var distributionPoint = new DistributionPointEntity();
                distributionPoint.DisplayName  = "Local_Default";
                distributionPoint.Server       = "[server-ip]";
                distributionPoint.Protocol     = "SMB";
                distributionPoint.ShareName    = "cd_share";
                distributionPoint.Domain       = "Workgroup";
                distributionPoint.RwUsername   = "******";
                distributionPoint.RwPassword   = txtReadWrite.Text;
                distributionPoint.RoUsername   = "******";
                distributionPoint.RoPassword   = txtReadOnly.Text;
                distributionPoint.IsPrimary    = 1;
                distributionPoint.QueueSize    = 3;
                distributionPoint.PhysicalPath = physicalPath;
                distributionPoint.Location     = "Local";
                Call.DistributionPointApi.Post(distributionPoint);


                var defaultBootMenuOptions = new BootMenuGenOptionsDTO();
                defaultBootMenuOptions.Kernel    = SettingStrings.DefaultKernel32;
                defaultBootMenuOptions.BootImage = "initrd.xz";
                defaultBootMenuOptions.Type      = "standard";
                Call.WorkflowApi.CreateDefaultBootMenu(defaultBootMenuOptions);

                var cdVersion = Call.CdVersionApi.Get(1);
                cdVersion.FirstRunCompleted = 1;

                if (Call.CdVersionApi.Put(cdVersion.Id, cdVersion).Success)
                {
                    EndUserMessage = "Setup Complete";
                    Response.Redirect("~/views/dashboard/dash.aspx?fromlogin=true");
                }
            }
        }