Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3006.x] Don't remove extras dir on uninstall #65038

Merged
merged 7 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/64957.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed uninstaller to not remove the `salt` directory by default. This allows
the `extras-3.##` folder to persist so salt-pip dependencies are not wiped out
during an upgrade.
2 changes: 1 addition & 1 deletion pkg/windows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ param(

[Parameter(Mandatory=$false)]
[Alias("r")]
[String] $RelenvVersion = "0.12.3",
[String] $RelenvVersion = "0.13.4",

[Parameter(Mandatory=$false)]
[Alias("b")]
Expand Down
2 changes: 1 addition & 1 deletion pkg/windows/build_python.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ param(

[Parameter(Mandatory=$false)]
[Alias("r")]
[String] $RelenvVersion = "0.12.3",
[String] $RelenvVersion = "0.13.4",

[Parameter(Mandatory=$false)]
[ValidateSet("x64", "x86", "amd64")]
Expand Down
36 changes: 21 additions & 15 deletions pkg/windows/nsis/installer/Salt-Minion-Setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -1109,9 +1109,10 @@ Function ${un}uninstallSalt
${EndIf}

# Remove files
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\ssm.exe"
Delete "$INSTDIR\multi-minion*"
Delete "$INSTDIR\salt*"
Delete "$INSTDIR\ssm.exe"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\vcredist.exe"
RMDir /r "$INSTDIR\DLLs"
RMDir /r "$INSTDIR\Include"
Expand Down Expand Up @@ -1189,6 +1190,20 @@ Function ${un}uninstallSalt

${Else}

# 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
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_USERICON \
"Would you like to completely remove the entire Salt \
Installation? This includes the following:$\n\
- Extra Pip Packages ($INSTDIR\extras-3.##)$\n\
- Minion Config ($RootDir\conf)$\n\
- Minion PKIs ($RootDir\conf\pki)"\
/SD IDNO IDNO finished
${EndIf}

# New Method Installation
# This makes the $APPDATA variable point to the ProgramData folder instead
# of the current user's roaming AppData folder
Expand All @@ -1214,8 +1229,8 @@ Function ${un}uninstallSalt
# Only delete Salt Project directory if it's in Program Files
# Otherwise, we can't guess where the user may have installed salt
${GetParent} $INSTDIR $0 # Get parent directory (Salt Project)
${If} $0 == "$ProgramFiles\Salt Project" # Make sure it's not ProgramFiles
${OrIf} $0 == "$ProgramFiles64\Salt Project" # Make sure it's not Program Files (x86)
${If} $0 == "$ProgramFiles\Salt Project" # Make sure it's ProgramFiles
${OrIf} $0 == "$ProgramFiles64\Salt Project" # Make sure it's Program Files (x86)
SetOutPath "$SysDrive" # Can't remove CWD
RMDir /r $0
${EndIf}
Expand All @@ -1228,15 +1243,6 @@ Function ${un}uninstallSalt
# Expand any environment variables
ExpandEnvStrings $RootDir $RootDir

# Prompt for the removal of the Root Directory which contains the config
# and pki directories
${IfNot} $DeleteRootDir == 1
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_USERICON \
"Would you like to completely remove the Root Directory \
($RootDir) and all of its contents?" \
/SD IDNO IDNO finished
${EndIf}

# Remove the Salt Project directory in ProgramData
# The Salt Project directory will only ever be in ProgramData
# It is not user selectable
Expand Down Expand Up @@ -1837,8 +1843,8 @@ Function un.parseUninstallerCommandLineSwitches
$\n$\t$\tare the same (C:\salt)\
$\n\
$\n/delete-root-dir$\tDelete the root directory that contains the config\
$\n$\t$\tand pki directories. Default is to not delete the root\
$\n$\t$\tdirectory\
$\n$\t$\tand pki directories. Also removes the installation directory\
$\n$\t$\tincluding the extras directory. Default is to not delete\
$\n\
$\n$\t$\tThis applies to new method installations where the\
$\n$\t$\troot directory is in ProgramData and the installation\
Expand Down