]> granicus.if.org Git - icinga2/commitdiff
Improve user experience when updating Icinga 2 with the NSIS installer
authorGunnar Beutner <gunnar@beutner.name>
Tue, 12 May 2015 11:49:52 +0000 (13:49 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 12 May 2015 11:55:40 +0000 (13:55 +0200)
fixes #8116

CMakeLists.txt
agent/windows-setup-agent/Icinga2SetupAgent.csproj
agent/windows-setup-agent/Program.cs
agent/windows-setup-agent/ServiceStatus.Designer.cs [new file with mode: 0644]
agent/windows-setup-agent/ServiceStatus.cs [new file with mode: 0644]
agent/windows-setup-agent/ServiceStatus.resx [new file with mode: 0644]
agent/windows-setup-agent/SetupWizard.cs

index 21a0145d5a7d103bd4891d35dace76012c387f0a..9fd1f316572c6582920d3d4aa540cad6b85b3842 100644 (file)
@@ -256,6 +256,23 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
 set(CPACK_NSIS_EXECUTABLES_DIRECTORY "sbin")
 set(CPACK_PACKAGE_EXECUTABLES "Icinga2SetupAgent;Icinga 2 Agent Wizard")
 set(CPACK_NSIS_MUI_FINISHPAGE_RUN "Icinga2SetupAgent")
+set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "nsExec::Exec 'net stop icinga2'")
+set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS}\nSleep 10000")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'icacls \\\"$INSTDIR\\\" /grant *S-1-5-20:(oi)(ci)m'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\etc\\\\icinga2\\\\pki'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\cache\\\\icinga2'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\pki'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\agent\\\\inventory'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\api\\\\config'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\api\\\\log'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\lib\\\\icinga2\\\\api\\\\zones'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\log\\\\icinga2\\\\compat\\\\archive'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\log\\\\icinga2\\\\crash'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\run\\\\icinga2\\\\cmd'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\spool\\\\icinga2\\\\perfdata'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nCreateDirectory '$INSTDIR\\\\var\\\\spool\\\\icinga2\\\\tmp'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec '\\\"$INSTDIR\\\\sbin\\\\icinga2\\\" --scm-install daemon'")
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}\nnsExec::Exec 'net start icinga2'")
 set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "nsExec::Exec '\\\"$INSTDIR\\\\sbin\\\\icinga2\\\" --scm-uninstall'")
 
 set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
index 4229f01830630e079b86f626b385ead620fa4367..e4f55e40d901a176741d909a9faf4640eb659916 100644 (file)
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ServiceStatus.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="ServiceStatus.Designer.cs">
+      <DependentUpon>ServiceStatus.cs</DependentUpon>
+    </Compile>
     <Compile Include="SetupWizard.cs">
       <SubType>Form</SubType>
     </Compile>
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="ServiceStatus.resx">
+      <DependentUpon>ServiceStatus.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="SetupWizard.resx">
       <DependentUpon>SetupWizard.cs</DependentUpon>
     </EmbeddedResource>
index e0f23e401abbd4943da1bdc28614f569b211af00..dea5a0f28fac90f4288d6a71babecd9191f3bd28 100644 (file)
@@ -1,10 +1,32 @@
 using System;
+using System.IO;
 using System.Windows.Forms;
