Search Results for

    Show / Hide Table of Contents

    Create an Update Service package

    Now lets create an Update Service package for the Site Manager. We assume you have gone through the tutorial where you create your first package.

    1. In a location of your choice, create the following file structure:

      Site Manager Package
      │   CreatePackage.ps1
      │
      └───sm-setup
      │   │   Package.psm1
      
    2. Edit Package.psm1 and open it with PowerShell ISE or your favorite PowerShell editor (We use VS code) and add the following content to it:

      $ErrorActionPreference = 'stop'
      
      function Install-Package($Context)
      {
          # Path to the setup file during execution:
          $SetupExe = (Join-Path $Context.TemporaryDirectory 'LSOne.SiteManager.Setup.exe')
          # Execute the setup file with silent parameters:
          & $SetupExe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /LOG="c:\temp\innolog.txt" /DIR="C:\Program Files\LS Retail\Site Manager US package install" | Out-Null
          # Check if the execution was successful, else throw an error which Update Service will act on:
          if ($LastExitCode -ne 0)
          {
              throw 'Error occurred while installing LSOne.SiteManager.Setup.exe'
          }
      }
      
    3. Edit CreatePackage.ps1 and add the following content:

      $env:PSModulePath = [System.Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
      
      $ErrorActionPreference = 'stop'
      Import-Module UpdateServiceServer
      
      $SiteManagerApp = @{
          Id = 'ls-one-site-manager'
          Name = 'Site Manager package'
          Version = (Get-ItemProperty (Join-Path $Context.TemporaryDirectory 'LSOne.SiteManager.Setup.exe')).VersionInfo.fileversion.Trim()
          InputPath = @(
              Join-Path $PSScriptRoot 'sm-setup\*' # Add all files to package from directory.
          )
          OutputDir = (Join-Path $PSScriptRoot 'Output')
          Commands = @{
              Install = 'Package.psm1:Install-Package'
              Update = 'Package.psm1:Install-Package'
          }
      }
      
      # Create the package and import it to server
      New-UssPackage @SiteManagerApp -Force | Import-UssPackage -Server "Insert your server here" -Port "Insert port here" -Force
      
    4. Place a Site Manager installer in the sm-setup folder.

    5. Execute the CreatePackage.ps1 script and your package will be created in a new folder Output.

    6. You should now be able to create an installer for the package through the Update Service server, like we show you in the Server Management section of the create an installer instuctions.

    In This Article
    Back to top Generated by DocFX