salt/pkg/windows/nsis/installer/Salt-Minion-Setup.nsi

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2214 lines
80 KiB
NSIS
Raw Normal View History

2025-02-28 09:56:35 -07:00
# This file must be UNICODE
2016-08-23 22:37:17 +00:00
!define PRODUCT_NAME "Salt Minion"
!define PRODUCT_PUBLISHER "SaltStack, Inc"
2022-10-19 17:07:48 -06:00
!define PRODUCT_WEB_SITE "http://saltproject.io"
2016-08-08 23:23:04 +00:00
!define PRODUCT_CALL_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\salt-call.exe"
!define PRODUCT_CP_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\salt-cp.exe"
!define PRODUCT_KEY_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\salt-key.exe"
!define PRODUCT_MASTER_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\salt-master.exe"
!define PRODUCT_MINION_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\salt-minion.exe"
!define PRODUCT_RUN_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\salt-run.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
2021-06-25 16:08:16 -06:00
# Request admin rights
RequestExecutionLevel admin
2016-08-08 23:23:04 +00:00
# Import Libraries
2021-06-25 16:08:16 -06:00
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "MoveFileFolder.nsh"
!include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "StrFunc.nsh"
2016-08-08 23:23:04 +00:00
!include "WinMessages.nsh"
!include "WinVer.nsh"
2021-06-25 16:08:16 -06:00
!include "x64.nsh"
${StrLoc}
2025-02-28 09:56:35 -07:00
${StrRep}
${StrStrAdv}
2021-06-25 16:08:16 -06:00
# Required by MoveFileFolder.nsh
!insertmacro Locate
# Get salt version from CLI argument /DSaltVersion
!ifdef SaltVersion
2016-08-08 23:23:04 +00:00
!define PRODUCT_VERSION "${SaltVersion}"
!else
2016-08-08 23:23:04 +00:00
!define PRODUCT_VERSION "Undefined Version"
!endif
# Get architecture from CLI argument /DPythonArchitecture
# Should be x64, AMD64, or x86
!ifdef PythonArchitecture
!define PYTHON_ARCHITECTURE "${PythonArchitecture}"
!else
# Default
!define PYTHON_ARCHITECTURE "x64"
!endif
2023-01-31 18:43:41 -07:00
# Get Estimated Size from CLI argument /DEstimatedSize
2025-02-28 09:56:35 -07:00
!ifdef EstimatedSize
2023-01-31 18:43:41 -07:00
!define ESTIMATED_SIZE "${EstimatedSize}"
!else
# Default
!define ESTIMATED_SIZE 0
!endif
# x64 and AMD64 are AMD64, all others are x86
!if "${PYTHON_ARCHITECTURE}" == "x64"
2016-08-08 23:23:04 +00:00
!define CPUARCH "AMD64"
!else if "${PYTHON_ARCHITECTURE}" == "AMD64"
!define CPUARCH "AMD64"
!else
2016-08-08 23:23:04 +00:00
!define CPUARCH "x86"
!endif
2022-10-19 17:07:48 -06:00
!define BUILD_TYPE "Python 3"
!define OUTFILE "Salt-Minion-${PRODUCT_VERSION}-Py3-${CPUARCH}-Setup.exe"
2025-02-28 09:56:35 -07:00
VIProductVersion "1.0.0.0" # This actually updates File Version
VIAddVersionKey FileVersion "1.0.0.0" # This doesn't seem to do anything, but you'll get a warning without it
VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey "LegalTrademarks" "${PRODUCT_NAME} is a trademark of ${PRODUCT_PUBLISHER}"
VIAddVersionKey "LegalCopyright" "© ${PRODUCT_PUBLISHER}"
VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
################################################################################
# Early defines
################################################################################
2016-08-08 23:23:04 +00:00
!define Trim "!insertmacro Trim"
!macro Trim ResultVar String
Push "${String}"
2025-02-28 09:56:35 -07:00
!ifdef __UNINSTALL__
Call un.Trim
!else
Call Trim
!endif
2021-09-24 15:55:24 -06:00
Pop "${ResultVar}"
2016-08-08 23:23:04 +00:00
!macroend
# Part of the Explode function for Strings
!define Explode "!insertmacro Explode"
!macro Explode Length Separator String
2021-09-24 15:55:24 -06:00
Push "${Separator}"
Push "${String}"
Call Explode
Pop "${Length}"
!macroend
2025-02-28 09:56:35 -07:00
# Variables for Logging
Var LogFile
Var TimeStamp
Var cmdLineParams
Var logFileHandle
Var msg
# Followed this: https://nsis.sourceforge.io/StrRep
!define LogMsg '!insertmacro LogMsg'
!macro LogMsg _msg
Push "${_msg}"
!ifdef __UNINSTALL__
Call un.LogMsg
!else
Call LogMsg
!endif
!macroend
!macro Func_LogMsg un
Function ${un}LogMsg
Pop $msg
${If} $TimeStamp == ""
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
StrCpy $TimeStamp "$2-$1-$0_$4-$5-$6"
${EndIf}
${If} $LogFile == ""
!ifdef __UNINSTALL__
StrCpy $LogFile "$TEMP\SaltInstaller\$TimeStamp-uninstall.log"
!else
StrCpy $LogFile "$TEMP\SaltInstaller\$TimeStamp-install.log"
!endif
${IfNot} ${FileExists} "$TEMP\SaltInstaller\*.*"
CreateDirectory "$TEMP\SaltInstaller"
${EndIf}
${EndIf}
${Trim} $msg $msg
DetailPrint "$msg"
FileOpen $logFileHandle "$LogFile" a
FileSeek $logFileHandle 0 END
FileWrite $logFileHandle "$msg$\r$\n"
FileClose $logFileHandle
FunctionEnd
!macroend
2025-02-28 09:56:35 -07:00
!insertmacro Func_LogMsg ""
!insertmacro Func_LogMsg "un."
2016-08-08 23:23:04 +00:00
###############################################################################
# Configure Pages, Ordering, and Configuration
###############################################################################
!define MUI_ABORTWARNING
!define MUI_ICON "salt.ico"
!define MUI_UNICON "salt.ico"
2015-06-09 09:34:41 -06:00
!define MUI_WELCOMEFINISHPAGE_BITMAP "panel.bmp"
2019-01-31 15:53:31 -07:00
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "panel.bmp"
2017-09-12 12:49:20 -06:00
# Welcome page
!insertmacro MUI_PAGE_WELCOME
2016-08-08 23:23:04 +00:00
2017-09-12 12:49:20 -06:00
# License page
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
2016-08-08 23:23:04 +00:00
2021-06-08 10:32:12 -06:00
# Install location page
!define MUI_PAGE_CUSTOMFUNCTION_SHOW pageCheckExistingInstall
!insertmacro MUI_PAGE_DIRECTORY
2017-09-12 12:49:20 -06:00
# Configure Minion page
Page custom pageMinionConfig pageMinionConfig_Leave
2016-08-08 23:23:04 +00:00
2017-09-12 12:49:20 -06:00
# Instfiles page
!insertmacro MUI_PAGE_INSTFILES
2017-09-12 12:49:20 -06:00
# Finish page (Customized)
2016-08-08 23:23:04 +00:00
!define MUI_PAGE_CUSTOMFUNCTION_SHOW pageFinish_Show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE pageFinish_Leave
!insertmacro MUI_PAGE_FINISH
2017-09-12 12:49:20 -06:00
# Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
2017-09-12 12:49:20 -06:00
# Language files
!insertmacro MUI_LANGUAGE "English"
2016-08-08 23:23:04 +00:00
###############################################################################
# Custom Dialog Box Variables
###############################################################################
Var Dialog
Var Label
2021-06-25 16:08:16 -06:00
Var MinionStart_ChkBox
Var MinionStartDelayed_ChkBox
Var MasterHost_Cfg
Var MasterHost_TxtBox
2016-08-08 23:23:04 +00:00
Var MasterHost
2021-06-25 16:08:16 -06:00
Var MinionName_Cfg
Var MinionName_TxtBox
2016-08-08 23:23:04 +00:00
Var MinionName
Var ExistingConfigFound
2021-06-25 16:08:16 -06:00
Var ConfigType_DropList
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Var ConfigType
2021-06-25 16:08:16 -06:00
Var CustomConfig_TxtBox
Var CustomConfig_Btn
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Var CustomConfig
2021-06-25 16:08:16 -06:00
Var CustomConfigWarning_Lbl
Var ExistingConfigWarning_Lbl
Var DefaultConfigWarning_Lbl
Var MoveExistingConfig_ChkBox
Var MoveExistingConfig
2016-08-08 23:23:04 +00:00
Var StartMinion
Var StartMinionDelayed
2017-03-10 21:52:38 +00:00
Var DeleteInstallDir
2021-06-08 10:32:12 -06:00
Var DeleteRootDir
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Var ConfigWriteMinion
Var ConfigWriteMaster
2021-06-08 10:32:12 -06:00
# For new method installation
2021-09-24 11:19:06 -06:00
Var RegInstDir
2021-09-24 15:55:24 -06:00
Var RegRootDir
2021-06-08 10:32:12 -06:00
Var RootDir
Var SysDrive
Var ExistingInstallation
Var CustomLocation
###############################################################################
# Directory Picker Dialog Box
###############################################################################
Function pageCheckExistingInstall
# If this is an Existing Installation we want to disable the directory
# picker functionality
# https://nsis-dev.github.io/NSIS-Forums/html/t-166727.html
# Use the winspy tool (https://sourceforge.net/projects/winspyex/) to get
# the Control ID for the items you want to disable
# The Control ID is in the Details tab
# It is a Hex value that needs to be converted to an integer
${If} $ExistingInstallation == 1
# 32770 is Class name used by all NSIS dialog boxes
FindWindow $R0 "#32770" "" $HWNDPARENT
# 1019 is the Destination Folder text field (0x3FB)
GetDlgItem $R1 $R0 1019
EnableWindow $R1 0
# 1001 is the Browse button (0x3E9)
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0
# Disabling the Location Picker causes the buttons to behave incorrectly
# Esc and Enter don't work. Nor can you use Alt+N and Alt+B. Setting
# the focus to the Next button seems to fix this
# Set focus on Next button (0x1)
# Next=1, cancel=2, back=3
2021-06-08 10:32:12 -06:00
GetDlgItem $R1 $HWNDPARENT 1
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $R1 1
${EndIf}
FunctionEnd
2016-08-08 23:23:04 +00:00
###############################################################################
# Minion Settings Dialog Box
###############################################################################
Function pageMinionConfig
2016-08-08 23:23:04 +00:00
# Set Page Title and Description
!insertmacro MUI_HEADER_TEXT "Minion Settings" "Set the Minion Master and ID"
nsDialogs::Create 1018
Pop $Dialog
2016-08-08 23:23:04 +00:00
${If} $Dialog == error
Abort
${EndIf}
# Master IP or Hostname Dialog Control
2021-06-25 16:08:16 -06:00
${NSD_CreateLabel} 0 0 100% 9u "&Master IP or Hostname:"
2016-08-08 23:23:04 +00:00
Pop $Label
2021-06-25 16:08:16 -06:00
${NSD_CreateText} 0 10u 100% 12u $MasterHost
Pop $MasterHost_TxtBox
# Minion ID Dialog Control
2021-06-25 16:08:16 -06:00
${NSD_CreateLabel} 0 30u 100% 9u "Minion &Name:"
2016-08-08 23:23:04 +00:00
Pop $Label
2021-06-25 16:08:16 -06:00
${NSD_CreateText} 0 40u 100% 12u $MinionName
Pop $MinionName_TxtBox
2016-08-08 23:23:04 +00:00
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Config Drop List
2021-06-25 16:08:16 -06:00
${NSD_CreateDropList} 0 60u 25% 36u ""
Pop $ConfigType_DropList
${NSD_CB_AddString} $ConfigType_DropList "Default Config"
${NSD_CB_AddString} $ConfigType_DropList "Custom Config"
${NSD_OnChange} $ConfigType_DropList pageMinionConfig_OnChange
# Add Existing Config Warning Label
${NSD_CreateLabel} 0 75u 100% 50u \
"The values above are taken from an existing configuration found in \
`$RootDir\conf\minion`.$\n\
2021-06-08 10:32:12 -06:00
$\n\
Clicking `Install` will leave the existing config unchanged."
2021-06-25 16:08:16 -06:00
Pop $ExistingConfigWarning_Lbl
CreateFont $0 "Arial" 10 500 /ITALIC
2021-06-25 16:08:16 -06:00
SendMessage $ExistingConfigWarning_Lbl ${WM_SETFONT} $0 1
SetCtlColors $ExistingConfigWarning_Lbl 0xBB0000 transparent
# Add Checkbox to move root_dir
${NSD_CreateCheckBox} 0 125u 100% 10u \
"Move &existing root directory (C:\salt) to %ProgramData%\Salt."
2021-06-25 16:08:16 -06:00
Pop $MoveExistingConfig_ChkBox
CreateFont $0 "Arial" 10 500
SendMessage $MoveExistingConfig_ChkBox ${WM_SETFONT} $0 1
${If} $MoveExistingConfig == 1
${NSD_Check} $MoveExistingConfig_ChkBox
${EndIf}
# Add Default Config Warning Label
2021-06-25 16:08:16 -06:00
${NSD_CreateLabel} 0 75u 100% 60u "Clicking `Install` will backup the \
existing minion config file and minion.d directories. The values \
2021-06-25 16:08:16 -06:00
above will be used in the new default config.$\n\
$\n\
NOTE: If Master IP is set to `salt` and Minion Name is set to \
`hostname` no changes will be made."
2021-06-25 16:08:16 -06:00
Pop $DefaultConfigWarning_Lbl
CreateFont $0 "Arial" 10 500 /ITALIC
2021-06-25 16:08:16 -06:00
SendMessage $DefaultConfigWarning_Lbl ${WM_SETFONT} $0 1
SetCtlColors $DefaultConfigWarning_Lbl 0xBB0000 transparent
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Add Custom Config File Selector and Warning Label
2021-06-25 16:08:16 -06:00
${NSD_CreateText} 26% 60u 64% 12u $CustomConfig
Pop $CustomConfig_TxtBox
${NSD_CreateButton} 91% 60u 9% 12u "..."
Pop $CustomConfig_Btn
${NSD_OnClick} $CustomConfig_Btn pageCustomConfigBtn_OnClick
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${If} $ExistingConfigFound == 0
${NSD_CreateLabel} 0 75u 100% 60u \
"Values entered above will be used in the custom config.$\n\
2021-06-25 16:08:16 -06:00
$\n\
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
NOTE: If Master IP is set to `salt` and Minion Name is set to \
`hostname` no changes will be made."
${Else}
${NSD_CreateLabel} 0 75u 100% 60u \
"Clicking `Install` will backup the existing minion config \
file and minion.d directories. The values above will be used in \
the custom config.$\n\
2021-06-25 16:08:16 -06:00
$\n\
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
NOTE: If Master IP is set to `salt` and Minion Name is set to \
`hostname` no changes will be made."
${Endif}
2021-06-25 16:08:16 -06:00
Pop $CustomConfigWarning_Lbl
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
CreateFont $0 "Arial" 10 500 /ITALIC
2021-06-25 16:08:16 -06:00
SendMessage $CustomConfigWarning_Lbl ${WM_SETFONT} $0 1
SetCtlColors $CustomConfigWarning_Lbl 0xBB0000 transparent
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# If existing config found, add the Existing Config option to the Drop List
# If not, hide the Default Warning
${If} $ExistingConfigFound == 1
2021-06-25 16:08:16 -06:00
${NSD_CB_AddString} $ConfigType_DropList "Existing Config"
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Else}
2021-06-25 16:08:16 -06:00
ShowWindow $DefaultConfigWarning_Lbl ${SW_HIDE}
${Endif}
2021-06-25 16:08:16 -06:00
${NSD_CB_SelectString} $ConfigType_DropList $ConfigType
${NSD_SetText} $CustomConfig_TxtBox $CustomConfig
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Call pageMinionConfig_OnChange
2016-08-08 23:23:04 +00:00
nsDialogs::Show
FunctionEnd
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Function pageMinionConfig_OnChange
# You have to pop the top handle to keep the stack clean
Pop $R0
# Assign the current checkbox state to the variable
2021-06-25 16:08:16 -06:00
${NSD_GetText} $ConfigType_DropList $ConfigType
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Update Dialog
2021-06-25 16:08:16 -06:00
${Switch} $ConfigType
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Case} "Existing Config"
# Enable Master/Minion and set values
2021-06-25 16:08:16 -06:00
EnableWindow $MasterHost_TxtBox 0
EnableWindow $MinionName_TxtBox 0
${NSD_SetText} $MasterHost_TxtBox $MasterHost_Cfg
${NSD_SetText} $MinionName_TxtBox $MinionName_Cfg
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Hide Custom File Picker
2021-06-25 16:08:16 -06:00
ShowWindow $CustomConfig_TxtBox ${SW_HIDE}
ShowWindow $CustomConfig_Btn ${SW_HIDE}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Hide Warnings
2021-06-25 16:08:16 -06:00
ShowWindow $DefaultConfigWarning_Lbl ${SW_HIDE}
ShowWindow $CustomConfigWarning_Lbl ${SW_HIDE}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Show Existing Warning
2021-06-25 16:08:16 -06:00
ShowWindow $ExistingConfigWarning_Lbl ${SW_SHOW}
${If} $RootDir == "C:\salt"
ShowWindow $MoveExistingConfig_ChkBox ${SW_SHOW}
${Else}
ShowWindow $MoveExistingConfig_ChkBox ${SW_HIDE}
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Break}
${Case} "Custom Config"
# Enable Master/Minion and set values
2021-06-25 16:08:16 -06:00
EnableWindow $MasterHost_TxtBox 1
EnableWindow $MinionName_TxtBox 1
${NSD_SetText} $MasterHost_TxtBox $MasterHost
${NSD_SetText} $MinionName_TxtBox $MinionName
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Show Custom File Picker
2021-06-25 16:08:16 -06:00
ShowWindow $CustomConfig_TxtBox ${SW_SHOW}
ShowWindow $CustomConfig_Btn ${SW_SHOW}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Hide Warnings
2021-06-25 16:08:16 -06:00
ShowWindow $DefaultConfigWarning_Lbl ${SW_HIDE}
ShowWindow $ExistingConfigWarning_Lbl ${SW_HIDE}
ShowWindow $MoveExistingConfig_ChkBox ${SW_HIDE}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Show Custom Warning
2021-06-25 16:08:16 -06:00
ShowWindow $CustomConfigWarning_Lbl ${SW_SHOW}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Break}
${Case} "Default Config"
# Enable Master/Minion and set values
2021-06-25 16:08:16 -06:00
EnableWindow $MasterHost_TxtBox 1
EnableWindow $MinionName_TxtBox 1
${NSD_SetText} $MasterHost_TxtBox $MasterHost
${NSD_SetText} $MinionName_TxtBox $MinionName
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Hide Custom File Picker
2021-06-25 16:08:16 -06:00
ShowWindow $CustomConfig_TxtBox ${SW_HIDE}
ShowWindow $CustomConfig_Btn ${SW_HIDE}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Hide Warnings
2021-06-25 16:08:16 -06:00
ShowWindow $ExistingConfigWarning_Lbl ${SW_HIDE}
ShowWindow $MoveExistingConfig_ChkBox ${SW_HIDE}
ShowWindow $CustomConfigWarning_Lbl ${SW_HIDE}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Show Default Warning, if there is an existing config
${If} $ExistingConfigFound == 1
2021-06-25 16:08:16 -06:00
ShowWindow $DefaultConfigWarning_Lbl ${SW_SHOW}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Endif}
${Break}
${EndSwitch}
FunctionEnd
2017-12-20 19:14:47 -07:00
# File Picker Definitions
!define OFN_FILEMUSTEXIST 0x00001000
!define OFN_DONTADDTOREC 0x02000000
!define OPENFILENAME_SIZE_VERSION_400 76
!define OPENFILENAME 'i,i,i,i,i,i,i,i,i,i,i,i,i,i,&i2,&i2,i,i,i,i'
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Function pageCustomConfigBtn_OnClick
Pop $0
System::Call '*(&t${NSIS_MAX_STRLEN})i.s' # Allocate OPENFILENAME.lpstrFile buffer
System::Call '*(${OPENFILENAME})i.r0' # Allocate OPENFILENAME struct
System::Call '*$0(${OPENFILENAME})(${OPENFILENAME_SIZE_VERSION_400}, \
$hwndparent, , , , , , sr1, ${NSIS_MAX_STRLEN} , , , , \
t"Select Custom Config File", \
${OFN_FILEMUSTEXIST} | ${OFN_DONTADDTOREC})'
# Populate file name field
2021-06-25 16:08:16 -06:00
${NSD_GetText} $CustomConfig_TxtBox $2
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
System::Call "*$1(&t${NSIS_MAX_STRLEN}r2)" ; Set lpstrFile to the old path (if any)
# Open the dialog
System::Call 'COMDLG32::GetOpenFileName(ir0)i.r2'
# Get file name field
${If} $2 <> 0
System::Call "*$1(&t${NSIS_MAX_STRLEN}.r2)"
2021-06-25 16:08:16 -06:00
${NSD_SetText} $CustomConfig_TxtBox $2
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Free resources
System::Free $1
System::Free $0
FunctionEnd
2016-08-08 23:23:04 +00:00
Function pageMinionConfig_Leave
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Save the State
2021-06-25 16:08:16 -06:00
${NSD_GetText} $MasterHost_TxtBox $MasterHost
${NSD_GetText} $MinionName_TxtBox $MinionName
${NSD_GetText} $ConfigType_DropList $ConfigType
${NSD_GetText} $CustomConfig_TxtBox $CustomConfig
${NSD_GetState} $MoveExistingConfig_ChkBox $MoveExistingConfig
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Abort if config file not found
2021-06-25 16:08:16 -06:00
${If} $ConfigType == "Custom Config"
IfFileExists "$CustomConfig" done 0
MessageBox MB_OK|MB_ICONEXCLAMATION \
"File not found: $CustomConfig" \
/SD IDOK
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Abort
${EndIf}
2021-06-25 16:08:16 -06:00
${If} $MoveExistingConfig == 1
# This makes the $APPDATA variable point to the ProgramData folder
# instead of the current user's roaming AppData folder
2021-09-24 11:19:06 -06:00
SetShellVarContext all
2021-06-25 16:08:16 -06:00
# Get directory status
# We don't want to overwrite data in the new location, so it needs to
# either be empty or not found. Otherwise, warn and abort
2021-06-25 16:08:16 -06:00
${DirState} "$APPDATA\Salt Project\Salt" $R0 # 0=Empty, 1=full, -1=Not Found
StrCmp $R0 "1" 0 done # Move files if directory empty or missing
2021-06-25 16:08:16 -06:00
MessageBox MB_OKCANCEL \
"The $APPDATA\Salt Project\Salt directory is not empty.$\n\
These files will need to be moved manually." \
/SD IDOK IDCANCEL cancel
# OK: We're continuing without moving existing config
2021-06-25 16:08:16 -06:00
StrCpy $MoveExistingConfig 0
Goto done
2021-06-25 16:08:16 -06:00
cancel:
# Cancel: We're unchecking the checkbox and returning the user to
# the dialog box
# Abort just returns the user back to the dialog box
2021-06-25 16:08:16 -06:00
${NSD_UNCHECK} $MoveExistingConfig_ChkBox
Abort
${EndIf}
done:
2016-08-08 23:23:04 +00:00
FunctionEnd
###############################################################################
# Custom Finish Page
###############################################################################
Function pageFinish_Show
# Imports so the checkboxes will show up
2016-08-08 23:23:04 +00:00
!define SWP_NOSIZE 0x0001
!define SWP_NOMOVE 0x0002
!define HWND_TOP 0x0000
# Create Start Minion Checkbox
2016-08-08 23:23:04 +00:00
${NSD_CreateCheckbox} 120u 90u 100% 12u "&Start salt-minion"
2021-06-25 16:08:16 -06:00
Pop $MinionStart_ChkBox
SetCtlColors $MinionStart_ChkBox "" "ffffff"
# This command required to bring the checkbox to the front
2021-06-25 16:08:16 -06:00
System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) b ($MinionStart_ChkBox, ${HWND_TOP}, 0, 0, 0, 0, ${SWP_NOSIZE}|${SWP_NOMOVE})"
2016-08-08 23:23:04 +00:00
2016-10-04 16:14:13 -06:00
# Create Start Minion Delayed ComboBox
2017-03-31 15:12:41 -06:00
${NSD_CreateCheckbox} 130u 102u 100% 12u "&Delayed Start"
2021-06-25 16:08:16 -06:00
Pop $MinionStartDelayed_ChkBox
SetCtlColors $MinionStartDelayed_ChkBox "" "ffffff"
# This command required to bring the checkbox to the front
2021-06-25 16:08:16 -06:00
System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) b ($MinionStartDelayed_ChkBox, ${HWND_TOP}, 0, 0, 0, 0, ${SWP_NOSIZE}|${SWP_NOMOVE})"
2016-08-08 23:23:04 +00:00
# Load current settings for Minion
2016-08-23 22:37:17 +00:00
${If} $StartMinion == 1
2021-06-25 16:08:16 -06:00
${NSD_Check} $MinionStart_ChkBox
${EndIf}
# Load current settings for Minion Delayed
${If} $StartMinionDelayed == 1
2021-06-25 16:08:16 -06:00
${NSD_Check} $MinionStartDelayed_ChkBox
${EndIf}
FunctionEnd
2016-08-08 23:23:04 +00:00
Function pageFinish_Leave
# Assign the current checkbox states
2021-06-25 16:08:16 -06:00
${NSD_GetState} $MinionStart_ChkBox $StartMinion
${NSD_GetState} $MinionStartDelayed_ChkBox $StartMinionDelayed
FunctionEnd
2016-08-08 23:23:04 +00:00
###############################################################################
# Installation Settings
###############################################################################
Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${BUILD_TYPE})"
OutFile "${OutFile}"
2021-06-08 10:32:12 -06:00
InstallDir "C:\Program Files\Salt Project\Salt"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
2020-06-16 13:17:34 -06:00
Section -copy_prereqs
# Copy prereqs to the Plugins Directory
# These files are downloaded by build_pkg.bat
# This directory gets removed upon completion
SetOutPath "$PLUGINSDIR\"
2022-12-22 18:18:28 -07:00
File /r "..\..\prereqs\"
SectionEnd
2024-03-26 14:06:52 -06:00
# Check and install Visual C++ redist 2022 packages
2020-05-21 21:05:56 -06:00
# Hidden section (-) to install VCRedist
2024-03-26 14:06:52 -06:00
Section -install_vcredist_2022
2020-05-21 21:05:56 -06:00
2025-02-28 09:56:35 -07:00
${DisableX64FSRedirection}
2020-05-21 21:05:56 -06:00
Var /GLOBAL VcRedistName
2025-02-28 09:56:35 -07:00
# Determine which architecture needs to be installed
${if} ${runningx64}
strcpy $VcRedistName "vcredist_x64_2022"
${else}
strcpy $VcRedistName "vcredist_x86_2022"
${endif}
detailPrint "Selected $VcRedistName installer"
# Check for the presence of vcruntime140.dll
IfFileExists "$WINDIR\System32\vcruntime140.dll" file_found
file_not_found:
detailPrint "$VcRedistName not found"
# Install
Call InstallVCRedist
Goto end_of_section
2020-05-21 21:05:56 -06:00
2025-02-28 09:56:35 -07:00
file_found:
detailPrint "$VcRedistName found, install will continue"
2020-05-21 21:05:56 -06:00
2025-02-28 09:56:35 -07:00
end_of_section:
${EnableX64FSRedirection}
2020-05-21 21:05:56 -06:00
SectionEnd
Function InstallVCRedist
detailPrint "System requires $VcRedistName"
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
2025-02-28 09:56:35 -07:00
"$VcRedistName is currently not installed. Would you like to install?" \
/SD IDYES IDYES InstallVcRedist
detailPrint "$VcRedistName not installed"
detailPrint ">>>Installation aborted by user<<<"
MessageBox MB_ICONEXCLAMATION \
"$VcRedistName not installed. Aborted by user.$\n$\n\
Installer will now close." \
/SD IDOK
Quit
InstallVcRedist:
2020-05-21 21:05:56 -06:00
# If an output variable is specified ($0 in the case below), ExecWait
# sets the variable with the exit code (and only sets the error flag if
# an error occurs; if an error occurs, the contents of the user
# variable are undefined).
2020-05-21 21:05:56 -06:00
# http://nsis.sourceforge.net/Reference/ExecWait
ClearErrors
detailPrint "Installing $VcRedistName..."
ExecWait '"$PLUGINSDIR\$VcRedistName.exe" /install /quiet /norestart' $0
2020-05-21 21:05:56 -06:00
IfErrors 0 CheckVcRedistErrorCode
detailPrint "An error occurred during installation of $VcRedistName"
MessageBox MB_OK|MB_ICONEXCLAMATION \
"$VcRedistName failed to install. Try installing the package \
manually.$\n$\n\
The installer will now close." \
/SD IDOK
Quit
2020-05-21 21:05:56 -06:00
CheckVcRedistErrorCode:
# Check for Reboot Error Code (3010)
${If} $0 == 3010
detailPrint "$VcRedistName installed but requires a restart to complete."
detailPrint "Reboot and run Salt install again"
2021-06-08 10:32:12 -06:00
MessageBox MB_OK|MB_ICONINFORMATION \
2020-05-21 21:05:56 -06:00
"$VcRedistName installed but requires a restart to complete." \
/SD IDOK
# Check for any other errors
${ElseIfNot} $0 == 0
detailPrint "An error occurred during installation of $VcRedistName"
detailPrint "Error: $0"
MessageBox MB_OK|MB_ICONEXCLAMATION \
"$VcRedistName failed to install. Try installing the package \
mnually.$\n\
ErrorCode: $0$\n\
The installer will now close." \
/SD IDOK
2020-05-21 21:05:56 -06:00
${EndIf}
FunctionEnd
2025-02-28 09:56:35 -07:00
Section "Install" Install01
${If} $MoveExistingConfig == 1
2025-02-28 09:56:35 -07:00
${LogMsg} "Moving existing config to $APPDATA\Salt Project\Salt"
# This makes the $APPDATA variable point to the ProgramData folder
# instead of the current user's roaming AppData folder
2025-02-28 09:56:35 -07:00
${LogMsg} "Set context to all users"
SetShellVarContext all
# Make sure the target directory exists
2025-02-28 09:56:35 -07:00
${LogMsg} "Creating rootdir in ProgramData"
CreateDirectory "$APPDATA\Salt Project\Salt"
# Take ownership of the C:\salt directory
2025-02-28 09:56:35 -07:00
${LogMsg} "Taking ownership: $RootDir"
nsExec::ExecToStack "takeown /F $RootDir /R"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
# Move the C:\salt directory to the new location
StrCpy $switch_overwrite 0
2025-02-28 09:56:35 -07:00
${If} ${FileExists} "$RootDir\conf\*.*"
${LogMsg} "Moving $RootDir\conf to $APPDATA"
!insertmacro MoveFolder "$RootDir\conf" "$APPDATA\Salt Project\Salt\conf" "*.*"
${EndIf}
${If} ${FileExists} "$RootDir\srv\*.*"
${LogMsg} "Moving $RootDir\srv to $APPDATA"
!insertmacro MoveFolder "$RootDir\srv" "$APPDATA\Salt Project\Salt\srv" "*.*"
${EndIf}
${If} ${FileExists} "$RootDir\var\*.*"
${LogMsg} "Moving $RootDir\var to $APPDATA"
!insertmacro MoveFolder "$RootDir\var" "$APPDATA\Salt Project\Salt\var" "*.*"
${EndIf}
# Make RootDir the new location
StrCpy $RootDir "$APPDATA\Salt Project\Salt"
${EndIf}
${If} $ConfigType != "Existing Config"
Call BackupExistingConfig
${EndIf}
# Install files to the Installation Directory
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting outpath to $INSTDIR"
2016-08-08 23:23:04 +00:00
SetOutPath "$INSTDIR\"
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting Overwrite off"
2016-08-08 23:23:04 +00:00
SetOverwrite off
2025-02-28 09:56:35 -07:00
${LogMsg} "Copying files"
2022-12-22 18:18:28 -07:00
File /r "..\..\buildenv\"
# Set up Root Directory
2025-02-28 09:56:35 -07:00
${LogMsg} "Creating directory structure"
2021-07-01 17:02:00 -06:00
CreateDirectory "$RootDir\conf\pki\minion"
CreateDirectory "$RootDir\conf\minion.d"
CreateDirectory "$RootDir\var\cache\salt\minion\extmods\grains"
CreateDirectory "$RootDir\var\cache\salt\minion\proc"
CreateDirectory "$RootDir\var\log\salt"
2021-07-01 17:02:00 -06:00
CreateDirectory "$RootDir\var\run"
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting permissions on RootDir"
nsExec::ExecToStack 'icacls "$RootDir" /inheritance:r /grant:r "*S-1-5-32-544":(OI)(CI)F /grant:r "*S-1-5-18":(OI)(CI)F'
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
SectionEnd
2016-08-08 23:23:04 +00:00
Function .onInit
# This function gets executed before any other. This is where we will
# detect existing installations and config to be used by the installer
2025-02-28 09:56:35 -07:00
${LogMsg} "Running ${OUTFILE}"
# Make sure we do not allow 32-bit Salt on 64-bit systems
# This is the system the installer is running on
${If} ${RunningX64}
# This is the Python architecture the installer was built with
${If} ${CPUARCH} == "x86"
2025-02-28 09:56:35 -07:00
StrCpy $msg "Detected 64-bit Operating system.$\n\
Please install the 64-bit version of Salt on this operating system."
${LogMsg} $msg
MessageBox MB_OK|MB_ICONEXCLAMATION $msg /SD IDOK
${LogMsg} "Aborting"
Abort
${EndIf}
${Else}
# This is the Python architecture the installer was built with
${If} ${CPUARCH} == "AMD64"
2025-02-28 09:56:35 -07:00
StrCpy $msg "Detected 32-bit Operating system.$\n\
Please install the 32-bit version of Salt on this operating system."
${LogMsg} $msg
MessageBox MB_OK|MB_ICONEXCLAMATION $msg /SD IDOK
${LogMsg} "Aborting"
Abort
${EndIf}
${EndIf}
InitPluginsDir
2021-06-08 10:32:12 -06:00
Call parseInstallerCommandLineSwitches
2020-05-04 14:24:45 +02:00
# Uninstall msi-installed salt
2021-06-25 16:08:16 -06:00
# Source: https://nsis-dev.github.io/NSIS-Forums/html/t-303468.html
!define upgradecode {FC6FB3A2-65DE-41A9-AD91-D10A402BD641} # Salt upgrade code
2020-05-04 14:24:45 +02:00
StrCpy $0 0
2025-02-28 09:56:35 -07:00
${LogMsg} "Looking for MSI installation"
2020-05-04 14:24:45 +02:00
loop:
System::Call 'MSI::MsiEnumRelatedProducts(t "${upgradecode}",i0,i r0,t.r1)i.r2'
${If} $2 = 0
2025-02-28 09:56:35 -07:00
# Now $1 contains the product code
${LogMsg} product:$1
2020-05-04 14:24:45 +02:00
push $R0
StrCpy $R0 $1
Call UninstallMSI
pop $R0
IntOp $0 $0 + 1
goto loop
${Endif}
# If a custom config is passed on the CLI, verify its existence before
# continuing so we don't uninstall an existing installation and then fail
# NOTE: This handles custom config for silent installations where the
# NOTE: custom config is passed on the CLI. The GUI has its own checking
# NOTE: when the user selects a custom config.
2021-06-25 16:08:16 -06:00
${If} $ConfigType == "Custom Config"
2025-02-28 09:56:35 -07:00
${LogMsg} "Verifying custom config"
${If} ${FileExists} "$CustomConfig"
${LogMsg} "Found full path to custom config: $CustomConfig"
Goto checkExistingInstallation
${EndIf}
${If} ${FileExists} "$EXEDIR\$CustomConfig"
${LogMsg} "Found custom config with the install binary: $CustomConfig"
Goto checkExistingInstallation
${EndIf}
${LogMsg} "Custom config not found. Aborting"
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Abort
${EndIf}
checkExistingInstallation:
2020-05-21 21:05:56 -06:00
# Check for existing installation
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for existing installation"
# The NSIS installer is a 32bit application and will use the WOW6432Node
# in the registry by default. We need to look in the 64 bit location on
# 64 bit systems
${If} ${RunningX64}
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting registry context to 64-bit"
# https://nsis.sourceforge.io/Docs/Chapter4.html#setregview
SetRegView 64 # View the 64 bit portion of the registry
2025-02-28 09:56:35 -07:00
${LogMsg} "Reading uninstall string"
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
# Puts the nullsoft installer back to its default
${LogMsg} "Setting registry context to 32-bit"
SetRegView 32 # Set it back to the 32 bit portion of the registry
2021-06-25 16:08:16 -06:00
2025-02-28 09:56:35 -07:00
${Else}
2021-06-25 16:08:16 -06:00
2025-02-28 09:56:35 -07:00
${LogMsg} "Reading uninstall string"
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
2025-02-28 09:56:35 -07:00
${EndIf}
# If it's empty it's not installed
StrCmp $R0 "" skipUninstall
2021-06-25 16:08:16 -06:00
# Set InstDir to the parent directory so that we can uninstall it
${GetParent} $R0 $INSTDIR
2025-02-28 09:56:35 -07:00
${LogMsg} "Found existing installation at $R0"
2017-09-12 12:49:20 -06:00
# Found existing installation, prompt to uninstall
2025-02-28 09:56:35 -07:00
StrCpy $msg "${PRODUCT_NAME} is already installed.$\n\
Click `OK` to remove the existing installation."
${LogMsg} $msg
MessageBox MB_OKCANCEL|MB_USERICON $msg /SD IDOK IDOK uninst
${LogMsg} "Aborting"
2016-08-23 22:37:17 +00:00
Abort
2016-08-08 23:23:04 +00:00
uninst:
2017-03-10 21:52:38 +00:00
2017-09-12 12:49:20 -06:00
# Get current Silent status
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting current silent setting"
2017-03-10 21:52:38 +00:00
StrCpy $R0 0
${If} ${Silent}
StrCpy $R0 1
2016-08-08 23:23:04 +00:00
${EndIf}
2017-09-12 12:49:20 -06:00
# Turn on Silent mode
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting to silent mode"
2017-03-10 21:52:38 +00:00
SetSilent silent
2021-06-08 10:32:12 -06:00
# Don't remove all directories when upgrading (old method)
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting uninstaller to not delete the install dir"
2017-03-10 21:52:38 +00:00
StrCpy $DeleteInstallDir 0
2021-06-08 10:32:12 -06:00
# Don't remove RootDir when upgrading (new method)
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting uninstaller to not delete the root dir"
2021-06-08 10:32:12 -06:00
StrCpy $DeleteRootDir 0
2017-09-12 12:49:20 -06:00
# Uninstall silently
2017-03-10 21:52:38 +00:00
Call uninstallSalt
2025-02-28 09:56:35 -07:00
${LogMsg} "Resetting silent setting to original"
2017-09-12 12:49:20 -06:00
# Set it back to Normal mode, if that's what it was before
2017-03-10 21:52:38 +00:00
${If} $R0 == 0
SetSilent normal
${EndIf}
2016-08-09 18:58:58 +00:00
2016-08-08 23:23:04 +00:00
skipUninstall:
2021-06-08 10:32:12 -06:00
Call getExistingInstallation
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Call getExistingMinionConfig
${If} $ExistingConfigFound == 0
2021-06-25 16:08:16 -06:00
${AndIf} $ConfigType == "Existing Config"
2025-02-28 09:56:35 -07:00
${LogMsg} "Existing config not found, using Default config"
2021-06-25 16:08:16 -06:00
StrCpy $ConfigType "Default Config"
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${EndIf}
FunctionEnd
2021-06-08 10:32:12 -06:00
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Function BackupExistingConfig
2025-02-28 09:56:35 -07:00
${If} $ExistingConfigFound == 1 # If existing config found
2021-06-25 16:08:16 -06:00
${AndIfNot} $ConfigType == "Existing Config" # If not using Existing Config
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Backup the minion config
2025-02-28 09:56:35 -07:00
${If} ${FileExists} "$RootDir\conf\minion"
${LogMsg} "Renaming existing config file"
Rename "$RootDir\conf\minion" "$RootDir\conf\minion-$TimeStamp.bak"
${EndIf}
${If} ${FileExists} "$RootDir\conf\minion.d\*.*"
${LogMsg} "Renaming existing config directory"
Rename "$RootDir\conf\minion.d" "$RootDir\conf\minion.d-$TimeStamp.bak"
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${EndIf}
# By this point there should be no existing config. It was either backed up
# or wasn't there to begin with
2021-06-25 16:08:16 -06:00
${If} $ConfigType == "Custom Config" # If we're using Custom Config
${AndIfNot} $CustomConfig == "" # If a custom config is passed
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Check for a file name
# Named file should be in the same directory as the installer
2025-02-28 09:56:35 -07:00
${LogMsg} "Make sure config directory is exists"
${LogMsg} "Path: $RootDir\conf"
2021-06-08 10:32:12 -06:00
CreateDirectory "$RootDir\conf"
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
2025-02-28 09:56:35 -07:00
${If} ${FileExists} "$EXEDIR\$CustomConfig"
${LogMsg} "Copying custom config from path relative to installer"
${LogMsg} "Path: $EXEDIR\$CustomConfig"
CopyFiles /SILENT /FILESONLY "$EXEDIR\$CustomConfig" "$RootDir\conf\minion"
${ElseIf} ${FileExists} "$CustomConfig"
${LogMsg} "Copying custom config from full path"
${LogMsg} "Path: $CustomConfig"
2021-06-25 16:08:16 -06:00
CopyFiles /SILENT /FILESONLY "$CustomConfig" "$RootDir\conf\minion"
2025-02-28 09:56:35 -07:00
${Else}
${LogMsg} "Custom config not found, default values will be used"
${EndIf}
${EndIf}
2016-08-08 23:23:04 +00:00
FunctionEnd
2016-08-08 23:23:04 +00:00
Section -Post
2025-02-28 09:56:35 -07:00
${LogMsg} "Writing uninstaller"
2016-08-08 23:23:04 +00:00
WriteUninstaller "$INSTDIR\uninst.exe"
# The NSIS installer is a 32bit application and will use the WOW6432Node in
# the registry by default. We need to look in the 64 bit location on 64 bit
# systems
${If} ${RunningX64}
# https://nsis.sourceforge.io/Docs/Chapter4.html#setregview
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting registry context to 64-bit registry"
SetRegView 64 # View 64 bit portion of the registry
${EndIf}
2025-02-28 09:56:35 -07:00
${LogMsg} "Updating installation information in the registry"
2021-06-08 10:32:12 -06:00
# Write Uninstall Registry Entries
2016-08-23 22:37:17 +00:00
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayIcon" "$INSTDIR\salt.ico"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\services\salt-minion" \
"DependOnService" "nsi"
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting estimated size"
2023-01-31 18:43:41 -07:00
# If ESTIMATED_SIZE is not set, calculated it
${If} ${ESTIMATED_SIZE} == 0
2025-02-28 09:56:35 -07:00
${GetSize} "$INSTDIR" "/S=OK" $R0 $R1 $R2
2023-01-31 18:43:41 -07:00
${Else}
2025-02-28 09:56:35 -07:00
StrCpy $R0 ${ESTIMATED_SIZE}
2023-01-31 18:43:41 -07:00
${Endif}
2025-02-28 09:56:35 -07:00
IntFmt $R0 "0x%08X" $R0
${LogMsg} "Setting estimated size: $R0"
WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
2025-02-28 09:56:35 -07:00
"EstimatedSize" "$R0"
2016-08-23 22:37:17 +00:00
2021-06-08 10:32:12 -06:00
# Write Commandline Registry Entries
2025-02-28 09:56:35 -07:00
${LogMsg} "Registering salt commands for the cli"
WriteRegStr HKLM "${PRODUCT_CALL_REGKEY}" "" "$INSTDIR\salt-call.exe"
WriteRegStr HKLM "${PRODUCT_CALL_REGKEY}" "Path" "$INSTDIR\"
WriteRegStr HKLM "${PRODUCT_MINION_REGKEY}" "" "$INSTDIR\salt-minion.exe"
WriteRegStr HKLM "${PRODUCT_MINION_REGKEY}" "Path" "$INSTDIR\"
2016-08-23 22:37:17 +00:00
2021-06-08 10:32:12 -06:00
# Write Salt Configuration Registry Entries
2021-09-24 11:19:06 -06:00
# We want to write EXPAND_SZ string types to allow us to use environment
# variables. It's OK to use EXPAND_SZ even if you don't use an environment
# variable so we'll just do that whether it's new location or old.
2021-09-24 15:55:24 -06:00
# Check for Program Files
# We want to use the environment variables instead of the hardcoded path
2025-02-28 09:56:35 -07:00
# when setting values in the registry
${LogMsg} "Getting registry values for install_dir and root_dir"
${If} ${RunningX64}
${StrRep} "$RegInstDir" "$INSTDIR" "$ProgramFiles64" "%PROGRAMFILES%"
${Else}
${StrRep} "$RegInstDir" "$INSTDIR" "$ProgramFiles" "%PROGRAMFILES%"
${EndIf}
${LogMsg} "install_dir: $RegInstDir"
SetShellVarContext all
${StrRep} "$RegRootDir" "$RootDir" "$APPDATA" "%PROGRAMDATA%"
${LogMsg} "root_dir: $RegRootDir"
2021-09-24 11:19:06 -06:00
2025-02-28 09:56:35 -07:00
${LogMsg} "Writing install_dir and root_dir to the registry"
2021-09-24 15:55:24 -06:00
WriteRegExpandStr HKLM "SOFTWARE\Salt Project\Salt" "install_dir" "$RegInstDir"
WriteRegExpandStr HKLM "SOFTWARE\Salt Project\Salt" "root_dir" "$RegRootDir"
2021-09-24 11:19:06 -06:00
# Puts the nullsoft installer back to its default
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting registry context back to 32-bit"
2021-06-25 16:08:16 -06:00
SetRegView 32 # Set it back to the 32 bit portion of the registry
2021-06-08 10:32:12 -06:00
2017-09-12 12:49:20 -06:00
# Register the Salt-Minion Service
2025-02-28 09:56:35 -07:00
${LogMsg} "Registering the salt-minion service"
nsExec::ExecToStack `"$INSTDIR\ssm.exe" install salt-minion "$INSTDIR\salt-minion.exe" -c """$RootDir\conf""" -l quiet`
pop $0 # ExitCode
pop $1 # StdOut
${IfNot} $0 == 0
StrCpy $msg "Failed to register the salt minion service.$\n\
ExitCode: $0$\n\
StdOut: $1"
${LogMsg} $msg
MessageBox MB_OK|MB_ICONEXCLAMATION $msg /SD IDOK IDOK
${LogMsg} "Aborting"
Abort
${Else}
${LogMsg} "Setting service description"
nsExec::ExecToStack "$INSTDIR\ssm.exe set salt-minion Description Salt Minion from saltstack.com"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
${LogMsg} "Setting service autostart"
nsExec::ExecToStack "$INSTDIR\ssm.exe set salt-minion Start SERVICE_AUTO_START"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
${LogMsg} "Setting service console stop method"
nsExec::ExecToStack "$INSTDIR\ssm.exe set salt-minion AppStopMethodConsole 24000"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
${LogMsg} "Setting service windows stop method"
nsExec::ExecToStack "$INSTDIR\ssm.exe set salt-minion AppStopMethodWindow 2000"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
${LogMsg} "Setting service app restart delay"
nsExec::ExecToStack "$INSTDIR\ssm.exe set salt-minion AppRestartDelay 60000"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
${EndIf}
2021-07-01 17:35:59 -06:00
# There is a default minion config laid down in the $INSTDIR directory
${Switch} $ConfigType
${Case} "Existing Config"
2025-02-28 09:56:35 -07:00
${LogMsg} "Using existing config"
# If this is an Existing Config, we don't do anything
2021-07-01 17:35:59 -06:00
${Break}
${Case} "Custom Config"
2025-02-28 09:56:35 -07:00
${LogMsg} "Using custom config"
# If this is a Custom Config, update the custom config
2021-07-01 17:35:59 -06:00
Call updateMinionConfig
${Break}
${Case} "Default Config"
2025-02-28 09:56:35 -07:00
${LogMsg} "Using default config"
# If this is the Default Config, we move it and update it
2021-07-01 17:35:59 -06:00
StrCpy $switch_overwrite 1
!insertmacro MoveFolder "$INSTDIR\configs" "$RootDir\conf" "*.*"
2021-07-01 17:35:59 -06:00
Call updateMinionConfig
${Break}
${EndSwitch}
# Delete the configs directory that came with the installer
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing configs directory"
RMDir /r "$INSTDIR\configs"
# Add $INSTDIR in the Path
2025-02-28 09:56:35 -07:00
${LogMsg} "Adding salt to the path"
EnVar::SetHKLM
EnVar::AddValue Path "$INSTDIR"
2025-02-28 09:56:35 -07:00
Pop $0
${If} $0 == 0
${LogMsg} "Success"
${Else}
# See this table for Error Codes:
# https://github.com/GsNSIS/EnVar#error-codes
${LogMsg} "Failed. Error Code: $0"
${EndIf}
2016-08-09 18:58:58 +00:00
2016-08-08 23:23:04 +00:00
SectionEnd
2016-08-08 23:23:04 +00:00
Function .onInstSuccess
2017-09-12 12:49:20 -06:00
# If StartMinionDelayed is 1, then set the service to start delayed
${If} $StartMinionDelayed == 1
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting the salt-minion service to start delayed"
nsExec::ExecToStack "$INSTDIR\ssm.exe set salt-minion Start SERVICE_DELAYED_AUTO_START"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
${EndIf}
2017-09-12 12:49:20 -06:00
# If start-minion is 1, then start the service
2016-08-08 23:23:04 +00:00
${If} $StartMinion == 1
2025-02-28 09:56:35 -07:00
${LogMsg} "Starting the salt-minion service"
nsExec::ExecToStack "$INSTDIR\ssm.exe start salt-minion"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
2016-08-08 23:23:04 +00:00
${EndIf}
2025-02-28 09:56:35 -07:00
${LogMsg} "Salt installation complete"
# I don't know of another way to fix this. The installer hangs intermittently
# This will force kill the installer process. This must be the last thing that
# is run.
StrCpy $1 "wmic Path win32_process where $\"name like '$EXEFILE'$\" Call Terminate"
nsExec::Exec $1
2016-08-08 23:23:04 +00:00
FunctionEnd
2016-08-08 23:23:04 +00:00
Function un.onInit
2017-03-10 21:52:38 +00:00
2021-06-08 10:32:12 -06:00
Call un.parseUninstallerCommandLineSwitches
2017-03-10 21:52:38 +00:00
2025-02-28 09:56:35 -07:00
StrCpy $msg "Are you sure you want to completely remove $(^Name) and all \
of its components?"
${LogMsg} $msg
MessageBox MB_USERICON|MB_YESNO|MB_DEFBUTTON1 $msg /SD IDYES IDYES continue_remove
${LogMsg} "Aborting"
2016-08-08 23:23:04 +00:00
Abort
2017-03-10 21:52:38 +00:00
2025-02-28 09:56:35 -07:00
continue_remove:
2016-08-08 23:23:04 +00:00
FunctionEnd
2015-03-31 17:26:46 -06:00
2016-08-08 23:23:04 +00:00
Section Uninstall
2016-08-09 18:58:58 +00:00
2017-03-10 21:52:38 +00:00
Call un.uninstallSalt
# Remove $INSTDIR from the Path
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing salt from the path"
EnVar::SetHKLM
EnVar::DeleteValue Path "$INSTDIR"
2025-02-28 09:56:35 -07:00
Pop $0
${If} $0 == 0
${LogMsg} "Success"
${Else}
# See this table for Error Codes:
# https://github.com/GsNSIS/EnVar#error-codes
${LogMsg} "Failed. Error Code: $0"
${EndIf}
2017-03-10 21:52:38 +00:00
SectionEnd
!macro uninstallSalt un
Function ${un}uninstallSalt
2021-07-21 17:14:44 -06:00
# WARNING: Any changes made here need to be reflected in the MSI uninstaller
2017-09-12 12:49:20 -06:00
# Make sure we're in the right directory
2025-02-28 09:56:35 -07:00
${LogMsg} "Detecting INSTDIR"
${If} $INSTDIR == "c:\salt\Scripts"
2025-02-28 09:56:35 -07:00
StrCpy $INSTDIR "C:\salt"
2017-03-10 21:52:38 +00:00
${EndIf}
2021-06-08 10:32:12 -06:00
# $ProgramFiles is different depending on the CPU Architecture
# https://nsis.sourceforge.io/Reference/$PROGRAMFILES
2021-06-08 10:32:12 -06:00
# x86 : C:\Program Files
# x64 : C:\Program Files (x86)
${If} $INSTDIR == "$ProgramFiles\Salt Project\Salt\Scripts"
2025-02-28 09:56:35 -07:00
StrCpy $INSTDIR "$ProgramFiles\Salt Project\Salt"
2021-06-08 10:32:12 -06:00
${EndIf}
# $ProgramFiles64 is the C:\Program Files directory
${If} $INSTDIR == "$ProgramFiles64\Salt Project\Salt\Scripts"
2025-02-28 09:56:35 -07:00
StrCpy $INSTDIR "$ProgramFiles64\Salt Project\Salt"
2021-06-08 10:32:12 -06:00
${EndIf}
2025-02-28 09:56:35 -07:00
${LogMsg} "INSTDIR: $INSTDIR"
# Only attempt to remove the services if ssm.exe is present"
${If} ${FileExists} "$INSTDIR\ssm.exe"
${LogMsg} "ssm.exe found"
# Stop and Remove salt-minion service
${LogMsg} "Stopping salt-minion service"
nsExec::ExecToStack "$INSTDIR\ssm.exe stop salt-minion"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
${EndIf}
2021-06-08 10:32:12 -06:00
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing salt-minion service"
nsExec::ExecToStack "$INSTDIR\ssm.exe remove salt-minion confirm"
pop $0 # ExitCode
pop $1 # StdOut
${If} $0 == 0
${LogMsg} "Success"
${Else}
${LogMsg} "Failed$\r$\nExitCode: $0$\r$\nStdOut: $1"
Abort
${EndIf}
2025-02-28 09:56:35 -07:00
${Else}
2025-02-28 09:56:35 -07:00
${LogMsg} "ssm.exe not found"
${EndIf}
2017-03-10 21:52:38 +00:00
2017-09-12 12:49:20 -06:00
# Remove files
2025-02-28 09:56:35 -07:00
${LogMsg} "Deleting individual files"
2023-08-23 14:14:57 -06:00
Delete "$INSTDIR\multi-minion*"
Delete "$INSTDIR\salt*"
2023-08-23 14:14:57 -06:00
Delete "$INSTDIR\ssm.exe"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\vcredist.exe"
2025-02-28 09:56:35 -07:00
${LogMsg} "Deleting directories"
RMDir /r "$INSTDIR\DLLs"
RMDir /r "$INSTDIR\Include"
RMDir /r "$INSTDIR\Lib"
RMDir /r "$INSTDIR\libs"
RMDir /r "$INSTDIR\Scripts"
# Remove everything in the 64 bit registry
# The NSIS installer is a 32bit application and will use the WOW6432Node in
# the registry by default. We need to look in the 64 bit location on 64 bit
# systems
${If} ${RunningX64}
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing 64-bit registry items"
# https://nsis.sourceforge.io/Docs/Chapter4.html#setregview
SetRegView 64 # View the 64 bit portion of the registry
${EndIf}
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting RootDir from 64-bit registry"
# Get Root Directory from the Registry (64 bit)
ReadRegStr $RootDir HKLM "SOFTWARE\Salt Project\Salt" "root_dir"
${LogMsg} "RootDir: $RootDir"
2017-09-12 12:49:20 -06:00
# Remove Registry entries
2025-02-28 09:56:35 -07:00
${LogMsg} "Deleting Add/Remove programs entries"
2017-03-10 21:52:38 +00:00
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
2021-06-08 10:32:12 -06:00
# Remove Command Line Registry entries
2025-02-28 09:56:35 -07:00
${LogMsg} "Deleting Command Line Registry Entries"
2017-03-10 21:52:38 +00:00
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_CALL_REGKEY}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_CP_REGKEY}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_KEY_REGKEY}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_MASTER_REGKEY}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_MINION_REGKEY}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_RUN_REGKEY}"
2021-06-08 10:32:12 -06:00
DeleteRegKey HKLM "SOFTWARE\Salt Project"
2021-07-01 16:37:12 -06:00
# SystemDrive is not a built in NSIS constant, so we need to get it from
# the environment variables
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting System Drive"
2021-07-01 16:37:12 -06:00
ReadEnvStr $0 "SystemDrive" # Get the SystemDrive env var
StrCpy $SysDrive "$0\"
2025-02-28 09:56:35 -07:00
${LogMsg} "SystemDrive: $SysDrive"
2021-07-01 16:37:12 -06:00
2017-09-12 12:49:20 -06:00
# Automatically close when finished
2017-03-10 21:52:38 +00:00
SetAutoClose true
2021-06-08 10:32:12 -06:00
# Old Method Installation
${If} $INSTDIR == "C:\salt"
# Prompt to remove the Installation Directory. This is because that
# directory is also the root_dir which includes the config and pki
# directories
${IfNot} $DeleteInstallDir == 1
2025-02-28 09:56:35 -07:00
StrCpy $msg "Would you like to completely remove $INSTDIR and all \
of its contents?"
${LogMsg} $msg
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_USERICON $msg /SD IDNO IDNO finished
2021-06-08 10:32:12 -06:00
${EndIf}
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing INSTDIR"
2021-07-01 16:37:12 -06:00
SetOutPath "$SysDrive" # Can't remove CWD
RMDir /r "$INSTDIR"
2021-06-08 10:32:12 -06:00
${Else}
2023-08-23 14:14:57 -06:00
# Prompt for the removal of the Installation Directory which contains
# the extras directory and the Root Directory which contains the config
# and pki directories. These directories will not be removed during
# an upgrade.
${IfNot} $DeleteRootDir == 1
2025-02-28 09:56:35 -07:00
StrCpy $msg "Would you like to completely remove the entire Salt \
2023-08-23 14:14:57 -06:00
Installation? This includes the following:$\n\
- Extra Pip Packages ($INSTDIR\extras-3.##)$\n\
- Minion Config ($RootDir\conf)$\n\
2025-02-28 09:56:35 -07:00
- Minion PKIs ($RootDir\conf\pki)"
${LogMsg} $msg
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_USERICON $msg /SD IDNO IDNO finished
2023-08-23 14:14:57 -06:00
${EndIf}
2021-06-08 10:32:12 -06:00
# New Method Installation
# This makes the $APPDATA variable point to the ProgramData folder instead
# of the current user's roaming AppData folder
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting Shell Context to All Users"
2021-06-08 10:32:12 -06:00
SetShellVarContext all
# We can always remove the Installation Directory on New Method Installs
# because it only contains binary data
# Remove INSTDIR
# Make sure you're not removing important system directory such as
# Program Files, C:\Windows, or C:
${If} $INSTDIR != $ProgramFiles
${AndIf} $INSTDIR != $ProgramFiles64
${AndIf} $INSTDIR != $SysDrive
${AndIf} $INSTDIR != $WinDir
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing INSTDIR"
2021-07-01 16:37:12 -06:00
SetOutPath "$SysDrive" # Can't remove CWD
2021-06-08 10:32:12 -06:00
RMDir /r $INSTDIR
${EndIf}
# Remove INSTDIR (The parent)
# For example, though salt is installed in ProgramFiles\Salt Project\Salt
# We want to remove ProgramFiles\Salt Project
# Only delete Salt Project directory if it's in Program Files
# Otherwise, we can't guess where the user may have installed salt
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting InstDir Parent Directory"
${GetParent} $INSTDIR $R0 # Get parent directory (Salt Project)
${LogMsg} "Parent: $R0"
${If} $R0 == "$ProgramFiles\Salt Project" # Make sure it's ProgramFiles
${OrIf} $R0 == "$ProgramFiles64\Salt Project" # Make sure it's Program Files (x86)
${LogMsg} "Removing Salt Project directory from Program Files"
2021-07-01 16:37:12 -06:00
SetOutPath "$SysDrive" # Can't remove CWD
2025-02-28 09:56:35 -07:00
RMDir /r $R0
2021-06-08 10:32:12 -06:00
${EndIf}
# If RootDir is still empty, use C:\salt
${If} $RootDir == ""
StrCpy $RootDir "C:\salt"
${EndIf}
# Expand any environment variables
ExpandEnvStrings $RootDir $RootDir
2025-02-28 09:56:35 -07:00
${LogMsg} "Removing RootDir: $RootDir"
2021-06-08 10:32:12 -06:00
# Remove the Salt Project directory in ProgramData
# The Salt Project directory will only ever be in ProgramData
# It is not user selectable
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting RootDir Parent Directory"
${GetParent} $RootDir $R0 # Get parent directory
${LogMsg} "Parent: $R0"
${If} $R0 == "$APPDATA\Salt Project" # Make sure it's not ProgramData
${LogMsg} "Removing Parent Directory from APPDATA"
2021-07-01 16:37:12 -06:00
SetOutPath "$SysDrive" # Can't remove CWD
2025-02-28 09:56:35 -07:00
RMDir /r $R0
2021-06-08 10:32:12 -06:00
${EndIf}
2017-03-10 21:52:38 +00:00
2016-08-08 23:23:04 +00:00
${EndIf}
2017-03-10 21:52:38 +00:00
finished:
2025-02-28 09:56:35 -07:00
${LogMsg} "Uninstall Complete"
2016-08-08 23:23:04 +00:00
2017-03-10 21:52:38 +00:00
FunctionEnd
!macroend
!insertmacro uninstallSalt ""
!insertmacro uninstallSalt "un."
2016-08-08 23:23:04 +00:00
2016-08-08 23:23:04 +00:00
Function un.onUninstSuccess
2025-02-28 09:56:35 -07:00
2016-08-08 23:23:04 +00:00
HideWindow
2025-02-28 09:56:35 -07:00
StrCpy $msg "$(^Name) was successfully removed from your computer."
${LogMsg} $msg
MessageBox MB_OK|MB_USERICON $msg /SD IDOK
# I don't know of another way to fix this. The installer hangs intermittently
# This will force kill the installer process. This must be the last thing that
# is run.
StrCpy $1 "wmic Path win32_process where $\"name like '$EXEFILE'$\" Call Terminate"
nsExec::Exec $1
FunctionEnd
2016-08-08 23:23:04 +00:00
###############################################################################
# Helper Functions
###############################################################################
#------------------------------------------------------------------------------
# Trim Function
# - Trim whitespace from the beginning and end of a string
# - Trims spaces, \r, \n, \t
#
# Usage:
2017-09-21 14:11:21 -06:00
# Push " some string " ; String to Trim
# Call Trim
2017-09-21 14:11:21 -06:00
# Pop $0 ; Trimmed String: "some string"
#
# or
#
# ${Trim} $0 $1 ; Trimmed String, String to Trim
#------------------------------------------------------------------------------
2025-02-28 09:56:35 -07:00
!macro Func_Trim un
Function ${un}Trim
Exch $R1 # Original string
Push $R2
Loop:
StrCpy $R2 "$R1" 1
StrCmp "$R2" " " TrimLeft
StrCmp "$R2" "$\r" TrimLeft
StrCmp "$R2" "$\n" TrimLeft
StrCmp "$R2" "$\t" TrimLeft
GoTo Loop2
TrimLeft:
StrCpy $R1 "$R1" "" 1
Goto Loop
Loop2:
StrCpy $R2 "$R1" 1 -1
StrCmp "$R2" " " TrimRight
StrCmp "$R2" "$\r" TrimRight
StrCmp "$R2" "$\n" TrimRight
StrCmp "$R2" "$\t" TrimRight
GoTo Done
TrimRight:
StrCpy $R1 "$R1" -1
Goto Loop2
Done:
Pop $R2
Exch $R1
FunctionEnd
!macroend
!insertmacro Func_Trim ""
!insertmacro Func_Trim "un."
2017-09-21 14:11:21 -06:00
#------------------------------------------------------------------------------
# Explode Function
# - Splits a string based off the passed separator
# - Each item in the string is pushed to the stack
# - The last item pushed to the stack is the length of the array
#
# Usage:
# Push "," ; Separator
# Push "string,to,separate" ; String to explode
# Call Explode
# Pop $0 ; Number of items in the array
#
# or
#
# ${Explode} $0 $1 $2 ; Length, Separator, String
#------------------------------------------------------------------------------
Function Explode
# Initialize variables
Var /GLOBAL explString
Var /GLOBAL explSeparator
Var /GLOBAL explStrLen
Var /GLOBAL explSepLen
Var /GLOBAL explOffset
Var /GLOBAL explTmp
Var /GLOBAL explTmp2
Var /GLOBAL explTmp3
Var /GLOBAL explArrCount
# Get input from user
Pop $explString
Pop $explSeparator
# Calculates initial values
StrLen $explStrLen $explString
StrLen $explSepLen $explSeparator
StrCpy $explArrCount 1
${If} $explStrLen <= 1 # If we got a single character
${OrIf} $explSepLen > $explStrLen # or separator is larger than the string,
Push $explString # then we return initial string with no change
Push 1 # and set array's length to 1
Return
${EndIf}
# Set offset to the last symbol of the string
StrCpy $explOffset $explStrLen
IntOp $explOffset $explOffset - 1
# Clear temp string to exclude the possibility of appearance of occasional data
StrCpy $explTmp ""
StrCpy $explTmp2 ""
StrCpy $explTmp3 ""
# Loop until the offset becomes negative
${Do}
# If offset becomes negative, it is time to leave the function
${IfThen} $explOffset == -1 ${|} ${ExitDo} ${|}
# Remove everything before and after the searched part ("TempStr")
StrCpy $explTmp $explString $explSepLen $explOffset
${If} $explTmp == $explSeparator
# Calculating offset to start copy from
IntOp $explTmp2 $explOffset + $explSepLen # Offset equals to the current offset plus length of separator
StrCpy $explTmp3 $explString "" $explTmp2
Push $explTmp3 # Throwing array item to the stack
IntOp $explArrCount $explArrCount + 1 # Increasing array's counter
StrCpy $explString $explString $explOffset 0 # Cutting all characters beginning with the separator entry
StrLen $explStrLen $explString
${EndIf}
${If} $explOffset = 0 # If the beginning of the line met and there is no separator,
# copying the rest of the string
${If} $explSeparator == "" # Fix for the empty separator
IntOp $explArrCount $explArrCount - 1
${Else}
Push $explString
${EndIf}
${EndIf}
IntOp $explOffset $explOffset - 1
${Loop}
Push $explArrCount
FunctionEnd
2020-05-04 14:24:45 +02:00
#------------------------------------------------------------------------------
# UninstallMSI Function
# - Uninstalls MSI by product code
#
# Usage:
# Push product code
# Call UninstallMSI
#
# Source:
# https://nsis.sourceforge.io/Uninstalling_a_previous_MSI_(Windows_installer_package)
#------------------------------------------------------------------------------
Function UninstallMSI
; $R0 === product code
2021-06-08 10:32:12 -06:00
MessageBox MB_OKCANCEL|MB_ICONINFORMATION \
2020-05-04 14:24:45 +02:00
"${PRODUCT_NAME} is already installed via MSI.$\n$\n\
Click `OK` to remove the existing installation." \
/SD IDOK IDOK UninstallMSI
Abort
UninstallMSI:
2020-05-05 22:13:40 +02:00
ExecWait '"msiexec.exe" /x $R0 /qb /quiet /norestart'
2020-05-04 14:24:45 +02:00
FunctionEnd
2016-08-09 16:49:28 +00:00
###############################################################################
# Specialty Functions
###############################################################################
Function getExistingInstallation
# Try to detect an existing installation. There are three possible scenarios
# 1. Existing New Method Installation
# 2. Existing Old Method Installation
# 3. New Installation
# The results of this function will determine if the user is allowed to set
# the install location in the GUI. If there is an existing installation
# present, the location picker will be grayed out
# This function also sets the RootDir and INSTDIR variables used by the
# installer.
2025-02-28 09:56:35 -07:00
${LogMsg} "Detecting existing installation"
# Reset ExistingInstallation
StrCpy $ExistingInstallation 0
# Get ProgramFiles
# Use RunningX64 here to get the Architecture for the system running the
# installer.
# There are 3 scenarios here:
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting Default InstDir"
${If} ${RunningX64}
StrCpy $INSTDIR "$ProgramFiles64\Salt Project\Salt"
${Else}
# 32 bit Salt on 32 bit system (C:\Program Files)
StrCpy $INSTDIR "$ProgramFiles\Salt Project\Salt"
${EndIf}
# This makes the $APPDATA variable point to the ProgramData folder instead
# of the current user's roaming AppData folder
SetShellVarContext all
# Set default location of for salt config
2025-02-28 09:56:35 -07:00
${LogMsg} "Setting Default RootDir"
StrCpy $RootDir "$APPDATA\Salt Project\Salt"
# The NSIS installer is a 32bit application and will use the WOW6432Node in
# the registry by default. We need to look in the 64 bit location on 64 bit
# systems
${If} ${RunningX64}
# https://nsis.sourceforge.io/Docs/Chapter4.html#setregview
SetRegView 64 # View the 64 bit portion of the registry
${EndIf}
# Check for existing new method installation from registry
2025-02-28 09:56:35 -07:00
${LogMsg} "Looking for New Method installation"
# Look for `install_dir` in HKLM\SOFTWARE\Salt Project\Salt
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting INSTDIR from Registry"
ReadRegStr $R0 HKLM "SOFTWARE\Salt Project\Salt" "install_dir"
StrCmp $R0 "" checkOldInstallation
2025-02-28 09:56:35 -07:00
${LogMsg} "Detected existing installation"
StrCpy $ExistingInstallation 1
# Set INSTDIR to the location in the registry
StrCpy $INSTDIR $R0
# Expand any environment variables it contains
ExpandEnvStrings $INSTDIR $INSTDIR
2025-02-28 09:56:35 -07:00
${LogMsg} "INSTDIR: $INSTDIR"
# Set RootDir, if defined
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting RootDir"
ReadRegStr $R0 HKLM "SOFTWARE\Salt Project\Salt" "root_dir"
StrCmp $R0 "" finished
StrCpy $RootDir $R0
# Expand any environment variables it contains
ExpandEnvStrings $RootDir $RootDir
2025-02-28 09:56:35 -07:00
${LogMsg} "RootDir: $RootDir"
Goto finished
# Check for existing old method installation
# Look for `python.exe` in C:\salt\bin
checkOldInstallation:
2025-02-28 09:56:35 -07:00
${LogMsg} "Looking for Old Method installation"
IfFileExists "C:\salt\bin\python.exe" 0 newInstallation
StrCpy $ExistingInstallation 1
StrCpy $INSTDIR "C:\salt"
StrCpy $RootDir "C:\salt"
2025-02-28 09:56:35 -07:00
${LogMsg} "Found Old Method installation"
Goto finished
# This is a new installation
# Check if custom location was passed via command line
newInstallation:
2025-02-28 09:56:35 -07:00
${LogMsg} "This is a New Installation"
${IfNot} $CustomLocation == ""
StrCpy $INSTDIR $CustomLocation
${EndIf}
finished:
2025-02-28 09:56:35 -07:00
${LogMsg} "Finished detecting installation type"
SetRegView 32 # View the 32 bit portion of the registry
FunctionEnd
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Function getExistingMinionConfig
2016-08-08 23:23:04 +00:00
2025-02-28 09:56:35 -07:00
${LogMsg} "Getting existing Minion Config"
# Set Config Found Default Value
StrCpy $ExistingConfigFound 0
2021-06-08 10:32:12 -06:00
# Find config, should be in $RootDir\conf\minion
# Root dir is usually ProgramData\Salt Project\Salt\conf though it may be
# C:\salt\conf if Salt was installed the old way
2025-02-28 09:56:35 -07:00
${LogMsg} "Looking for minion config in $RootDir"
2021-09-24 15:55:24 -06:00
IfFileExists "$RootDir\conf\minion" check_owner
2025-02-28 09:56:35 -07:00
${LogMsg} "Looking for minion config in C:\salt"
2021-06-25 16:08:16 -06:00
IfFileExists "C:\salt\conf\minion" old_location confNotFound
old_location:
2025-02-28 09:56:35 -07:00
${LogMsg} "Found config in old location. Updating RootDir"
2021-06-25 16:08:16 -06:00
StrCpy $RootDir "C:\salt"
2025-02-28 09:56:35 -07:00
${LogMsg} "RootDir: $RootDir"
2016-08-08 23:23:04 +00:00
Merge 3003.3 into master (#60924) * Merge 3002.6 bugfix changes (#59822) * Pass `CI_RUN` as an environment variable to the test run. This allows us to know if we're running the test suite under a CI environment or not and adapt/adjust if needed * Migrate `unit.setup` to PyTest * Backport ae36b15 just for test_install.py * Only skip tests on CI runs * Always store git sha in _version.py during installation * Fix PEP440 compliance. The wheel metadata version 1.2 states that the package version MUST be PEP440 compliant. This means that instead of `3002.2-511-g033c53eccb`, the salt version string should look like `3002.2+511.g033c53eccb`, a post release of `3002.2` ahead by 511 commits with the git sha `033c53eccb` * Fix and migrate `tests/unit/test_version.py` to PyTest * Skip test if `easy_install` is not available * We also need to be PEP440 compliant when there's no git history * Allow extra_filerefs as sanitized kwargs for SSH client * Fix regression on cmd.run when passing tuples as cmd Co-authored-by: Alexander Graul <agraul@suse.com> * Add unit tests to ensure cmd.run accepts tuples * Add unit test to check for extra_filerefs on SSH opts * Add changelog file * Fix comment for test case * Fix unit test to avoid failing on Windows * Skip failing test on windows * Fix test to work on Windows * Add all ssh kwargs to sanitize_kwargs method * Run pre-commit * Fix pylint * Fix cmdmod loglevel and module_names tests * Fix pre-commit * Skip ssh tests if binary does not exist * Use setup_loader for cmdmod test * Prevent argument injection in restartcheck * Add changelog for restartcheck fix * docs_3002.6 * Add back tests removed in merge Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> * Remove glance state module in favor of glance_image * update wording in changelog * bump deprecation warning to Silicon. * Updating warnutil version to Phosphorous. * Update salt/modules/keystone.py Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Check $HOMEBREW_PREFIX when linking against libcrypto When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl` at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs, Homebrew's default installation prefix is `/opt/homebrew`. On all platforms, the prefix is configurable. If Salt doesn't find one of those `libcrypto`s, it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will cause the following crash: Application Specific Information: /usr/lib/libcrypto.dylib abort() called Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`. * Add test case * Add changelog for 59808 * Add changelog entry * Make _find_libcrypto fail on Big Sur if it can't find a library Right now, if `_find_libcrypto` can't find any externally-managed versions of libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto. This does not exist on Big Sur and it would be better to raise an exception here rather than crashing later when trying to open it. * Update _find_libcrypto tests This commit simplifies the unit tests for _find_libcrypto by mocking out the host's filesystem and testing the common libcrypto installations (brew, ports, etc.) on Big Sur. It simplifies the tests for falling back on system versions of libcrypto on previous versions of macOS. * Fix description of test_find_libcrypto_with_system_before_catalina * Patch sys.platform for test_rsax931 tests * modules/match: add missing "minion_id" in Pillar example The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected. - fix documentation - add tests: - to prove the misbehavior of the documented example - to prove the proper behaviour when supplying `minion_id` - to ensure some misbehaviour observed with compound matchers doesn't occur * Fix for issue #59773 - When instantiating the loader grab values of grains and pillars if they are NamedLoaderContext instances. - The loader uses a copy of opts. - Impliment deepcopy on NamedLoaderContext instances. * Add changelog for #59773 * _get_initial_pillar function returns pillar * Fix linter issues * Clean up test * Bump deprecation release for neutron * Uncomment Sulfur release name * Removing the _ext_nodes deprecation warning and alias. * Adding changelog. * Renaming changelog file. * Update 59804.removed * Initial pass at fips_mode config option * Fix pre-commit * Fix tests and add changelog * update docs 3003 * update docs 3003 - newline * Fix warts in changelog * update releasenotes 3003 * add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests * add distro_arch * changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b * Update __utils__ calls to import utils in azure * Add changelog for 59744 * Fix azure unit tests and move to pytest * Use contextvars from site-packages for thin If a contextvars package exists one of the site-packages locations use it for the generated thin tarball. This overrides python's builtin contextvars and allows salt-ssh to work with python <=3.6 even when the master's python is >3.6 (Fixes #59942) * Add regression test for #59942 * Add changelog for #59942 * Update filemap to include test_py_versions * Fix broken thin tests * Always install the `contextvars` backport, even on Py3.7+ Without this change, salt-ssh cannot target systems with Python <= 3.6 * Use salt-factories to handle the container. Don't override default roster * Fix thin tests on windows * No need to use warn log level here * Fix getsitepackages for old virtualenv versions * Add explicit pyobjc reqs * Add back the passthrough stuff * Remove a line so pre-commit will run * Bugfix release docs * Bugfix release docs * Removing pip-compile log files * Bump requirements to address a few security issues * Address traceback on macOS ``` Traceback (most recent call last): File "setup.py", line 1448, in <module> setup(distclass=SaltDistribution) File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "setup.py", line 1068, in __init__ self.update_metadata() File "setup.py", line 1074, in update_metadata attrvalue = getattr(self, attrname, None) File "setup.py", line 1182, in _property_install_requires install_requires += _parse_requirements_file(reqfile) File "setup.py", line 270, in _parse_requirements_file platform.python_version(), _parse_op(op), _parse_ver(ver) File "setup.py", line 247, in _check_ver return getattr(operator, "__{}__".format(op))(pyver, wanted) File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__ c = self._cmp(other) File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'str' and 'int' ``` * Replace `saltstack.com` with `saltproject.io` on URLs being tested * Add back support to load old entrypoints by iterating instead of type checking Fixes #59961 * Fix issue #59975 * Fix pillar serialization for jinja #60083 * Fix test * Add changelog for #60083 * Update changelog and release for 3003.1 * Remove the changelog source refs * Add connect to IPCMessageSubscriber's async_methods Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by SyncWrapper has a connect method that runs the coroutine rather than returns a fugure. * Add changelog for #60049 * Update 60049.fixed * Fix coroutine spelling error Co-authored-by: Wayne Werner <waynejwerner@gmail.com> * IPC on windows cannot use socket paths Fixes #60298 * Update Jinja2 and lxml due to security related bugfix releases Jinja2 ------ CVE-2020-28493 moderate severity Vulnerable versions: < 2.11.3 Patched version: 2.11.3 This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory. lxml ---- CVE-2021-28957 moderate severity Vulnerable versions: < 4.6.3 Patched version: 4.6.3 An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3. * fix github actions jobs on branch until bullseye comes out * Upgrade to `six==1.16.0` to avoid problems on CI runs ``` 13:59:02 nox > Session invoke-pre-commit was successful. 13:59:02 nox > Running session invoke-pre-commit 13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt 13:59:02 Collecting blessings==1.7 13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB) 13:59:02 Collecting invoke==1.4.1 13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB) 13:59:02 Collecting pyyaml==5.3.1 13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB) 13:59:02 Collecting six==1.15.0 13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) 13:59:02 Building wheels for collected packages: pyyaml 13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done 13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167 13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 13:59:02 Successfully built pyyaml 13:59:02 Installing collected packages: six, pyyaml, invoke, blessings 13:59:02 Attempting uninstall: six 13:59:02 Found existing installation: six 1.16.0 13:59:02 Uninstalling six-1.16.0: 13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc' 13:59:02 13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1 13:59:02 nox > Session invoke-pre-commit failed. ``` * add changelog for https://github.com/saltstack/salt/issues/59982 * Regression test for #56273 * Fix race condition in batch. #56273 * Add changelog for #56273 * Update salt/client/__init__.py Co-authored-by: Pedro Algarvio <pedro@algarvio.me> * Update doc for salt/client * Update changelog/56273.fixed Thoreau said, "Simplify, Simplify" * Update docs * Update docs * Update CHANGELOG.md * Update 3003.1.rst * Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper * Added changelog * Let Mac OS Mojave run for 8 hours to avoid timeout * Remove FreeBSD-12.2 * Use Popen for VT * Still allow shell True * Drop shlex split * Add crypto re-init * Fix pre-commit * Do not call close in isalive * Skip tests not valid on windows * Cleanup things that are not really needed * We do not support irix * Fix pre-commit * Remove commented out lines * Add changelog for #60504 * Fix pre-commit issues * pyupgrade does not remove six imports * Fix OSErrors in some test cases * Remove un-needed args processing * Make state_running test more reliable * Removing tmpfs from Fedora 33. * Address leaks in fileserver caused by git backends At this time we do not have the ability to fix the upstream memory leaks in the gitfs backend providers. Work around their limitations by periodically restarting the file server update proccess. This will at least partially address #50313 * Remove un-used import * Fix warts caused by black version * Add changelog * We don't need two changelogs * Also pin the ``pip`` upgrade to be ``<21.2`` * Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5. * Adding changelog * Requested changes. * Add shh_timeout to ssh_kwargs * move to with blocks * one with block * reight crypto * add back test file * add changelog * change log file number * add m2crypt support * only check m2crpto * Delete 60571.fixed * add back log * add newline * add newline for log file * Work around https://github.com/pypa/pip/pull/9450 See https://github.com/pypa/pip/issues/10212 * Drop six and Py2 * [3003.2] Add server alive (#60573) * add server alive * rename log * change default alive time * add requested changes * format string * reformat string again * run pre * customize * space * remove EOF dead space * fix pre-commit * run pre Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Changelog for 3003.2 * Man pages update for 3003.2 * Allow CVE entries in `changelog/` * Add security type for towncrier changelog * Add security type for changelog entries pre-commit check * Pin to ``pip>=20.2.4,<21.2`` Refs https://github.com/pypa/pip/pull/9450 * Drop six and Py2 * Fix bug introduced in https://github.com/saltstack/salt/pull/59648 Fixes #60046 * Add changelog * Fix doc builds * fix release notes about dropping ubuntu 16.04 * update file client * add changelog file * update changelog * Check permissions of minion config directory * Fix some wording in the messagebox and in comments * Add changelog * Fix extension for changelog * Add missing commas. It also worked, but now is better * docs_3003.3 * fixing version numbers in man pages. * removing newlines. * removing newlines. * Fixing release notes. * Fix changelog file for 3003.2 release * Fix test_state test using loader.context * Re-add test_context test * Allow Local System account, add timestamp * swaping the git-source for vsphere-automation-sdk-python * Remove destroy, handled in context manager Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com> Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@wiked.org> Co-authored-by: Hoa-Long Tam <hoalong@apple.com> Co-authored-by: krionbsd <krion@freebsd.org> Co-authored-by: Elias Probst <e.probst@ssc-services.de> Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com> Co-authored-by: Frode Gundersen <frogunder@gmail.com> Co-authored-by: twangboy <slee@saltstack.com> Co-authored-by: twangboy <leesh@vmware.com> Co-authored-by: ScriptAutomate <derek@icanteven.io> Co-authored-by: Wayne Werner <waynejwerner@gmail.com> Co-authored-by: David Murphy < dmurphy@saltstack.com> Co-authored-by: Joe Eacott <jeacott@vmware.com> Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com> Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
check_owner:
# We need to verify the owner of the config directory (C:\salt\conf) to
# ensure the config has not been modified by an unknown user. The
# permissions and ownership of the directories is determined by the
# installer used to install Salt. The NullSoft installer requests Admin
# privileges so all directories are created with the Administrators
# Group (S-1-5-32-544) as the owner. The MSI installer, however, runs in
# the context of the Windows Installer service (msiserver), therefore
# all directories are created with the Local System account (S-1-5-18)
# as the owner.
#
# When Salt is launched it sets the root_dir (C:\salt) permissions as
# follows:
# - Owner: Administrators
# - Allow Perms:
# - Owner: Full Control
# - System: Full Control
# - Administrators: Full Control
#
# The conf_dir (C:\salt\conf) inherits Allow/Deny permissions from the
# parent, but NOT Ownership. The owner will be the Administrators Group
# if it was installed via NullSoft or the Local System account if it was
# installed via the MSI. Therefore valid owners for the conf_dir are
# both the Administrators group and the Local System account.
#
# An unprivileged account cannot change the owner of a directory by
# default. So, if the owner of the conf_dir is either the Administrators
# group or the Local System account, then we will trust it. Otherwise,
# we will display an option to abort the installation or to backup the
# untrusted config directory and continue with the default config. If
# running the install with the silent option (/S) it will backup the
# untrusted config directory and continue with the default config.
2025-02-28 09:56:35 -07:00
${LogMsg} "Validating permissions to config"
2021-06-08 10:32:12 -06:00
AccessControl::GetFileOwner /SID "$RootDir\conf"
Merge 3003.3 into master (#60924) * Merge 3002.6 bugfix changes (#59822) * Pass `CI_RUN` as an environment variable to the test run. This allows us to know if we're running the test suite under a CI environment or not and adapt/adjust if needed * Migrate `unit.setup` to PyTest * Backport ae36b15 just for test_install.py * Only skip tests on CI runs * Always store git sha in _version.py during installation * Fix PEP440 compliance. The wheel metadata version 1.2 states that the package version MUST be PEP440 compliant. This means that instead of `3002.2-511-g033c53eccb`, the salt version string should look like `3002.2+511.g033c53eccb`, a post release of `3002.2` ahead by 511 commits with the git sha `033c53eccb` * Fix and migrate `tests/unit/test_version.py` to PyTest * Skip test if `easy_install` is not available * We also need to be PEP440 compliant when there's no git history * Allow extra_filerefs as sanitized kwargs for SSH client * Fix regression on cmd.run when passing tuples as cmd Co-authored-by: Alexander Graul <agraul@suse.com> * Add unit tests to ensure cmd.run accepts tuples * Add unit test to check for extra_filerefs on SSH opts * Add changelog file * Fix comment for test case * Fix unit test to avoid failing on Windows * Skip failing test on windows * Fix test to work on Windows * Add all ssh kwargs to sanitize_kwargs method * Run pre-commit * Fix pylint * Fix cmdmod loglevel and module_names tests * Fix pre-commit * Skip ssh tests if binary does not exist * Use setup_loader for cmdmod test * Prevent argument injection in restartcheck * Add changelog for restartcheck fix * docs_3002.6 * Add back tests removed in merge Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> * Remove glance state module in favor of glance_image * update wording in changelog * bump deprecation warning to Silicon. * Updating warnutil version to Phosphorous. * Update salt/modules/keystone.py Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Check $HOMEBREW_PREFIX when linking against libcrypto When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl` at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs, Homebrew's default installation prefix is `/opt/homebrew`. On all platforms, the prefix is configurable. If Salt doesn't find one of those `libcrypto`s, it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will cause the following crash: Application Specific Information: /usr/lib/libcrypto.dylib abort() called Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`. * Add test case * Add changelog for 59808 * Add changelog entry * Make _find_libcrypto fail on Big Sur if it can't find a library Right now, if `_find_libcrypto` can't find any externally-managed versions of libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto. This does not exist on Big Sur and it would be better to raise an exception here rather than crashing later when trying to open it. * Update _find_libcrypto tests This commit simplifies the unit tests for _find_libcrypto by mocking out the host's filesystem and testing the common libcrypto installations (brew, ports, etc.) on Big Sur. It simplifies the tests for falling back on system versions of libcrypto on previous versions of macOS. * Fix description of test_find_libcrypto_with_system_before_catalina * Patch sys.platform for test_rsax931 tests * modules/match: add missing "minion_id" in Pillar example The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected. - fix documentation - add tests: - to prove the misbehavior of the documented example - to prove the proper behaviour when supplying `minion_id` - to ensure some misbehaviour observed with compound matchers doesn't occur * Fix for issue #59773 - When instantiating the loader grab values of grains and pillars if they are NamedLoaderContext instances. - The loader uses a copy of opts. - Impliment deepcopy on NamedLoaderContext instances. * Add changelog for #59773 * _get_initial_pillar function returns pillar * Fix linter issues * Clean up test * Bump deprecation release for neutron * Uncomment Sulfur release name * Removing the _ext_nodes deprecation warning and alias. * Adding changelog. * Renaming changelog file. * Update 59804.removed * Initial pass at fips_mode config option * Fix pre-commit * Fix tests and add changelog * update docs 3003 * update docs 3003 - newline * Fix warts in changelog * update releasenotes 3003 * add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests * add distro_arch * changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b * Update __utils__ calls to import utils in azure * Add changelog for 59744 * Fix azure unit tests and move to pytest * Use contextvars from site-packages for thin If a contextvars package exists one of the site-packages locations use it for the generated thin tarball. This overrides python's builtin contextvars and allows salt-ssh to work with python <=3.6 even when the master's python is >3.6 (Fixes #59942) * Add regression test for #59942 * Add changelog for #59942 * Update filemap to include test_py_versions * Fix broken thin tests * Always install the `contextvars` backport, even on Py3.7+ Without this change, salt-ssh cannot target systems with Python <= 3.6 * Use salt-factories to handle the container. Don't override default roster * Fix thin tests on windows * No need to use warn log level here * Fix getsitepackages for old virtualenv versions * Add explicit pyobjc reqs * Add back the passthrough stuff * Remove a line so pre-commit will run * Bugfix release docs * Bugfix release docs * Removing pip-compile log files * Bump requirements to address a few security issues * Address traceback on macOS ``` Traceback (most recent call last): File "setup.py", line 1448, in <module> setup(distclass=SaltDistribution) File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "setup.py", line 1068, in __init__ self.update_metadata() File "setup.py", line 1074, in update_metadata attrvalue = getattr(self, attrname, None) File "setup.py", line 1182, in _property_install_requires install_requires += _parse_requirements_file(reqfile) File "setup.py", line 270, in _parse_requirements_file platform.python_version(), _parse_op(op), _parse_ver(ver) File "setup.py", line 247, in _check_ver return getattr(operator, "__{}__".format(op))(pyver, wanted) File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__ c = self._cmp(other) File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'str' and 'int' ``` * Replace `saltstack.com` with `saltproject.io` on URLs being tested * Add back support to load old entrypoints by iterating instead of type checking Fixes #59961 * Fix issue #59975 * Fix pillar serialization for jinja #60083 * Fix test * Add changelog for #60083 * Update changelog and release for 3003.1 * Remove the changelog source refs * Add connect to IPCMessageSubscriber's async_methods Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by SyncWrapper has a connect method that runs the coroutine rather than returns a fugure. * Add changelog for #60049 * Update 60049.fixed * Fix coroutine spelling error Co-authored-by: Wayne Werner <waynejwerner@gmail.com> * IPC on windows cannot use socket paths Fixes #60298 * Update Jinja2 and lxml due to security related bugfix releases Jinja2 ------ CVE-2020-28493 moderate severity Vulnerable versions: < 2.11.3 Patched version: 2.11.3 This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory. lxml ---- CVE-2021-28957 moderate severity Vulnerable versions: < 4.6.3 Patched version: 4.6.3 An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3. * fix github actions jobs on branch until bullseye comes out * Upgrade to `six==1.16.0` to avoid problems on CI runs ``` 13:59:02 nox > Session invoke-pre-commit was successful. 13:59:02 nox > Running session invoke-pre-commit 13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt 13:59:02 Collecting blessings==1.7 13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB) 13:59:02 Collecting invoke==1.4.1 13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB) 13:59:02 Collecting pyyaml==5.3.1 13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB) 13:59:02 Collecting six==1.15.0 13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) 13:59:02 Building wheels for collected packages: pyyaml 13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done 13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167 13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 13:59:02 Successfully built pyyaml 13:59:02 Installing collected packages: six, pyyaml, invoke, blessings 13:59:02 Attempting uninstall: six 13:59:02 Found existing installation: six 1.16.0 13:59:02 Uninstalling six-1.16.0: 13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc' 13:59:02 13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1 13:59:02 nox > Session invoke-pre-commit failed. ``` * add changelog for https://github.com/saltstack/salt/issues/59982 * Regression test for #56273 * Fix race condition in batch. #56273 * Add changelog for #56273 * Update salt/client/__init__.py Co-authored-by: Pedro Algarvio <pedro@algarvio.me> * Update doc for salt/client * Update changelog/56273.fixed Thoreau said, "Simplify, Simplify" * Update docs * Update docs * Update CHANGELOG.md * Update 3003.1.rst * Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper * Added changelog * Let Mac OS Mojave run for 8 hours to avoid timeout * Remove FreeBSD-12.2 * Use Popen for VT * Still allow shell True * Drop shlex split * Add crypto re-init * Fix pre-commit * Do not call close in isalive * Skip tests not valid on windows * Cleanup things that are not really needed * We do not support irix * Fix pre-commit * Remove commented out lines * Add changelog for #60504 * Fix pre-commit issues * pyupgrade does not remove six imports * Fix OSErrors in some test cases * Remove un-needed args processing * Make state_running test more reliable * Removing tmpfs from Fedora 33. * Address leaks in fileserver caused by git backends At this time we do not have the ability to fix the upstream memory leaks in the gitfs backend providers. Work around their limitations by periodically restarting the file server update proccess. This will at least partially address #50313 * Remove un-used import * Fix warts caused by black version * Add changelog * We don't need two changelogs * Also pin the ``pip`` upgrade to be ``<21.2`` * Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5. * Adding changelog * Requested changes. * Add shh_timeout to ssh_kwargs * move to with blocks * one with block * reight crypto * add back test file * add changelog * change log file number * add m2crypt support * only check m2crpto * Delete 60571.fixed * add back log * add newline * add newline for log file * Work around https://github.com/pypa/pip/pull/9450 See https://github.com/pypa/pip/issues/10212 * Drop six and Py2 * [3003.2] Add server alive (#60573) * add server alive * rename log * change default alive time * add requested changes * format string * reformat string again * run pre * customize * space * remove EOF dead space * fix pre-commit * run pre Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Changelog for 3003.2 * Man pages update for 3003.2 * Allow CVE entries in `changelog/` * Add security type for towncrier changelog * Add security type for changelog entries pre-commit check * Pin to ``pip>=20.2.4,<21.2`` Refs https://github.com/pypa/pip/pull/9450 * Drop six and Py2 * Fix bug introduced in https://github.com/saltstack/salt/pull/59648 Fixes #60046 * Add changelog * Fix doc builds * fix release notes about dropping ubuntu 16.04 * update file client * add changelog file * update changelog * Check permissions of minion config directory * Fix some wording in the messagebox and in comments * Add changelog * Fix extension for changelog * Add missing commas. It also worked, but now is better * docs_3003.3 * fixing version numbers in man pages. * removing newlines. * removing newlines. * Fixing release notes. * Fix changelog file for 3003.2 release * Fix test_state test using loader.context * Re-add test_context test * Allow Local System account, add timestamp * swaping the git-source for vsphere-automation-sdk-python * Remove destroy, handled in context manager Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com> Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@wiked.org> Co-authored-by: Hoa-Long Tam <hoalong@apple.com> Co-authored-by: krionbsd <krion@freebsd.org> Co-authored-by: Elias Probst <e.probst@ssc-services.de> Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com> Co-authored-by: Frode Gundersen <frogunder@gmail.com> Co-authored-by: twangboy <slee@saltstack.com> Co-authored-by: twangboy <leesh@vmware.com> Co-authored-by: ScriptAutomate <derek@icanteven.io> Co-authored-by: Wayne Werner <waynejwerner@gmail.com> Co-authored-by: David Murphy < dmurphy@saltstack.com> Co-authored-by: Joe Eacott <jeacott@vmware.com> Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com> Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
Pop $0
# Check for valid SIDs
StrCmp $0 "S-1-5-32-544" correct_owner # Administrators Group (NullSoft)
StrCmp $0 "S-1-5-18" correct_owner # Local System (MSI)
2025-02-28 09:56:35 -07:00
StrCpy $msg "Insecure config found at $RootDir\conf. If you continue, the \
config directory will be renamed to $RootDir\conf.insecure \
2025-02-28 09:56:35 -07:00
and the default config will be used. Continue?"
${LogMsg} $msg
MessageBox MB_YESNO $msg /SD IDYES IDYES insecure_config
${LogMsg} "Aborting"
Merge 3003.3 into master (#60924) * Merge 3002.6 bugfix changes (#59822) * Pass `CI_RUN` as an environment variable to the test run. This allows us to know if we're running the test suite under a CI environment or not and adapt/adjust if needed * Migrate `unit.setup` to PyTest * Backport ae36b15 just for test_install.py * Only skip tests on CI runs * Always store git sha in _version.py during installation * Fix PEP440 compliance. The wheel metadata version 1.2 states that the package version MUST be PEP440 compliant. This means that instead of `3002.2-511-g033c53eccb`, the salt version string should look like `3002.2+511.g033c53eccb`, a post release of `3002.2` ahead by 511 commits with the git sha `033c53eccb` * Fix and migrate `tests/unit/test_version.py` to PyTest * Skip test if `easy_install` is not available * We also need to be PEP440 compliant when there's no git history * Allow extra_filerefs as sanitized kwargs for SSH client * Fix regression on cmd.run when passing tuples as cmd Co-authored-by: Alexander Graul <agraul@suse.com> * Add unit tests to ensure cmd.run accepts tuples * Add unit test to check for extra_filerefs on SSH opts * Add changelog file * Fix comment for test case * Fix unit test to avoid failing on Windows * Skip failing test on windows * Fix test to work on Windows * Add all ssh kwargs to sanitize_kwargs method * Run pre-commit * Fix pylint * Fix cmdmod loglevel and module_names tests * Fix pre-commit * Skip ssh tests if binary does not exist * Use setup_loader for cmdmod test * Prevent argument injection in restartcheck * Add changelog for restartcheck fix * docs_3002.6 * Add back tests removed in merge Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> * Remove glance state module in favor of glance_image * update wording in changelog * bump deprecation warning to Silicon. * Updating warnutil version to Phosphorous. * Update salt/modules/keystone.py Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Check $HOMEBREW_PREFIX when linking against libcrypto When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl` at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs, Homebrew's default installation prefix is `/opt/homebrew`. On all platforms, the prefix is configurable. If Salt doesn't find one of those `libcrypto`s, it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will cause the following crash: Application Specific Information: /usr/lib/libcrypto.dylib abort() called Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`. * Add test case * Add changelog for 59808 * Add changelog entry * Make _find_libcrypto fail on Big Sur if it can't find a library Right now, if `_find_libcrypto` can't find any externally-managed versions of libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto. This does not exist on Big Sur and it would be better to raise an exception here rather than crashing later when trying to open it. * Update _find_libcrypto tests This commit simplifies the unit tests for _find_libcrypto by mocking out the host's filesystem and testing the common libcrypto installations (brew, ports, etc.) on Big Sur. It simplifies the tests for falling back on system versions of libcrypto on previous versions of macOS. * Fix description of test_find_libcrypto_with_system_before_catalina * Patch sys.platform for test_rsax931 tests * modules/match: add missing "minion_id" in Pillar example The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected. - fix documentation - add tests: - to prove the misbehavior of the documented example - to prove the proper behaviour when supplying `minion_id` - to ensure some misbehaviour observed with compound matchers doesn't occur * Fix for issue #59773 - When instantiating the loader grab values of grains and pillars if they are NamedLoaderContext instances. - The loader uses a copy of opts. - Impliment deepcopy on NamedLoaderContext instances. * Add changelog for #59773 * _get_initial_pillar function returns pillar * Fix linter issues * Clean up test * Bump deprecation release for neutron * Uncomment Sulfur release name * Removing the _ext_nodes deprecation warning and alias. * Adding changelog. * Renaming changelog file. * Update 59804.removed * Initial pass at fips_mode config option * Fix pre-commit * Fix tests and add changelog * update docs 3003 * update docs 3003 - newline * Fix warts in changelog * update releasenotes 3003 * add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests * add distro_arch * changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b * Update __utils__ calls to import utils in azure * Add changelog for 59744 * Fix azure unit tests and move to pytest * Use contextvars from site-packages for thin If a contextvars package exists one of the site-packages locations use it for the generated thin tarball. This overrides python's builtin contextvars and allows salt-ssh to work with python <=3.6 even when the master's python is >3.6 (Fixes #59942) * Add regression test for #59942 * Add changelog for #59942 * Update filemap to include test_py_versions * Fix broken thin tests * Always install the `contextvars` backport, even on Py3.7+ Without this change, salt-ssh cannot target systems with Python <= 3.6 * Use salt-factories to handle the container. Don't override default roster * Fix thin tests on windows * No need to use warn log level here * Fix getsitepackages for old virtualenv versions * Add explicit pyobjc reqs * Add back the passthrough stuff * Remove a line so pre-commit will run * Bugfix release docs * Bugfix release docs * Removing pip-compile log files * Bump requirements to address a few security issues * Address traceback on macOS ``` Traceback (most recent call last): File "setup.py", line 1448, in <module> setup(distclass=SaltDistribution) File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "setup.py", line 1068, in __init__ self.update_metadata() File "setup.py", line 1074, in update_metadata attrvalue = getattr(self, attrname, None) File "setup.py", line 1182, in _property_install_requires install_requires += _parse_requirements_file(reqfile) File "setup.py", line 270, in _parse_requirements_file platform.python_version(), _parse_op(op), _parse_ver(ver) File "setup.py", line 247, in _check_ver return getattr(operator, "__{}__".format(op))(pyver, wanted) File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__ c = self._cmp(other) File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'str' and 'int' ``` * Replace `saltstack.com` with `saltproject.io` on URLs being tested * Add back support to load old entrypoints by iterating instead of type checking Fixes #59961 * Fix issue #59975 * Fix pillar serialization for jinja #60083 * Fix test * Add changelog for #60083 * Update changelog and release for 3003.1 * Remove the changelog source refs * Add connect to IPCMessageSubscriber's async_methods Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by SyncWrapper has a connect method that runs the coroutine rather than returns a fugure. * Add changelog for #60049 * Update 60049.fixed * Fix coroutine spelling error Co-authored-by: Wayne Werner <waynejwerner@gmail.com> * IPC on windows cannot use socket paths Fixes #60298 * Update Jinja2 and lxml due to security related bugfix releases Jinja2 ------ CVE-2020-28493 moderate severity Vulnerable versions: < 2.11.3 Patched version: 2.11.3 This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory. lxml ---- CVE-2021-28957 moderate severity Vulnerable versions: < 4.6.3 Patched version: 4.6.3 An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3. * fix github actions jobs on branch until bullseye comes out * Upgrade to `six==1.16.0` to avoid problems on CI runs ``` 13:59:02 nox > Session invoke-pre-commit was successful. 13:59:02 nox > Running session invoke-pre-commit 13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt 13:59:02 Collecting blessings==1.7 13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB) 13:59:02 Collecting invoke==1.4.1 13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB) 13:59:02 Collecting pyyaml==5.3.1 13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB) 13:59:02 Collecting six==1.15.0 13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) 13:59:02 Building wheels for collected packages: pyyaml 13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done 13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167 13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 13:59:02 Successfully built pyyaml 13:59:02 Installing collected packages: six, pyyaml, invoke, blessings 13:59:02 Attempting uninstall: six 13:59:02 Found existing installation: six 1.16.0 13:59:02 Uninstalling six-1.16.0: 13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc' 13:59:02 13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1 13:59:02 nox > Session invoke-pre-commit failed. ``` * add changelog for https://github.com/saltstack/salt/issues/59982 * Regression test for #56273 * Fix race condition in batch. #56273 * Add changelog for #56273 * Update salt/client/__init__.py Co-authored-by: Pedro Algarvio <pedro@algarvio.me> * Update doc for salt/client * Update changelog/56273.fixed Thoreau said, "Simplify, Simplify" * Update docs * Update docs * Update CHANGELOG.md * Update 3003.1.rst * Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper * Added changelog * Let Mac OS Mojave run for 8 hours to avoid timeout * Remove FreeBSD-12.2 * Use Popen for VT * Still allow shell True * Drop shlex split * Add crypto re-init * Fix pre-commit * Do not call close in isalive * Skip tests not valid on windows * Cleanup things that are not really needed * We do not support irix * Fix pre-commit * Remove commented out lines * Add changelog for #60504 * Fix pre-commit issues * pyupgrade does not remove six imports * Fix OSErrors in some test cases * Remove un-needed args processing * Make state_running test more reliable * Removing tmpfs from Fedora 33. * Address leaks in fileserver caused by git backends At this time we do not have the ability to fix the upstream memory leaks in the gitfs backend providers. Work around their limitations by periodically restarting the file server update proccess. This will at least partially address #50313 * Remove un-used import * Fix warts caused by black version * Add changelog * We don't need two changelogs * Also pin the ``pip`` upgrade to be ``<21.2`` * Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5. * Adding changelog * Requested changes. * Add shh_timeout to ssh_kwargs * move to with blocks * one with block * reight crypto * add back test file * add changelog * change log file number * add m2crypt support * only check m2crpto * Delete 60571.fixed * add back log * add newline * add newline for log file * Work around https://github.com/pypa/pip/pull/9450 See https://github.com/pypa/pip/issues/10212 * Drop six and Py2 * [3003.2] Add server alive (#60573) * add server alive * rename log * change default alive time * add requested changes * format string * reformat string again * run pre * customize * space * remove EOF dead space * fix pre-commit * run pre Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Changelog for 3003.2 * Man pages update for 3003.2 * Allow CVE entries in `changelog/` * Add security type for towncrier changelog * Add security type for changelog entries pre-commit check * Pin to ``pip>=20.2.4,<21.2`` Refs https://github.com/pypa/pip/pull/9450 * Drop six and Py2 * Fix bug introduced in https://github.com/saltstack/salt/pull/59648 Fixes #60046 * Add changelog * Fix doc builds * fix release notes about dropping ubuntu 16.04 * update file client * add changelog file * update changelog * Check permissions of minion config directory * Fix some wording in the messagebox and in comments * Add changelog * Fix extension for changelog * Add missing commas. It also worked, but now is better * docs_3003.3 * fixing version numbers in man pages. * removing newlines. * removing newlines. * Fixing release notes. * Fix changelog file for 3003.2 release * Fix test_state test using loader.context * Re-add test_context test * Allow Local System account, add timestamp * swaping the git-source for vsphere-automation-sdk-python * Remove destroy, handled in context manager Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com> Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@wiked.org> Co-authored-by: Hoa-Long Tam <hoalong@apple.com> Co-authored-by: krionbsd <krion@freebsd.org> Co-authored-by: Elias Probst <e.probst@ssc-services.de> Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com> Co-authored-by: Frode Gundersen <frogunder@gmail.com> Co-authored-by: twangboy <slee@saltstack.com> Co-authored-by: twangboy <leesh@vmware.com> Co-authored-by: ScriptAutomate <derek@icanteven.io> Co-authored-by: Wayne Werner <waynejwerner@gmail.com> Co-authored-by: David Murphy < dmurphy@saltstack.com> Co-authored-by: Joe Eacott <jeacott@vmware.com> Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com> Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
Abort
insecure_config:
# Backing up insecure config
2025-02-28 09:56:35 -07:00
${LogMsg} "Backing up insecure config"
Rename "$RootDir\conf" "$RootDir\conf.insecure-$TimeStamp"
2021-06-08 10:32:12 -06:00
Goto confNotFound
Merge 3003.3 into master (#60924) * Merge 3002.6 bugfix changes (#59822) * Pass `CI_RUN` as an environment variable to the test run. This allows us to know if we're running the test suite under a CI environment or not and adapt/adjust if needed * Migrate `unit.setup` to PyTest * Backport ae36b15 just for test_install.py * Only skip tests on CI runs * Always store git sha in _version.py during installation * Fix PEP440 compliance. The wheel metadata version 1.2 states that the package version MUST be PEP440 compliant. This means that instead of `3002.2-511-g033c53eccb`, the salt version string should look like `3002.2+511.g033c53eccb`, a post release of `3002.2` ahead by 511 commits with the git sha `033c53eccb` * Fix and migrate `tests/unit/test_version.py` to PyTest * Skip test if `easy_install` is not available * We also need to be PEP440 compliant when there's no git history * Allow extra_filerefs as sanitized kwargs for SSH client * Fix regression on cmd.run when passing tuples as cmd Co-authored-by: Alexander Graul <agraul@suse.com> * Add unit tests to ensure cmd.run accepts tuples * Add unit test to check for extra_filerefs on SSH opts * Add changelog file * Fix comment for test case * Fix unit test to avoid failing on Windows * Skip failing test on windows * Fix test to work on Windows * Add all ssh kwargs to sanitize_kwargs method * Run pre-commit * Fix pylint * Fix cmdmod loglevel and module_names tests * Fix pre-commit * Skip ssh tests if binary does not exist * Use setup_loader for cmdmod test * Prevent argument injection in restartcheck * Add changelog for restartcheck fix * docs_3002.6 * Add back tests removed in merge Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> * Remove glance state module in favor of glance_image * update wording in changelog * bump deprecation warning to Silicon. * Updating warnutil version to Phosphorous. * Update salt/modules/keystone.py Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Check $HOMEBREW_PREFIX when linking against libcrypto When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl` at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs, Homebrew's default installation prefix is `/opt/homebrew`. On all platforms, the prefix is configurable. If Salt doesn't find one of those `libcrypto`s, it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will cause the following crash: Application Specific Information: /usr/lib/libcrypto.dylib abort() called Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`. * Add test case * Add changelog for 59808 * Add changelog entry * Make _find_libcrypto fail on Big Sur if it can't find a library Right now, if `_find_libcrypto` can't find any externally-managed versions of libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto. This does not exist on Big Sur and it would be better to raise an exception here rather than crashing later when trying to open it. * Update _find_libcrypto tests This commit simplifies the unit tests for _find_libcrypto by mocking out the host's filesystem and testing the common libcrypto installations (brew, ports, etc.) on Big Sur. It simplifies the tests for falling back on system versions of libcrypto on previous versions of macOS. * Fix description of test_find_libcrypto_with_system_before_catalina * Patch sys.platform for test_rsax931 tests * modules/match: add missing "minion_id" in Pillar example The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected. - fix documentation - add tests: - to prove the misbehavior of the documented example - to prove the proper behaviour when supplying `minion_id` - to ensure some misbehaviour observed with compound matchers doesn't occur * Fix for issue #59773 - When instantiating the loader grab values of grains and pillars if they are NamedLoaderContext instances. - The loader uses a copy of opts. - Impliment deepcopy on NamedLoaderContext instances. * Add changelog for #59773 * _get_initial_pillar function returns pillar * Fix linter issues * Clean up test * Bump deprecation release for neutron * Uncomment Sulfur release name * Removing the _ext_nodes deprecation warning and alias. * Adding changelog. * Renaming changelog file. * Update 59804.removed * Initial pass at fips_mode config option * Fix pre-commit * Fix tests and add changelog * update docs 3003 * update docs 3003 - newline * Fix warts in changelog * update releasenotes 3003 * add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests * add distro_arch * changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b * Update __utils__ calls to import utils in azure * Add changelog for 59744 * Fix azure unit tests and move to pytest * Use contextvars from site-packages for thin If a contextvars package exists one of the site-packages locations use it for the generated thin tarball. This overrides python's builtin contextvars and allows salt-ssh to work with python <=3.6 even when the master's python is >3.6 (Fixes #59942) * Add regression test for #59942 * Add changelog for #59942 * Update filemap to include test_py_versions * Fix broken thin tests * Always install the `contextvars` backport, even on Py3.7+ Without this change, salt-ssh cannot target systems with Python <= 3.6 * Use salt-factories to handle the container. Don't override default roster * Fix thin tests on windows * No need to use warn log level here * Fix getsitepackages for old virtualenv versions * Add explicit pyobjc reqs * Add back the passthrough stuff * Remove a line so pre-commit will run * Bugfix release docs * Bugfix release docs * Removing pip-compile log files * Bump requirements to address a few security issues * Address traceback on macOS ``` Traceback (most recent call last): File "setup.py", line 1448, in <module> setup(distclass=SaltDistribution) File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "setup.py", line 1068, in __init__ self.update_metadata() File "setup.py", line 1074, in update_metadata attrvalue = getattr(self, attrname, None) File "setup.py", line 1182, in _property_install_requires install_requires += _parse_requirements_file(reqfile) File "setup.py", line 270, in _parse_requirements_file platform.python_version(), _parse_op(op), _parse_ver(ver) File "setup.py", line 247, in _check_ver return getattr(operator, "__{}__".format(op))(pyver, wanted) File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__ c = self._cmp(other) File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'str' and 'int' ``` * Replace `saltstack.com` with `saltproject.io` on URLs being tested * Add back support to load old entrypoints by iterating instead of type checking Fixes #59961 * Fix issue #59975 * Fix pillar serialization for jinja #60083 * Fix test * Add changelog for #60083 * Update changelog and release for 3003.1 * Remove the changelog source refs * Add connect to IPCMessageSubscriber's async_methods Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by SyncWrapper has a connect method that runs the coroutine rather than returns a fugure. * Add changelog for #60049 * Update 60049.fixed * Fix coroutine spelling error Co-authored-by: Wayne Werner <waynejwerner@gmail.com> * IPC on windows cannot use socket paths Fixes #60298 * Update Jinja2 and lxml due to security related bugfix releases Jinja2 ------ CVE-2020-28493 moderate severity Vulnerable versions: < 2.11.3 Patched version: 2.11.3 This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory. lxml ---- CVE-2021-28957 moderate severity Vulnerable versions: < 4.6.3 Patched version: 4.6.3 An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3. * fix github actions jobs on branch until bullseye comes out * Upgrade to `six==1.16.0` to avoid problems on CI runs ``` 13:59:02 nox > Session invoke-pre-commit was successful. 13:59:02 nox > Running session invoke-pre-commit 13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt 13:59:02 Collecting blessings==1.7 13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB) 13:59:02 Collecting invoke==1.4.1 13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB) 13:59:02 Collecting pyyaml==5.3.1 13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB) 13:59:02 Collecting six==1.15.0 13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) 13:59:02 Building wheels for collected packages: pyyaml 13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done 13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167 13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 13:59:02 Successfully built pyyaml 13:59:02 Installing collected packages: six, pyyaml, invoke, blessings 13:59:02 Attempting uninstall: six 13:59:02 Found existing installation: six 1.16.0 13:59:02 Uninstalling six-1.16.0: 13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc' 13:59:02 13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1 13:59:02 nox > Session invoke-pre-commit failed. ``` * add changelog for https://github.com/saltstack/salt/issues/59982 * Regression test for #56273 * Fix race condition in batch. #56273 * Add changelog for #56273 * Update salt/client/__init__.py Co-authored-by: Pedro Algarvio <pedro@algarvio.me> * Update doc for salt/client * Update changelog/56273.fixed Thoreau said, "Simplify, Simplify" * Update docs * Update docs * Update CHANGELOG.md * Update 3003.1.rst * Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper * Added changelog * Let Mac OS Mojave run for 8 hours to avoid timeout * Remove FreeBSD-12.2 * Use Popen for VT * Still allow shell True * Drop shlex split * Add crypto re-init * Fix pre-commit * Do not call close in isalive * Skip tests not valid on windows * Cleanup things that are not really needed * We do not support irix * Fix pre-commit * Remove commented out lines * Add changelog for #60504 * Fix pre-commit issues * pyupgrade does not remove six imports * Fix OSErrors in some test cases * Remove un-needed args processing * Make state_running test more reliable * Removing tmpfs from Fedora 33. * Address leaks in fileserver caused by git backends At this time we do not have the ability to fix the upstream memory leaks in the gitfs backend providers. Work around their limitations by periodically restarting the file server update proccess. This will at least partially address #50313 * Remove un-used import * Fix warts caused by black version * Add changelog * We don't need two changelogs * Also pin the ``pip`` upgrade to be ``<21.2`` * Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5. * Adding changelog * Requested changes. * Add shh_timeout to ssh_kwargs * move to with blocks * one with block * reight crypto * add back test file * add changelog * change log file number * add m2crypt support * only check m2crpto * Delete 60571.fixed * add back log * add newline * add newline for log file * Work around https://github.com/pypa/pip/pull/9450 See https://github.com/pypa/pip/issues/10212 * Drop six and Py2 * [3003.2] Add server alive (#60573) * add server alive * rename log * change default alive time * add requested changes * format string * reformat string again * run pre * customize * space * remove EOF dead space * fix pre-commit * run pre Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Changelog for 3003.2 * Man pages update for 3003.2 * Allow CVE entries in `changelog/` * Add security type for towncrier changelog * Add security type for changelog entries pre-commit check * Pin to ``pip>=20.2.4,<21.2`` Refs https://github.com/pypa/pip/pull/9450 * Drop six and Py2 * Fix bug introduced in https://github.com/saltstack/salt/pull/59648 Fixes #60046 * Add changelog * Fix doc builds * fix release notes about dropping ubuntu 16.04 * update file client * add changelog file * update changelog * Check permissions of minion config directory * Fix some wording in the messagebox and in comments * Add changelog * Fix extension for changelog * Add missing commas. It also worked, but now is better * docs_3003.3 * fixing version numbers in man pages. * removing newlines. * removing newlines. * Fixing release notes. * Fix changelog file for 3003.2 release * Fix test_state test using loader.context * Re-add test_context test * Allow Local System account, add timestamp * swaping the git-source for vsphere-automation-sdk-python * Remove destroy, handled in context manager Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com> Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@wiked.org> Co-authored-by: Hoa-Long Tam <hoalong@apple.com> Co-authored-by: krionbsd <krion@freebsd.org> Co-authored-by: Elias Probst <e.probst@ssc-services.de> Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com> Co-authored-by: Frode Gundersen <frogunder@gmail.com> Co-authored-by: twangboy <slee@saltstack.com> Co-authored-by: twangboy <leesh@vmware.com> Co-authored-by: ScriptAutomate <derek@icanteven.io> Co-authored-by: Wayne Werner <waynejwerner@gmail.com> Co-authored-by: David Murphy < dmurphy@saltstack.com> Co-authored-by: Joe Eacott <jeacott@vmware.com> Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com> Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
correct_owner:
2025-02-28 09:56:35 -07:00
${LogMsg} "Found existing config with correct permissions"
Merge 3003.3 into master (#60924) * Merge 3002.6 bugfix changes (#59822) * Pass `CI_RUN` as an environment variable to the test run. This allows us to know if we're running the test suite under a CI environment or not and adapt/adjust if needed * Migrate `unit.setup` to PyTest * Backport ae36b15 just for test_install.py * Only skip tests on CI runs * Always store git sha in _version.py during installation * Fix PEP440 compliance. The wheel metadata version 1.2 states that the package version MUST be PEP440 compliant. This means that instead of `3002.2-511-g033c53eccb`, the salt version string should look like `3002.2+511.g033c53eccb`, a post release of `3002.2` ahead by 511 commits with the git sha `033c53eccb` * Fix and migrate `tests/unit/test_version.py` to PyTest * Skip test if `easy_install` is not available * We also need to be PEP440 compliant when there's no git history * Allow extra_filerefs as sanitized kwargs for SSH client * Fix regression on cmd.run when passing tuples as cmd Co-authored-by: Alexander Graul <agraul@suse.com> * Add unit tests to ensure cmd.run accepts tuples * Add unit test to check for extra_filerefs on SSH opts * Add changelog file * Fix comment for test case * Fix unit test to avoid failing on Windows * Skip failing test on windows * Fix test to work on Windows * Add all ssh kwargs to sanitize_kwargs method * Run pre-commit * Fix pylint * Fix cmdmod loglevel and module_names tests * Fix pre-commit * Skip ssh tests if binary does not exist * Use setup_loader for cmdmod test * Prevent argument injection in restartcheck * Add changelog for restartcheck fix * docs_3002.6 * Add back tests removed in merge Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> * Remove glance state module in favor of glance_image * update wording in changelog * bump deprecation warning to Silicon. * Updating warnutil version to Phosphorous. * Update salt/modules/keystone.py Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Check $HOMEBREW_PREFIX when linking against libcrypto When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl` at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs, Homebrew's default installation prefix is `/opt/homebrew`. On all platforms, the prefix is configurable. If Salt doesn't find one of those `libcrypto`s, it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will cause the following crash: Application Specific Information: /usr/lib/libcrypto.dylib abort() called Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`. * Add test case * Add changelog for 59808 * Add changelog entry * Make _find_libcrypto fail on Big Sur if it can't find a library Right now, if `_find_libcrypto` can't find any externally-managed versions of libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto. This does not exist on Big Sur and it would be better to raise an exception here rather than crashing later when trying to open it. * Update _find_libcrypto tests This commit simplifies the unit tests for _find_libcrypto by mocking out the host's filesystem and testing the common libcrypto installations (brew, ports, etc.) on Big Sur. It simplifies the tests for falling back on system versions of libcrypto on previous versions of macOS. * Fix description of test_find_libcrypto_with_system_before_catalina * Patch sys.platform for test_rsax931 tests * modules/match: add missing "minion_id" in Pillar example The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected. - fix documentation - add tests: - to prove the misbehavior of the documented example - to prove the proper behaviour when supplying `minion_id` - to ensure some misbehaviour observed with compound matchers doesn't occur * Fix for issue #59773 - When instantiating the loader grab values of grains and pillars if they are NamedLoaderContext instances. - The loader uses a copy of opts. - Impliment deepcopy on NamedLoaderContext instances. * Add changelog for #59773 * _get_initial_pillar function returns pillar * Fix linter issues * Clean up test * Bump deprecation release for neutron * Uncomment Sulfur release name * Removing the _ext_nodes deprecation warning and alias. * Adding changelog. * Renaming changelog file. * Update 59804.removed * Initial pass at fips_mode config option * Fix pre-commit * Fix tests and add changelog * update docs 3003 * update docs 3003 - newline * Fix warts in changelog * update releasenotes 3003 * add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests * add distro_arch * changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b * Update __utils__ calls to import utils in azure * Add changelog for 59744 * Fix azure unit tests and move to pytest * Use contextvars from site-packages for thin If a contextvars package exists one of the site-packages locations use it for the generated thin tarball. This overrides python's builtin contextvars and allows salt-ssh to work with python <=3.6 even when the master's python is >3.6 (Fixes #59942) * Add regression test for #59942 * Add changelog for #59942 * Update filemap to include test_py_versions * Fix broken thin tests * Always install the `contextvars` backport, even on Py3.7+ Without this change, salt-ssh cannot target systems with Python <= 3.6 * Use salt-factories to handle the container. Don't override default roster * Fix thin tests on windows * No need to use warn log level here * Fix getsitepackages for old virtualenv versions * Add explicit pyobjc reqs * Add back the passthrough stuff * Remove a line so pre-commit will run * Bugfix release docs * Bugfix release docs * Removing pip-compile log files * Bump requirements to address a few security issues * Address traceback on macOS ``` Traceback (most recent call last): File "setup.py", line 1448, in <module> setup(distclass=SaltDistribution) File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "setup.py", line 1068, in __init__ self.update_metadata() File "setup.py", line 1074, in update_metadata attrvalue = getattr(self, attrname, None) File "setup.py", line 1182, in _property_install_requires install_requires += _parse_requirements_file(reqfile) File "setup.py", line 270, in _parse_requirements_file platform.python_version(), _parse_op(op), _parse_ver(ver) File "setup.py", line 247, in _check_ver return getattr(operator, "__{}__".format(op))(pyver, wanted) File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__ c = self._cmp(other) File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp if self.version < other.version: TypeError: '<' not supported between instances of 'str' and 'int' ``` * Replace `saltstack.com` with `saltproject.io` on URLs being tested * Add back support to load old entrypoints by iterating instead of type checking Fixes #59961 * Fix issue #59975 * Fix pillar serialization for jinja #60083 * Fix test * Add changelog for #60083 * Update changelog and release for 3003.1 * Remove the changelog source refs * Add connect to IPCMessageSubscriber's async_methods Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by SyncWrapper has a connect method that runs the coroutine rather than returns a fugure. * Add changelog for #60049 * Update 60049.fixed * Fix coroutine spelling error Co-authored-by: Wayne Werner <waynejwerner@gmail.com> * IPC on windows cannot use socket paths Fixes #60298 * Update Jinja2 and lxml due to security related bugfix releases Jinja2 ------ CVE-2020-28493 moderate severity Vulnerable versions: < 2.11.3 Patched version: 2.11.3 This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory. lxml ---- CVE-2021-28957 moderate severity Vulnerable versions: < 4.6.3 Patched version: 4.6.3 An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3. * fix github actions jobs on branch until bullseye comes out * Upgrade to `six==1.16.0` to avoid problems on CI runs ``` 13:59:02 nox > Session invoke-pre-commit was successful. 13:59:02 nox > Running session invoke-pre-commit 13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt 13:59:02 Collecting blessings==1.7 13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB) 13:59:02 Collecting invoke==1.4.1 13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB) 13:59:02 Collecting pyyaml==5.3.1 13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB) 13:59:02 Collecting six==1.15.0 13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB) 13:59:02 Building wheels for collected packages: pyyaml 13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done 13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167 13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653 13:59:02 Successfully built pyyaml 13:59:02 Installing collected packages: six, pyyaml, invoke, blessings 13:59:02 Attempting uninstall: six 13:59:02 Found existing installation: six 1.16.0 13:59:02 Uninstalling six-1.16.0: 13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc' 13:59:02 13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1 13:59:02 nox > Session invoke-pre-commit failed. ``` * add changelog for https://github.com/saltstack/salt/issues/59982 * Regression test for #56273 * Fix race condition in batch. #56273 * Add changelog for #56273 * Update salt/client/__init__.py Co-authored-by: Pedro Algarvio <pedro@algarvio.me> * Update doc for salt/client * Update changelog/56273.fixed Thoreau said, "Simplify, Simplify" * Update docs * Update docs * Update CHANGELOG.md * Update 3003.1.rst * Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper * Added changelog * Let Mac OS Mojave run for 8 hours to avoid timeout * Remove FreeBSD-12.2 * Use Popen for VT * Still allow shell True * Drop shlex split * Add crypto re-init * Fix pre-commit * Do not call close in isalive * Skip tests not valid on windows * Cleanup things that are not really needed * We do not support irix * Fix pre-commit * Remove commented out lines * Add changelog for #60504 * Fix pre-commit issues * pyupgrade does not remove six imports * Fix OSErrors in some test cases * Remove un-needed args processing * Make state_running test more reliable * Removing tmpfs from Fedora 33. * Address leaks in fileserver caused by git backends At this time we do not have the ability to fix the upstream memory leaks in the gitfs backend providers. Work around their limitations by periodically restarting the file server update proccess. This will at least partially address #50313 * Remove un-used import * Fix warts caused by black version * Add changelog * We don't need two changelogs * Also pin the ``pip`` upgrade to be ``<21.2`` * Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5. * Adding changelog * Requested changes. * Add shh_timeout to ssh_kwargs * move to with blocks * one with block * reight crypto * add back test file * add changelog * change log file number * add m2crypt support * only check m2crpto * Delete 60571.fixed * add back log * add newline * add newline for log file * Work around https://github.com/pypa/pip/pull/9450 See https://github.com/pypa/pip/issues/10212 * Drop six and Py2 * [3003.2] Add server alive (#60573) * add server alive * rename log * change default alive time * add requested changes * format string * reformat string again * run pre * customize * space * remove EOF dead space * fix pre-commit * run pre Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com> * Changelog for 3003.2 * Man pages update for 3003.2 * Allow CVE entries in `changelog/` * Add security type for towncrier changelog * Add security type for changelog entries pre-commit check * Pin to ``pip>=20.2.4,<21.2`` Refs https://github.com/pypa/pip/pull/9450 * Drop six and Py2 * Fix bug introduced in https://github.com/saltstack/salt/pull/59648 Fixes #60046 * Add changelog * Fix doc builds * fix release notes about dropping ubuntu 16.04 * update file client * add changelog file * update changelog * Check permissions of minion config directory * Fix some wording in the messagebox and in comments * Add changelog * Fix extension for changelog * Add missing commas. It also worked, but now is better * docs_3003.3 * fixing version numbers in man pages. * removing newlines. * removing newlines. * Fixing release notes. * Fix changelog file for 3003.2 release * Fix test_state test using loader.context * Re-add test_context test * Allow Local System account, add timestamp * swaping the git-source for vsphere-automation-sdk-python * Remove destroy, handled in context manager Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com> Co-authored-by: Pedro Algarvio <pedro@algarvio.me> Co-authored-by: Bryce Larson <brycel@vmware.com> Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com> Co-authored-by: Alexander Graul <agraul@suse.com> Co-authored-by: Frode Gundersen <fgundersen@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com> Co-authored-by: Gareth J. Greenaway <gareth@wiked.org> Co-authored-by: Hoa-Long Tam <hoalong@apple.com> Co-authored-by: krionbsd <krion@freebsd.org> Co-authored-by: Elias Probst <e.probst@ssc-services.de> Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com> Co-authored-by: Frode Gundersen <frogunder@gmail.com> Co-authored-by: twangboy <slee@saltstack.com> Co-authored-by: twangboy <leesh@vmware.com> Co-authored-by: ScriptAutomate <derek@icanteven.io> Co-authored-by: Wayne Werner <waynejwerner@gmail.com> Co-authored-by: David Murphy < dmurphy@saltstack.com> Co-authored-by: Joe Eacott <jeacott@vmware.com> Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com> Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
StrCpy $ExistingConfigFound 1
2025-02-28 09:56:35 -07:00
${LogMsg} "Opening minion config read-only"
ClearErrors
2021-06-08 10:32:12 -06:00
FileOpen $0 "$RootDir\conf\minion" r
2025-02-28 09:56:35 -07:00
IfErrors 0 get_config_values
${LogMsg} "There was an error opening the minion config"
${LogMsg} "Config values will not be detected"
Goto set_default_values
get_config_values:
${LogMsg} "Getting config values from existing config"
2016-08-08 23:23:04 +00:00
confLoop:
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
ClearErrors # clear Errors
FileRead $0 $1 # read the next line
IfErrors EndOfFile # error is probably EOF
${StrLoc} $2 $1 "master:" ">" # find `master:` starting at the beginning
${If} $2 == 0 # if it found it in the first position, then it is defined
${StrStrAdv} $2 $1 "master: " ">" ">" "0" "0" "0" # read everything after `master: `
${Trim} $2 $2 # trim white space
${If} $2 == "" # if it's empty, it's probably a list of masters
masterLoop:
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
ClearErrors # clear Errors
FileRead $0 $1 # read the next line
IfErrors EndOfFile # error is probably EOF
${StrStrAdv} $2 $1 "- " ">" ">" "0" "0" "0" # read everything after `- `
${Trim} $2 $2 # trim white space
${IfNot} $2 == "" # if the line is not empty, we found something
2021-06-25 16:08:16 -06:00
${If} $MasterHost_Cfg == "" # if the config setting is empty
StrCpy $MasterHost_Cfg $2 # make the first item the new entry
${Else}
2021-06-25 16:08:16 -06:00
StrCpy $MasterHost_Cfg "$MasterHost_Cfg,$2" # Append the new master, comma separated
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Goto masterLoop # check the next one
${EndIf}
${Else}
2021-06-25 16:08:16 -06:00
StrCpy $MasterHost_Cfg $2 # a single master entry
2016-08-08 23:23:04 +00:00
${EndIf}
${EndIf}
2016-08-08 23:23:04 +00:00
${StrLoc} $2 $1 "id:" ">"
${If} $2 == 0
${StrStrAdv} $2 $1 "id: " ">" ">" "0" "0" "0"
${Trim} $2 $2
2021-06-25 16:08:16 -06:00
StrCpy $MinionName_Cfg $2
2016-08-08 23:23:04 +00:00
${EndIf}
Goto confLoop
EndOfFile:
2025-02-28 09:56:35 -07:00
FileClose $0
2016-08-08 23:23:04 +00:00
2021-06-08 10:32:12 -06:00
confNotFound:
2025-02-28 09:56:35 -07:00
${LogMsg} "Config not found"
2016-08-08 23:23:04 +00:00
2025-02-28 09:56:35 -07:00
set_default_values:
# Set Default Config Values if not found
${If} $MasterHost_Cfg == ""
${LogMsg} "Setting master host setting to default: salt"
StrCpy $MasterHost_Cfg "salt"
${EndIf}
${If} $MinionName_Cfg == ""
${LogMsg} "Setting minion id setting to default: hostname"
StrCpy $MinionName_Cfg "hostname"
${EndIf}
2016-08-08 23:23:04 +00:00
FunctionEnd
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Var cfg_line
Var chk_line
Var lst_check
2025-02-28 09:56:35 -07:00
Var tgt_file
Var tmp_file
2016-08-08 23:23:04 +00:00
Function updateMinionConfig
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
StrCpy $ConfigWriteMaster 1 # write the master config value
StrCpy $ConfigWriteMinion 1 # write the minion config value
2025-02-28 09:56:35 -07:00
${If} $MasterHost == "" # if master is empty
${OrIf} $MasterHost == "salt" # or if master is 'salt'
StrCpy $ConfigWriteMaster 0 # no need to write master config
${EndIf} # close if statement
${If} $MinionName == "" # if minion is empty
${OrIf} $MinionName == "hostname" # and if minion is not 'hostname'
StrCpy $ConfigWriteMinion 0 # no need to write minion config
${EndIf} # close if statement
${If} $ConfigWriteMaster == 0
${AndIf} $ConfigWriteMinion == 0
${LogMsg} "No config values to update. Config will not be updated"
Goto update_minion_config_finished
${EndIf}
${LogMsg} "Updating Minion Config"
${LogMsg} "Opening target file: $RootDir\conf\minion"
ClearErrors
FileOpen $tgt_file "$RootDir\conf\minion" r # open target file for reading
${If} ${Errors}
${LogMsg} "Target file could not be opened read-only"
${LogMsg} "Minion config will not be updated"
Goto update_minion_config_finished
${EndIf}
GetTempFileName $R0 # get new temp file name
${LogMsg} "Opening temp file: $R0"
ClearErrors
FileOpen $tmp_file "$R0" w # open temp file for writing
${If} ${Errors}
${LogMsg} "Temp file could not be opened for writing"
${LogMsg} "Minion config will not be updated"
Goto update_minion_config_finished
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
loop: # loop through each line
2025-02-28 09:56:35 -07:00
${LogMsg} "Reading line from target config file"
ClearErrors
FileRead $tgt_file $cfg_line # read line from target file
${If} ${Errors}
${LogMsg} "Error: Most likely reached End-Of-File"
Goto done
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
loop_after_read:
StrCpy $lst_check 0 # list check not performed
${If} $ConfigWriteMaster == 1 # if we need to write master config
${StrLoc} $3 $cfg_line "master:" ">" # where is 'master:' in this line
${If} $3 == 0 # is it in the first...
${OrIf} $3 == 1 # or second position (account for comments)
2025-02-28 09:56:35 -07:00
${LogMsg} "Found master. Updating temp config"
${Explode} $9 "," $MasterHost # Split the hostname on commas, $9 is the number of items found
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${If} $9 == 1 # 1 means only a single master was passed
2021-06-25 16:08:16 -06:00
StrCpy $cfg_line "master: $MasterHost$\r$\n" # write the master
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Else} # make a multi-master entry
StrCpy $cfg_line "master:" # make the first line "master:"
loop_explode: # start a loop to go through the list in the config
pop $8 # pop the next item off the stack
${Trim} $8 $8 # trim any whitespace
StrCpy $cfg_line "$cfg_line$\r$\n - $8" # add it to the master variable ($2)
IntOp $9 $9 - 1 # decrement the list count
${If} $9 >= 1 # if it's not 0
Goto loop_explode # do it again
${EndIf} # close if statement
StrCpy $cfg_line "$cfg_line$\r$\n" # Make sure there's a new line at the end
# Remove remaining items in list
${While} $lst_check == 0 # while list item found
2025-02-28 09:56:35 -07:00
FileRead $tgt_file $chk_line # read line from target file
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
IfErrors done # end if errors are encountered (end of line)
${StrLoc} $3 $chk_line " - " ">" # where is 'master:' in this line
${If} $3 == "" # is it in the first...
StrCpy $lst_check 1 # list check performed and finished
${EndIf}
${EndWhile}
${EndIf} # close if statement
StrCpy $ConfigWriteMaster 0 # master value written to config
${EndIf} # close if statement
${EndIf} # close if statement
${If} $ConfigWriteMinion == 1 # if we need to write minion config
${StrLoc} $3 $cfg_line "id:" ">" # where is 'id:' in this line
${If} $3 == 0 # is it in the first...
${OrIf} $3 == 1 # or the second position (account for comments)
2025-02-28 09:56:35 -07:00
${LogMsg} "Found minion ID. Updating temp config"
2021-06-25 16:08:16 -06:00
StrCpy $cfg_line "id: $MinionName$\r$\n" # write the minion config setting
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
StrCpy $ConfigWriteMinion 0 # minion value written to config
${EndIf} # close if statement
${EndIf} # close if statement
2025-02-28 09:56:35 -07:00
ClearErrors
${LogMsg} "Writing config line(s) to temp file"
# Enable this line for troubleshooting
# ${LogMsg} "cfg_line: $cfg_line"
FileWrite $tmp_file $cfg_line # write changed or unchanged line to temp file
${If} ${Errors}
${LogMsg} "There was an error writing new config line(s) to temp file"
Goto update_minion_config_finished
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${If} $lst_check == 1 # master not written to the config
StrCpy $cfg_line $chk_line
Goto loop_after_read # A loop was performed, skip the next read
${EndIf} # close if statement
Goto loop # check the next line in the config file
2016-08-08 23:23:04 +00:00
done:
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
ClearErrors
# Does master config still need to be written
${If} $ConfigWriteMaster == 1 # master not written to the config
2025-02-28 09:56:35 -07:00
${LogMsg} "Master not found in existing config. Appending to the bottom"
${Explode} $9 "," $MasterHost # split the hostname on commas, $9 is the number of items found
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${If} $9 == 1 # 1 means only a single master was passed
2021-06-25 16:08:16 -06:00
StrCpy $cfg_line "master: $MasterHost" # write the master
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${Else} # make a multi-master entry
StrCpy $cfg_line "master:" # make the first line "master:"
loop_explode_2: # start a loop to go through the list in the config
pop $8 # pop the next item off the stack
${Trim} $8 $8 # trim any whitespace
StrCpy $cfg_line "$cfg_line$\r$\n - $8" # add it to the master variable ($2)
IntOp $9 $9 - 1 # decrement the list count
${If} $9 >= 1 # if it's not 0
Goto loop_explode_2 # do it again
${EndIf} # close if statement
${EndIf} # close if statement
2025-02-28 09:56:35 -07:00
ClearErrors
${LogMsg} "Writing master config to temp file"
FileWrite $tmp_file $cfg_line # write changed or unchanged line to temp file
${If} ${Errors}
${LogMsg} "There was an error writing master config to the temp file"
${LogMsg} "cfg_line: $cfg_line"
Goto update_minion_config_finished
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${EndIf} # close if statement
${If} $ConfigWriteMinion == 1 # minion ID not written to the config
2025-02-28 09:56:35 -07:00
${LogMsg} "Minion ID not found in existing config. Appending to the bottom"
2021-06-25 16:08:16 -06:00
StrCpy $cfg_line "$\r$\nid: $MinionName" # write the minion config setting
2025-02-28 09:56:35 -07:00
ClearErrors
${LogMsg} "Writing minion id to temp config file"
FileWrite $tmp_file $cfg_line # write changed or unchanged line to temp file
${If} ${Errors}
${LogMsg} "There was an error writing minion id to temop config file"
${LogMsg} "cfg_line: $cfg_line"
Goto update_minion_config_finished
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
${EndIf} # close if statement
2025-02-28 09:56:35 -07:00
${LogMsg} "Closing config files"
FileClose $tgt_file # close target file
FileClose $tmp_file # close temp file
${LogMsg} "Deleting target config"
2021-06-08 10:32:12 -06:00
Delete "$RootDir\conf\minion" # delete target file
2025-02-28 09:56:35 -07:00
${LogMsg} "Copying new target config"
2021-06-08 10:32:12 -06:00
CopyFiles /SILENT $R0 "$RootDir\conf\minion" # copy temp file to target file
2025-02-28 09:56:35 -07:00
${LogMsg} "Deleting old temp file"
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
Delete $R0 # delete temp file
2016-08-08 23:23:04 +00:00
2025-02-28 09:56:35 -07:00
update_minion_config_finished:
${LogMsg} "Update minion config finished"
2016-08-08 23:23:04 +00:00
FunctionEnd
2021-06-08 10:32:12 -06:00
Function un.parseUninstallerCommandLineSwitches
2025-02-28 09:56:35 -07:00
${LogMsg} "Parsing command line parameters for the Uninstaller"
2021-06-08 10:32:12 -06:00
# Load the parameters
2025-02-28 09:56:35 -07:00
${GetParameters} $cmdLineParams
2021-06-08 10:32:12 -06:00
# Uninstaller: Remove Installation Directory
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking /delete-install-dir"
2021-06-08 10:32:12 -06:00
ClearErrors
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/delete-install-dir" $R1
${If} ${Errors}
${LogMsg} "/delete-install-dir not found"
${Else}
${LogMsg} "Found /delete-install-dir"
StrCpy $DeleteInstallDir 1
${EndIf}
2021-06-08 10:32:12 -06:00
# Uninstaller: Remove Root Directory
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking /delete-root-dir"
2021-06-08 10:32:12 -06:00
ClearErrors
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/delete-root-dir" $R1
${If} ${Errors}
${LogMsg} "/delete-root-dir not found"
${Else}
${LogMsg} "Found /delete-root-dir"
StrCpy $DeleteRootDir 1
${EndIf}
2021-06-08 10:32:12 -06:00
FunctionEnd
Function parseInstallerCommandLineSwitches
2016-08-08 23:23:04 +00:00
2025-02-28 09:56:35 -07:00
${LogMsg} "Parsing command line parameters for the Installer"
2025-02-28 09:56:35 -07:00
# Load the parameters
${GetParameters} $cmdLineParams
${LogMsg} "Passed: $cmdLineParams"
2017-09-12 12:49:20 -06:00
# Check for start-minion switches
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /start-minion"
${GetOptions} $cmdLineParams "/start-minion=" $R1
${IfNot} $R1 == ""
${LogMsg} "Found /start-minion=$R1"
2017-09-12 12:49:20 -06:00
# If start-minion was passed something, then set it
2016-08-08 23:23:04 +00:00
StrCpy $StartMinion $R1
${Else}
2017-09-12 12:49:20 -06:00
# Otherwise default to 1
2025-02-28 09:56:35 -07:00
${LogMsg} "/start-minion not found. Using default"
2016-08-08 23:23:04 +00:00
StrCpy $StartMinion 1
${EndIf}
2017-03-31 15:12:41 -06:00
# Service: Minion Startup Type Delayed
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /start-minion-delayed"
2017-09-12 12:49:20 -06:00
ClearErrors
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/start-minion-delayed" $R1
${If} ${Errors}
${LogMsg} "/start-minion-delayed not found"
${Else}
${LogMsg} "Found /start-minion-delayed"
StrCpy $StartMinionDelayed 1
${EndIf}
# Set default value for Use Existing Config
StrCpy $ConfigType "Existing Config"
2016-08-08 23:23:04 +00:00
# Minion Config: Master IP/Name
# If setting master, we don't want to use existing config
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /master"
${GetOptions} $cmdLineParams "/master=" $R1
${If} ${Errors}
${LogMsg} "/master= not found. Using default"
StrCpy $MasterHost "salt"
${ElseIfNot} $R1 == ""
${LogMsg} "Found /master=$R1"
2021-06-25 16:08:16 -06:00
StrCpy $MasterHost $R1
StrCpy $ConfigType "Default Config"
2025-02-28 09:56:35 -07:00
${Else}
${LogMsg} "/master found, but value not passed. Using default value"
2021-06-25 16:08:16 -06:00
StrCpy $MasterHost "salt"
2016-08-08 23:23:04 +00:00
${EndIf}
# Minion Config: Minion ID
# If setting minion id, we don't want to use existing config
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /minion-name"
${GetOptions} $cmdLineParams "/minion-name=" $R1
${If} ${Errors}
${LogMsg} "/minion-name= not found. Using default"
StrCpy $MinionName "hostname"
${ElseIfNot} $R1 == ""
${LogMsg} "Found /minion-name=$R1"
2021-06-25 16:08:16 -06:00
StrCpy $MinionName $R1
StrCpy $ConfigType "Default Config"
2025-02-28 09:56:35 -07:00
${Else}
${LogMsg} "/minion-name= found, but value not passed. Using default"
2021-06-25 16:08:16 -06:00
StrCpy $MinionName "hostname"
2016-08-08 23:23:04 +00:00
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Use Default Config
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /default-config"
2021-06-08 10:32:12 -06:00
ClearErrors
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/default-config" $R1
${If} ${Errors}
${LogMsg} "/default-config not found"
${Else}
${LogMsg} "Found /default-config"
StrCpy $ConfigType "Default Config"
${EndIf}
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Use Custom Config
# Set default value for Use Custom Config
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /custom-config"
Add ability to pass custom config - Adds `/custom-config=` switch where you can pass the name of the custom config file that resides in the same directory as the installer or the full path to a custom config in another location - Changes from using `/use-existing-config` to `/default-config` since existing config is default anyway - If you pass a minion or master setting, the default is to use the default config - Passing minion or master settins will modify the default config or the custom config - Changed from using a checkbox to denote existing config to a drop down box to denote the type of config to use. Options are `Default Config`, `Existing Config`, and `Custom Config` - `Existing Config` is only added to the drop down if an existing config is found on the system. - Adds a file picker to the config dialog that allows you to browse to the custom config. The file picker is only displayed when the config type is `Custom Config` - Improves the writing of multimaster settings to the default or custom config. If multimaster is configured in the custom config and the user passes multiple master settings those settings are written properly - If there is an existing config and the config type is NOT `Existing Config`, the existing config is backed up (given the .bak extension) instead of deleted. This includes the `minion.d` directory. - If "/custom-config` is passed from the command line but the specified file does not exist, the installer just ends instead of uninstalling salt. (This is for Silent installations) - If the Config Specified in the GUI does not exist, the installer will not continue until a valid file is specified. - Changes the `/passive` switch in the vcredist installation to `/quiet` for installation on headless systems.
2017-12-19 10:28:52 -07:00
# Existing config will get a `.bak` extension
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/custom-config=" $R1
${If} ${Errors}
${LogMsg} "/custom-config= not found"
StrCpy $CustomConfig ""
${ElseIfNot} $R1 == ""
${LogMsg} "Found /custom-config=$R1"
2021-06-25 16:08:16 -06:00
StrCpy $CustomConfig $R1
StrCpy $ConfigType "Custom Config"
2025-02-28 09:56:35 -07:00
${Else}
${LogMsg} "/custom-config= found, but value not passed"
StrCpy $CustomConfig ""
${EndIf}
2021-06-08 10:32:12 -06:00
# Set Install Location
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /install-dir"
2021-06-08 10:32:12 -06:00
ClearErrors
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/install-dir=" $R1
${If} ${Errors}
${LogMsg} "/install-dir= not found"
StrCpy $CustomLocation ""
${ElseIfNot} $R1 == ""
2021-06-08 10:32:12 -06:00
# A Custom Location was passed, set it
2025-02-28 09:56:35 -07:00
${LogMsg} "Found /install-dir=$R1"
2021-06-08 10:32:12 -06:00
StrCpy $CustomLocation $R1
2025-02-28 09:56:35 -07:00
${Else}
${LogMsg} "/install-dir= found, but value not passed"
StrCpy $CustomConfig ""
2021-06-08 10:32:12 -06:00
${EndIf}
2021-06-25 16:08:16 -06:00
# Set Move Config Option
2025-02-28 09:56:35 -07:00
${LogMsg} "Checking for /move-config"
2021-06-25 16:08:16 -06:00
ClearErrors
2025-02-28 09:56:35 -07:00
${GetOptions} $cmdLineParams "/move-config" $R1
${If} ${Errors}
${LogMsg} "/move-config not found"
StrCpy $MoveExistingConfig 0
${Else}
${LogMsg} "Found /move-config"
StrCpy $MoveExistingConfig 1
${EndIf}
2021-06-25 16:08:16 -06:00
2016-08-08 23:23:04 +00:00
FunctionEnd