+using Microsoft.Win32;
 
 namespace Icinga
 {
        static class Program
        {
+
+               public static string Icinga2InstallDir
+               {
+                       get
+                       {
+                               RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Icinga Development Team\\ICINGA2");
+
+                               if (rk == null)
+                                       return "";
+
+                               return (string)rk.GetValue("");
+                       }
+               }
+
+               public static void FatalError(Form owner, string message)
+               {
+                       MessageBox.Show(owner, message, owner.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
+                       Application.Exit();
+               }
+
                /// <summary>
                /// The main entry point for the application.
                /// </summary>
@@ -13,7 +35,20 @@ namespace Icinga
                {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
-                       Application.Run(new SetupWizard());
+
+                       string installDir = Program.Icinga2InstallDir;
+
+                       if (installDir == "")
+                               FatalError(null, "Icinga 2 does not seem to be installed properly.");
+
+                       Form form;
+
+                       if (File.Exists(installDir + "\\etc\\icinga2\\features-enabled\\api.conf"))
+                               form = new ServiceStatus();
+                       else
+                               form = new SetupWizard();
+
+                       Application.Run(form);
                }
        }
 }
diff --git a/agent/windows-setup-agent/ServiceStatus.Designer.cs b/agent/windows-setup-agent/ServiceStatus.Designer.cs
new file mode 100644 (file)
index 0000000..23973d5
--- /dev/null
@@ -0,0 +1,118 @@
+namespace Icinga
+{
+       partial class ServiceStatus
+       {
+               /// <summary>
+               /// Required designer variable.
+               /// </summary>
+               private System.ComponentModel.IContainer components = null;
+
+               /// <summary>
+               /// Clean up any resources being used.
+               /// </summary>
+               /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+               protected override void Dispose(bool disposing)
+               {
+                       if (disposing && (components != null))
+                       {
+                               components.Dispose();
+                       }
+                       base.Dispose(disposing);
+               }
+
+               #region Windows Form Designer generated code
+
+               /// <summary>
+               /// Required method for Designer support - do not modify
+               /// the contents of this method with the code editor.
+               /// </summary>
+               private void InitializeComponent()
+               {
+                       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ServiceStatus));
+                       this.picBanner = new System.Windows.Forms.PictureBox();
+                       this.lblStatus = new System.Windows.Forms.Label();
+                       this.txtStatus = new System.Windows.Forms.TextBox();
+                       this.btnReconfigure = new System.Windows.Forms.Button();
+                       this.btnOK = new System.Windows.Forms.Button();
+                       ((System.ComponentModel.ISupportInitialize)(this.picBanner)).BeginInit();
+                       this.SuspendLayout();
+                       // 
+                       // picBanner
+                       // 
+                       this.picBanner.Image = global::Icinga.Properties.Resources.icinga_banner;
+                       this.picBanner.Location = new System.Drawing.Point(0, 0);
+                       this.picBanner.Name = "picBanner";
+                       this.picBanner.Size = new System.Drawing.Size(625, 77);
+                       this.picBanner.TabIndex = 2;
+                       this.picBanner.TabStop = false;
+                       // 
+                       // lblStatus
+                       // 
+                       this.lblStatus.AutoSize = true;
+                       this.lblStatus.Location = new System.Drawing.Point(12, 105);
+                       this.lblStatus.Name = "lblStatus";
+                       this.lblStatus.Size = new System.Drawing.Size(79, 13);
+                       this.lblStatus.TabIndex = 3;
+                       this.lblStatus.Text = "Service Status:";
+                       // 
+                       // txtStatus
+                       // 
+                       this.txtStatus.Location = new System.Drawing.Point(97, 102);
+                       this.txtStatus.Name = "txtStatus";
+                       this.txtStatus.ReadOnly = true;
+                       this.txtStatus.Size = new System.Drawing.Size(278, 20);
+                       this.txtStatus.TabIndex = 2;
+                       // 
+                       // btnReconfigure
+                       // 
+                       this.btnReconfigure.Location = new System.Drawing.Point(219, 143);
+                       this.btnReconfigure.Name = "btnReconfigure";
+                       this.btnReconfigure.Size = new System.Drawing.Size(75, 23);
+                       this.btnReconfigure.TabIndex = 1;
+                       this.btnReconfigure.Text = "Reconfigure";
+                       this.btnReconfigure.UseVisualStyleBackColor = true;
+                       this.btnReconfigure.Click += new System.EventHandler(this.btnReconfigure_Click);
+                       // 
+                       // btnOK
+                       // 
+                       this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+                       this.btnOK.Location = new System.Drawing.Point(300, 143);
+                       this.btnOK.Name = "btnOK";
+                       this.btnOK.Size = new System.Drawing.Size(75, 23);
+                       this.btnOK.TabIndex = 0;
+                       this.btnOK.Text = "OK";
+                       this.btnOK.UseVisualStyleBackColor = true;
+                       this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+                       // 
+                       // ServiceStatus
+                       // 
+                       this.AcceptButton = this.btnOK;
+                       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+                       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+                       this.CancelButton = this.btnOK;
+                       this.ClientSize = new System.Drawing.Size(391, 186);
+                       this.Controls.Add(this.btnOK);
+                       this.Controls.Add(this.btnReconfigure);
+                       this.Controls.Add(this.txtStatus);
+                       this.Controls.Add(this.lblStatus);
+                       this.Controls.Add(this.picBanner);
+                       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+                       this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+                       this.MaximizeBox = false;
+                       this.Name = "ServiceStatus";
+                       this.Text = "Icinga 2 Service Status";
+                       ((System.ComponentModel.ISupportInitialize)(this.picBanner)).EndInit();
+                       this.ResumeLayout(false);
+                       this.PerformLayout();
+
+               }
+
+               #endregion
+
+               private System.Windows.Forms.PictureBox picBanner;
+               private System.Windows.Forms.Label lblStatus;
+               private System.Windows.Forms.TextBox txtStatus;
+               private System.Windows.Forms.Button btnReconfigure;
+               private System.Windows.Forms.Button btnOK;
+       }
+}
\ No newline at end of file
diff --git a/agent/windows-setup-agent/ServiceStatus.cs b/agent/windows-setup-agent/ServiceStatus.cs
new file mode 100644 (file)
index 0000000..3f9ae1a
--- /dev/null
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.ServiceProcess;
+
+namespace Icinga
+{
+       public partial class ServiceStatus : Form
+       {
+               public ServiceStatus()
+               {
+                       InitializeComponent();
+
+                       try {
+                               ServiceController sc = new ServiceController("icinga2");
+
+                               txtStatus.Text = sc.Status.ToString();
+                       } catch (InvalidOperationException) {
+                               txtStatus.Text = "Not Available";
+                       }
+               }
+
+               private void btnReconfigure_Click(object sender, EventArgs e)
+               {
+                       new SetupWizard().ShowDialog(this);
+               }
+
+               private void btnOK_Click(object sender, EventArgs e)
+               {
+                       Close();
+               }
+       }
+}
diff --git a/agent/windows-setup-agent/ServiceStatus.resx b/agent/windows-setup-agent/ServiceStatus.resx
new file mode 100644 (file)
index 0000000..724f4a2
--- /dev/null
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAABAAEAICAQAAAABADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAEAAAABAA
+        AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP//
+        AAD///8AAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAcAAAcAB3AAAAAAAAAAAAAAcABwB///cA
+        AAAAAAAAAAAAcAAA////AAAAAAAAAAAAAAAAAP///3AAAAAAAAAAAAAAAAD///9wAAAAAAAAAAAAAAAA
+        j//4AAAAB3AAAAAAAAAAAAj/jwAAAA/4AAAAAAAAAAAAAAiAAAAP9wAAAAAAAAAAAAAH9wAAf3AAAAAA
+        AAAAAAAAAH93d/cAAAAAAAAAAAAAAAB////3AAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAB/////9w
+        AAAAAAAAAAAAAAf/////gAAAAAAAAAAAAAAH//////h3AAAAAAAAAAAAB/////+I//h3eHAAAAAAAAD/
+        ////AAB3j//3AAAAAAB4////9wAAAAf/+AAAAAf/+AB4iPAAAAAAj/cAAAAH//AAAAD3AAAAAAcAAAAA
+        B/+AAAAAjwAAAAAAAAAAAAB3AAAAAA9wAAAAAAAAAAAAAAAAAAAIh3AAAAAAAAAAAAAAAAAAD//wAAAA
+        AAAAAAAAAAAAAH//9wAAAAAAAAAAAAAAAAB///cAAAAAAAcAAAAAAAAACP+AAAAAAHAAcAAAAAAAAAB3
+        AAAAAAcAAAcAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAAAAAAAAD/////4AAAB8AAAAOAAAABgAAAAYAA
+        AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAA
+        AAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAcAAAAPgAAAH/////w==
+</value>
+  </data>
+</root>
\ No newline at end of file
index f550853f99a5095720a44a5ce669d1793c48756b..3ade5edc706ace9f9bb76ca1c0c965c1aa99ef26 100644 (file)
@@ -8,7 +8,6 @@ using System.Runtime.InteropServices;
 using System.Security.Cryptography.X509Certificates;
 using System.Threading;
 using System.Net.NetworkInformation;
