Skip to content

Commit

Permalink
Add download folder
Browse files Browse the repository at this point in the history
  • Loading branch information
voruti committed May 12, 2021
1 parent 179abde commit 7a46525
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.zip
*.exe
/download/
1 change: 1 addition & 0 deletions autoUpdate.preset
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Custom - myScript ###
CheckRunningPrograms
CreateDownloadFolder

UpdateCCleaner
UpdateKeePass
Expand Down
2 changes: 2 additions & 0 deletions init.preset
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ UnpinTaskbarIcons


### Custom - myScript ###
CreateDownloadFolder

DownloadFirefox
InstallFirefox
DownloadCCleaner
Expand Down
40 changes: 24 additions & 16 deletions myScript.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,28 @@ Function CheckRunningPrograms {
} while ($doWait)
}

# Create a download folder
Function CreateDownloadFolder {
Write-Output "Creating download folder..."
If (!(Test-Path -PathType Container "$PSScriptRoot\download")) {
New-Item -ItemType Directory -Path "$PSScriptRoot\download" -Force | Out-Null
}
}


# Download Firefox
Function DownloadFirefox {
Write-Output "Downloading Firefox..."
$programUrl = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=de"
$programOutput = "$PSScriptRoot\firefox_latest_ssl_win64_de.exe"
$programOutput = "$PSScriptRoot\download\firefox_latest_ssl_win64_de.exe"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}

