Merge pull request #327 from Romanitho/dev

Remove useless regkeys
pull/328/head
Romain 2023-04-22 15:40:14 +02:00 committed by GitHub
commit 16f2b9660a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View File

@ -64,15 +64,13 @@ jobs:
id: WAU_version id: WAU_version
run: | run: |
echo "Next Release version: ${{ steps.versioning.outputs.version }}" echo "Next Release version: ${{ steps.versioning.outputs.version }}"
echo "PowerShell format version: ${{ steps.versioning.outputs.version }}" | tr '-' '.'
echo PSVersion=$(echo '${{ steps.versioning.outputs.version }}' | tr '-' '.') >> $GITHUB_OUTPUT
- name: Overwrite Version.txt file - name: Overwrite Version.txt file
uses: DamianReeves/write-file-action@v1.2 uses: DamianReeves/write-file-action@v1.2
with: with:
path: Winget-AutoUpdate/Version.txt path: Winget-AutoUpdate/Version.txt
write-mode: overwrite write-mode: overwrite
contents: ${{ steps.WAU_version.outputs.PSVersion }} contents: ${{ steps.versioning.outputs.version }}
- name: Commit & Push - name: Commit & Push
uses: actions-js/push@v1.4 uses: actions-js/push@v1.4

View File

@ -340,8 +340,6 @@ function Install-WingetAutoUpdate {
New-ItemProperty $regPath -Name QuietUninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WingetUpdatePath\WAU-Uninstall.ps1`"" -Force | Out-Null New-ItemProperty $regPath -Name QuietUninstallString -Value "powershell.exe -noprofile -executionpolicy bypass -file `"$WingetUpdatePath\WAU-Uninstall.ps1`"" -Force | Out-Null
New-ItemProperty $regPath -Name NoModify -Value 1 -Force | Out-Null New-ItemProperty $regPath -Name NoModify -Value 1 -Force | Out-Null
New-ItemProperty $regPath -Name NoRepair -Value 1 -Force | Out-Null New-ItemProperty $regPath -Name NoRepair -Value 1 -Force | Out-Null
New-ItemProperty $regPath -Name VersionMajor -Value ([version]$WAUVersion).Major -Force | Out-Null
New-ItemProperty $regPath -Name VersionMinor -Value ([version]$WAUVersion).Minor -Force | Out-Null
New-ItemProperty $regPath -Name Publisher -Value "Romanitho" -Force | Out-Null New-ItemProperty $regPath -Name Publisher -Value "Romanitho" -Force | Out-Null
New-ItemProperty $regPath -Name URLInfoAbout -Value "https://github.com/Romanitho/Winget-AutoUpdate" -Force | Out-Null New-ItemProperty $regPath -Name URLInfoAbout -Value "https://github.com/Romanitho/Winget-AutoUpdate" -Force | Out-Null
New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $NotificationLevel -Force | Out-Null New-ItemProperty $regPath -Name WAU_NotificationLevel -Value $NotificationLevel -Force | Out-Null

View File

@ -157,13 +157,11 @@ function Invoke-PostUpdateActions {
Write-ToLog "-> Error: The mods directory couldn't be verified as secured!" "red" Write-ToLog "-> Error: The mods directory couldn't be verified as secured!" "red"
} }
#Convert about.xml if exists (previous WAU versions) to reg #Convert about.xml if exists (old WAU versions) to reg
$WAUAboutPath = "$WorkingDir\config\about.xml" $WAUAboutPath = "$WorkingDir\config\about.xml"
if (test-path $WAUAboutPath) { if (test-path $WAUAboutPath) {
[xml]$About = Get-Content $WAUAboutPath -Encoding UTF8 -ErrorAction SilentlyContinue [xml]$About = Get-Content $WAUAboutPath -Encoding UTF8 -ErrorAction SilentlyContinue
New-ItemProperty $regPath -Name DisplayVersion -Value $About.app.version -Force New-ItemProperty $regPath -Name DisplayVersion -Value $About.app.version -Force
New-ItemProperty $regPath -Name VersionMajor -Value ([version]$About.app.version).Major -Force
New-ItemProperty $regPath -Name VersionMinor -Value ([version]$About.app.version).Minor -Force
#Remove file once converted #Remove file once converted
Remove-Item $WAUAboutPath -Force -Confirm:$false Remove-Item $WAUAboutPath -Force -Confirm:$false
@ -205,6 +203,17 @@ function Invoke-PostUpdateActions {
} }
} }
#Remove old registry key
$RegistryKeys = @(
"VersionMajor",
"VersionMinor"
)
foreach ($RegistryKey in $RegistryKeys) {
if (Get-ItemProperty -Path $regPath -Name $RegistryKey -ErrorAction SilentlyContinue) {
Remove-ItemProperty -Path $regPath -Name $RegistryKey
}
}
#Reset WAU_UpdatePostActions Value #Reset WAU_UpdatePostActions Value
$WAUConfig | New-ItemProperty -Name WAU_PostUpdateActions -Value 0 -Force $WAUConfig | New-ItemProperty -Name WAU_PostUpdateActions -Value 0 -Force