copy mods from current location

pull/725/head
Romain 2024-09-30 23:40:36 +02:00
parent 11274e0463
commit 6de09166e8
3 changed files with 21 additions and 4 deletions

View File

@ -2,6 +2,7 @@
param( param(
[Parameter(Mandatory = $false)] [string] $AppListPath, [Parameter(Mandatory = $false)] [string] $AppListPath,
[Parameter(Mandatory = $false)] [string] $InstallPath, [Parameter(Mandatory = $false)] [string] $InstallPath,
[Parameter(Mandatory = $false)] [string] $CurrentDir,
[Parameter(Mandatory = $false)] [string] $Upgrade, [Parameter(Mandatory = $false)] [string] $Upgrade,
[Parameter(Mandatory = $False)] [Switch] $Uninstall = $false [Parameter(Mandatory = $False)] [Switch] $Uninstall = $false
) )
@ -9,6 +10,7 @@ param(
#For troubleshooting #For troubleshooting
Write-Output "AppListPath: $AppListPath" Write-Output "AppListPath: $AppListPath"
Write-Output "InstallPath: $InstallPath" Write-Output "InstallPath: $InstallPath"
Write-Output "CurrentDir: $CurrentDir"
Write-Output "Upgrade: $Upgrade" Write-Output "Upgrade: $Upgrade"
Write-Output "Uninstall: $Uninstall" Write-Output "Uninstall: $Uninstall"
@ -120,6 +122,13 @@ function Install-WingetAutoUpdate {
Copy-Item -Path $AppListPath -Destination $InstallPath Copy-Item -Path $AppListPath -Destination $InstallPath
} }
#Copy Mods to install folder
$ModsFolder = Join-Path $CurrentDir "Mods"
if (Test-Path $ModsFolder) {
Write-Output "-> Copying $ModsFolder to $InstallPath\mods"
Copy-Item -Path $ModsFolder -Destination "$InstallPath\mods" -Recurse
}
#Secure folders if not installed to ProgramFiles #Secure folders if not installed to ProgramFiles
if ($InstallPath -notlike "$env:ProgramFiles*") { if ($InstallPath -notlike "$env:ProgramFiles*") {
@ -157,7 +166,7 @@ function Install-WingetAutoUpdate {
#Add 1 to Github counter file #Add 1 to Github counter file
try { try {
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUconfig.ProductVersion)/WAU_InstallCounter" | Out-Null Invoke-WebRequest -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUconfig.ProductVersion)/WAU_InstallCounter" -UseBasicParsing | Out-Null
Write-Host "-> Reported installation." Write-Host "-> Reported installation."
} }
catch { catch {

View File

@ -11,9 +11,14 @@ function Update-WAU {
#Run WAU update #Run WAU update
try { try {
#Download the msi
Write-ToLog "Downloading the GitHub Repository version $WAUAvailableVersion" "Cyan" Write-ToLog "Downloading the GitHub Repository version $WAUAvailableVersion" "Cyan"
$MsiFile = "$env:temp\WAU.msi"
#Create an unpredictable temp folder for security reasons
$MsiFolder = "$env:temp\WAU_$(Get-Date -Format yyyyMMddHHmmss)"
New-Item -ItemType Directory -Path $MsiFolder
#Download the msi
$MsiFile = Join-Path $MsiFolder "WAU.msi"
Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.msi" -OutFile $MsiFile Invoke-RestMethod -Uri "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$($WAUAvailableVersion)/WAU.msi" -OutFile $MsiFile
#Update WAU #Update WAU
@ -27,6 +32,9 @@ function Update-WAU {
$MessageType = "success" $MessageType = "success"
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text
#Remove temp folder and content
Remove-Item $MsiFolder -Recurse -Force
exit 0 exit 0
} }

View File

@ -251,7 +251,7 @@
<SetProperty Id="MAXLOGSIZE_VALUE" After="AppSearch" Value="#[MAXLOGSIZE]" Condition="MAXLOGSIZE" /> <SetProperty Id="MAXLOGSIZE_VALUE" After="AppSearch" Value="#[MAXLOGSIZE]" Condition="MAXLOGSIZE" />
<SetProperty Action="SetUPDATEPRERELEASE_0" Id="UPDATEPRERELEASE" After="AppSearch" Value="0" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE &lt;&gt; &quot;#1&quot;)" /> <SetProperty Action="SetUPDATEPRERELEASE_0" Id="UPDATEPRERELEASE" After="AppSearch" Value="0" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetUPDATEPRERELEASE_1" Id="UPDATEPRERELEASE" After="AppSearch" Value="1" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE = &quot;#1&quot;)" /> <SetProperty Action="SetUPDATEPRERELEASE_1" Id="UPDATEPRERELEASE" After="AppSearch" Value="1" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE = &quot;#1&quot;)" />
<SetProperty Id="CA_PowerShell_Install" Before="CA_PowerShell_Install" Sequence="execute" Value="&quot;[%SystemDrive]\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot;" /> <SetProperty Id="CA_PowerShell_Install" Before="CA_PowerShell_Install" Sequence="execute" Value="&quot;[%SystemDrive]\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot; -CurrentDir &quot;[CURRENTDIRECTORY]&quot;" />
<SetProperty Id="CA_PowerShell_Uninstall" Before="CA_PowerShell_Uninstall" Sequence="execute" Value="&quot;[%SystemDrive]\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot; -Upgrade &quot;#[UPGRADINGPRODUCTCODE]&quot; -Uninstall" /> <SetProperty Id="CA_PowerShell_Uninstall" Before="CA_PowerShell_Uninstall" Sequence="execute" Value="&quot;[%SystemDrive]\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot; -Upgrade &quot;#[UPGRADINGPRODUCTCODE]&quot; -Uninstall" />
<!-- Custom Actions --> <!-- Custom Actions -->