# Install Firefox
Function InstallFirefox {
Write-Output "Installing previously downloaded Firefox..."
$programOutput = "$PSScriptRoot\firefox_latest_ssl_win64_de.exe"
$programOutput = "$PSScriptRoot\download\firefox_latest_ssl_win64_de.exe"

& $programOutput /DesktopShortcut=false /MaintenanceService=false; Wait-Process firefox_latest_ssl_win64_de
}
Expand All @@ -59,15 +67,15 @@ Function RemoveCCleaner {
Function DownloadCCleaner {
Write-Output "Downloading CCleaner..."
$programUrl = "https://download.ccleaner.com/portable/ccsetup579.zip" # https://www.ccleaner.com/de-de/ccleaner/builds
$programOutput = "$PSScriptRoot\ccsetup.zip"
$programOutput = "$PSScriptRoot\download\ccsetup.zip"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}

# Install CCleaner
Function InstallCCleaner {
Write-Output "Installing previously downloaded CCleaner..."
$programOutput = "$PSScriptRoot\ccsetup.zip"
$programOutput = "$PSScriptRoot\download\ccsetup.zip"
$programDirectory = [Environment]::GetFolderPath('MyDocuments') + "\CCleaner"

Add-Type -AssemblyName System.IO.Compression.FileSystem
Expand Down Expand Up @@ -99,15 +107,15 @@ Function DownloadKeePass {
Write-Output "Downloading KeePass..."
# $programUrl = "https://downloads.sourceforge.net/project/keepass/KeePass%202.x/2.47/KeePass-2.47.zip" # https://keepass.info/download.html
$programUrl = "https://sourceforge.net/projects/keepass/files/latest/download"
$programOutput = "$PSScriptRoot\KeePass.zip"
$programOutput = "$PSScriptRoot\download\KeePass.zip"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
}

# Install KeePass
Function InstallKeePass {
Write-Output "Installing previously downloaded KeePass..."
$programOutput = "$PSScriptRoot\KeePass.zip"
$programOutput = "$PSScriptRoot\download\KeePass.zip"
$programDirectory = [Environment]::GetFolderPath('MyDocuments') + "\KeePass"

Add-Type -AssemblyName System.IO.Compression.FileSystem
Expand Down Expand Up @@ -156,7 +164,7 @@ Function UpdateShutUp10 {
Function DownloadAvira {
Write-Output "Downloading Avira..."
$programUrl = "http://install.avira-update.com/package/antivirus/win/de-de/avira_antivirus_de-de.exe"
$programOutput = "$PSScriptRoot\avira_antivirus_de-de.exe"
$programOutput = "$PSScriptRoot\download\avira_antivirus_de-de.exe"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}
Expand All @@ -166,15 +174,15 @@ Function DownloadAvira {
Function DownloadNPP {
Write-Output "Downloading Notepad++..."
$programUrl = "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.portable.x64.zip" # https://github.com/notepad-plus-plus/notepad-plus-plus/releases/
$programOutput = "$PSScriptRoot\npp_portable_x64.zip"
$programOutput = "$PSScriptRoot\download\npp_portable_x64.zip"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}

# Install Notepad++
Function InstallNPP {
Write-Output "Installing previously downloaded Notepad++..."
$programOutput = "$PSScriptRoot\npp_portable_x64.zip"
$programOutput = "$PSScriptRoot\download\npp_portable_x64.zip"
$programDirectory = [Environment]::GetFolderPath('MyDocuments') + "\NotepadPP"

Add-Type -AssemblyName System.IO.Compression.FileSystem
Expand All @@ -193,15 +201,15 @@ Function RemoveVSCode {
Function DownloadVSCode {
Write-Output "Downloading VSCode..."
$programUrl = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-archive"
$programOutput = "$PSScriptRoot\VSCode.zip"
$programOutput = "$PSScriptRoot\download\VSCode.zip"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}

# Install VSCode
Function InstallVSCode {
Write-Output "Installing previously downloaded VSCode..."
$programOutput = "$PSScriptRoot\VSCode.zip"
$programOutput = "$PSScriptRoot\download\VSCode.zip"
$programDirectory = [Environment]::GetFolderPath('MyDocuments') + "\VSCode"

Add-Type -AssemblyName System.IO.Compression.FileSystem
Expand Down Expand Up @@ -239,15 +247,15 @@ Function RemoveGit {
Function DownloadGit {
Write-Output "Downloading Git..."
$programUrl = "https://github.com/git-for-windows/git/releases/download/v2.31.1.windows.1/PortableGit-2.31.1-64-bit.7z.exe"
$programOutput = "$PSScriptRoot\Git.7z.exe"
$programOutput = "$PSScriptRoot\download\Git.7z.exe"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}

# Install Git
Function InstallGit {
Write-Output "Installing previously downloaded Git..."
$programOutput = "$PSScriptRoot\Git.7z.exe"
$programOutput = "$PSScriptRoot\download\Git.7z.exe"
$programDirectory = [Environment]::GetFolderPath('MyDocuments') + "\Git"

Start-Process -Wait $programOutput -ArgumentList "-o`"$programDirectory`" -y"
Expand Down Expand Up @@ -299,17 +307,17 @@ Function RemoveMailCheck {
Function DownloadMailCheck {
Write-Output "Downloading MailCheck..."
$programUrl = "https://www.d-jan.de/MailCheck2Setup118Build512-64bit.exe" # https://www.d-jan.de/download.shtml
$programOutput = "$PSScriptRoot\MailCheck.exe"
$programOutput = "$PSScriptRoot\download\MailCheck.exe"

Invoke-WebRequest -Uri $programUrl -OutFile $programOutput
}

# Install MailCheck
Function InstallMailCheck {
Write-Output "Installing previously downloaded MailCheck..."
$programOutput = "$PSScriptRoot\MailCheck.exe"
$programOutput = "$PSScriptRoot\download\MailCheck.exe"
$programDirectory = [Environment]::GetFolderPath('MyDocuments') + "\MailCheck"
$programInf = "$PSScriptRoot\MailCheck.inf"
$programInf = "$PSScriptRoot\download\MailCheck.inf"

Set-Content $programInf "[Setup]`r`nSetupType=portable`r`nDir=$programDirectory"

Expand Down

0 comments on commit 7a46525

Please sign in to comment.