-using Microsoft.Win32;
 using System.IO.Compression;
 using System.Diagnostics;
 using System.ServiceProcess;
@@ -27,30 +26,11 @@ namespace Icinga
                        txtInstanceName.Text = Icinga2InstanceName;
                }
 
-               private void FatalError(string message)
-               {
-                       MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
-                       Application.Exit();
-               }
-
                private void Warning(string message)
                {
                        MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
 
-               private string Icinga2InstallDir
-               {
-                       get
-                       {
-                               RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Icinga Development Team\\ICINGA2");
-
-                               if (rk == null)
-                                       return "";
-
-                               return (string)rk.GetValue("");
-                       }
-               }
-
                private string Icinga2InstanceName
                {
                        get
@@ -85,7 +65,7 @@ namespace Icinga
                {
                        FileStream fp = null;
                        try {
-                               fp = File.Open(Icinga2InstallDir + String.Format("\\etc\\icinga2\\features-enabled\\{0}.conf", feature), FileMode.Create);
+                               fp = File.Open(Program.Icinga2InstallDir + String.Format("\\etc\\icinga2\\features-enabled\\{0}.conf", feature), FileMode.Create);
                                using (StreamWriter sw = new StreamWriter(fp, Encoding.ASCII)) {
                                        fp = null;
                                        sw.Write(String.Format("include \"../features-available/{0}.conf\"\n", feature));
@@ -164,12 +144,12 @@ namespace Icinga
                {
                        SetRetrievalStatus(25);
 
-                       string pathPrefix = Icinga2InstallDir + "\\etc\\icinga2\\pki\\" + txtInstanceName.Text;
+                       string pathPrefix = Program.Icinga2InstallDir + "\\etc\\icinga2\\pki\\" + txtInstanceName.Text;
 
                        string output;
 
                        if (!File.Exists(pathPrefix + ".crt")) {
-                               if (!RunProcess(Icinga2InstallDir + "\\sbin\\icinga2.exe",
+                               if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
                                        "pki new-cert --cn \"" + txtInstanceName.Text + "\" --key \"" + pathPrefix + ".key\" --cert \"" + pathPrefix + ".crt\"",
                                        out output)) {
                                        ShowErrorText(output);
@@ -181,7 +161,7 @@ namespace Icinga
 
                        _TrustedFile = Path.GetTempFileName();
 
-                       if (!RunProcess(Icinga2InstallDir + "\\sbin\\icinga2.exe",
+                       if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
                                "pki save-cert --host \"" + host + "\" --port \"" + port + "\" --key \"" + pathPrefix + ".key\" --cert \"" + pathPrefix + ".crt\" --trustedcert \"" + _TrustedFile + "\"",
                                out output)) {
                                ShowErrorText(output);
@@ -233,7 +213,7 @@ namespace Icinga
                        args += " --cn " + txtInstanceName.Text;
                        args += " --zone " + txtInstanceName.Text;
 
-                       if (!RunProcess(Icinga2InstallDir + "\\sbin\\icinga2.exe",
+                       if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
                                "node setup" + args,
                                out output)) {
                                ShowErrorText(output);
@@ -241,7 +221,7 @@ namespace Icinga
                        }
 
                        SetConfigureStatus(50, "Setting ACLs for the Icinga 2 directory...");
-                       DirectoryInfo di = new DirectoryInfo(Icinga2InstallDir);
+                       DirectoryInfo di = new DirectoryInfo(Program.Icinga2InstallDir);
                        DirectorySecurity ds = di.GetAccessControl();
                        FileSystemAccessRule rule = new FileSystemAccessRule("NT AUTHORITY\\NetworkService",
                                FileSystemRights.Modify,
@@ -251,18 +231,18 @@ namespace Icinga
 
                        SetConfigureStatus(75, "Installing the Icinga 2 service...");
 
-                       RunProcess(Icinga2InstallDir + "\\sbin\\icinga2.exe",
+                       RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
                                "--scm-uninstall",
                                out output);
 
-                       if (!RunProcess(Icinga2InstallDir + "\\sbin\\icinga2.exe",
+                       if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
                                "daemon --validate",
                                out output)) {
                                ShowErrorText(output);
                                return;
                        }
 
-                       if (!RunProcess(Icinga2InstallDir + "\\sbin\\icinga2.exe",
+                       if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
                                "--scm-install daemon",
                                out output)) {
                                ShowErrorText(output);
@@ -286,10 +266,7 @@ namespace Icinga
 
                private void AgentWizard_Shown(object sender, EventArgs e)
                {
-                       string installDir = Icinga2InstallDir;
-
-                       if (installDir == "")
-                               FatalError("Icinga 2 does not seem to be installed properly.");
+                       string installDir = Program.Icinga2InstallDir;
 
                        /* TODO: This is something the NSIS installer should do */
                        Directory.CreateDirectory(installDir + "\\etc\\icinga2\\pki");