Skip to content

Add Windows installer scripts #32

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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
16 changes: 16 additions & 0 deletions .github/workflows/test-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,19 @@ jobs:
- uses: actions/checkout@v3
- name: Test Manjaro Gaming Install
run: sh test/archlinux/test.sh installers/manjaro_gaming_install_packages.sh

windows:
runs-on: windows-2022

steps:
- uses: actions/checkout@v3
- name: Test Windows Install
run: powershell.exe -executionpolicy bypass test/windows/test.ps1 installers/win_install_packages.ps1

windowsgaming:
runs-on: windows-2022

steps:
- uses: actions/checkout@v3
- name: Test Windows Gaming Install
run: powershell.exe -executionpolicy bypass test/windows/test.ps1 installers/wingaming_install_packages.ps1
8 changes: 8 additions & 0 deletions .github/workflows/test-setups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ jobs:
- uses: actions/checkout@v3
- name: Test Debian Bullseye Setup
run: sh test/debian/bullseye/test.sh installers/debian_setup.sh

windows:
runs-on: windows-2022

steps:
- uses: actions/checkout@v3
- name: Test Windows Setup
run: powershell.exe -executionpolicy bypass test/windows/test.ps1 installers/win_setup.ps1
20 changes: 20 additions & 0 deletions installers/packages/gameranger/win_install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$exe_path = "${env:TEMP}/gameranger.exe"

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Download GameRanger
Invoke-WebRequest -Uri "http://www.gameranger.com/download/GameRangerSetup.exe" `
-OutFile $exe_path

# Install GameRanger
$exe_path

exit $LASTEXITCODE
20 changes: 20 additions & 0 deletions installers/packages/surfshark/win_install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$exe_path = "${env:TEMP}/surfshark.exe"

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Download Surfshark
Invoke-WebRequest -Uri "https://downloads.surfshark.com/windows/latest/SurfsharkSetup.exe" `
-OutFile $exe_path

# Install Surfshark
$exe_path

exit $LASTEXITCODE
20 changes: 20 additions & 0 deletions installers/packages/wos/win_install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$exe_path = "${env:TEMP}/wos.exe"

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Download Well Of Souls
Invoke-WebRequest -Uri "http://www.synthetic-reality.us/WellOfSouls.exe" `
-OutFile $exe_path

# Install Well Of Souls
$exe_path

exit $LASTEXITCODE
26 changes: 26 additions & 0 deletions installers/packages/xournalpp/win_install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$tag = (Invoke-WebRequest "https://api.github.com/repos/xournalpp/xournalpp/releases/latest" | ConvertFrom-Json)[0].tag_name
$version = $version.substring(1)
$unzip_path = "${env:TEMP}/xournalpp"
$zip_path = "$unzip_path.zip"

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Download Xournalpp
Invoke-WebRequest -Uri "https://github.com/xournalpp/xournalpp/releases/download/$tag/xournalpp-$version-windows.zip" `
-OutFile $zip_path

# Extract Installer
Expand-Archive $zip_path -DestinationPath $unzip_path

# Install Xournalpp
"$unzip_path/xournalpp-$version-windows.exe"

exit $LASTEXITCODE
55 changes: 55 additions & 0 deletions installers/win_install_packages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$base_dir = (Get-Item $MyInvocation.MyCommand.Path).Directory.FullName

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Run base setup
powershell.exe -executionpolicy bypass "$base_dir/win_setup.ps1"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

# Update packages
winget upgrade -h --all

# Install packages
winget install -h 7zip.7zip Waterfox.Waterfox Microsoft.VisualStudioCode Microsoft.VisualStudio.2022.Community `
Microsoft.WindowsTerminal WinSCP.WinSCP GIMP.GIMP Adobe.Acrobat.Reader.64-bit TheDocumentFoundation.LibreOffice.LTS `
KDE.Kdenlive OBSProject.OBSStudio calibre.calibre KeePassXCTeam.KeePassXC VideoLAN.VLC DelugeTeam.Deluge Cyanfish.NAPS2 `
HandBrake.HandBrake Telegram.TelegramDesktop GuinpinSoft.MakeMKV SlackTechnologies.Slack Postman.Postman Microsoft.Skype `
AnyDeskSoftwareGmbH.AnyDesk Foundry376.Mailspring Zotero.Zotero Balena.Etcher Duplicati.Duplicati OpenVPNTechnologies.OpenVPN `
GnuPG.Gpg4win --source winget
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to install winget packages.'
exit $LASTEXITCODE
}

# Install WSL
wsl --install -d openSUSE-42
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to install WSL.'
exit $LASTEXITCODE
}

# Install Xournalpp
powershell.exe -executionpolicy bypass "$base_dir/packages/xournalpp/win_install.ps1"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Xournalpp failed to install.'
exit $LASTEXITCODE
}

# Install Surfshark
powershell.exe -executionpolicy bypass "$base_dir/packages/surfshark/win_install.ps1"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Surfshark failed to install.'
exit $LASTEXITCODE
}

# TODO: Add WSL install packages script.
46 changes: 46 additions & 0 deletions installers/win_setup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Check if winget is installed
try {
# Install git if winget is installed
winget install Git.Git --source winget
}
catch {
# If not, install winget then git
Write-Output 'winget is not installed, attempting install..'
$winget_version = (Invoke-WebRequest "https://api.github.com/repos/microsoft/winget-cli/releases/latest" | ConvertFrom-Json)[0].tag_name
$winget_package = "${env:TEMP}/winget.msixbundle"
Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli/releases/download/$winget_version/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" `
-OutFile $winget_package
Add-AppxPackage -Path $winget_package -Confirm

try {
winget install Git.Git --source
}
catch {
Write-Error 'winget did not install correctly'
exit 2
}
}

# Using git, download and install the Windows 10 Debloater scripts to debloat Windows
try {
$windebloater_root = "${env:TEMP}/windows10debloater"
git clone "https://github.com/Sycnex/Windows10Debloater.git" $windebloater_root
Set-ExecutionPolicy Unrestricted -Force
"$windebloater_root\Windows10SysPrepDebloater.ps1 -SysPrep -Debloat -Privacy"
exit $LASTEXITCODE
}
catch {
Write-Error 'git did not install correctly'
exit 3
}
50 changes: 50 additions & 0 deletions installers/wingaming_install_packages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env pwsh

# Variables
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$base_dir = (Get-Item $MyInvocation.MyCommand.Path).Directory.FullName

# Check if running as an administrator
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error 'Please run as administrator'
exit 1
}

# Run base setup
powershell.exe -executionpolicy bypass "$base_dir/win_setup.ps1"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

# Update packages
winget upgrade -h --all

# Install packages
winget install -h Waterfox.Waterfox Microsoft.WindowsTerminal OBSProject.OBSStudio `
Discord.Discord Valve.Steam ElectronicArts.EADesktop DolphinEmulator.Dolphin `
Mupen64.Mupen64 DOSBox.DOSBox Duplicati.Duplicati --source winget
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to install winget packages.'
exit $LASTEXITCODE
}

# Install Surfshark
powershell.exe -executionpolicy bypass "$base_dir/packages/surfshark/win_install.ps1"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Surfshark failed to install.'
exit $LASTEXITCODE
}

# Install GameRanger
powershell.exe -executionpolicy bypass "$base_dir/packages/gameranger/win_install.ps1"
if ($LASTEXITCODE -ne 0) {
Write-Error 'GameRanger failed to install.'
exit $LASTEXITCODE
}

# Install Well Of Souls
powershell.exe -executionpolicy bypass "$base_dir/packages/wos/win_install.ps1"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Well Of Souls failed to install.'
exit $LASTEXITCODE
}
14 changes: 14 additions & 0 deletions test/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM mcr.microsoft.com/windows/server:ltsc2022

ARG target
ARG script

COPY ${target} /target

WORKDIR /target

RUN powershell.exe -executionpolicy bypass ${script}

WORKDIR /

RUN powershell.exe -Command Remove-Item -Recurse /target
37 changes: 37 additions & 0 deletions test/windows/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env pwsh

# Check if script to test if specified
if (!$args[0]) {
Write-Error 'Please specify script to test.'
exit 1
}

$script = Resolve-Path -Path $args[0]
$target_dir = (Get-Item $script).Directory.FullName
$build_path = (Get-Item $MyInvocation.MyCommand.Path).Directory.FullName
$img = ([System.Environment]::UserName + "/" + (Get-Item $build_path).BaseName)
$tag = "testing"

# Copy target script to pwd
Copy-Item -Recurse $target_dir ($build_path + "/" + (Get-Item $target_dir).BaseName)

# Test build image with target script
$target_wkdir = (Get-Item $target_dir).BaseName
$target_script = (Get-Item $script).Name
docker build --no-cache --force-rm -t ($img + ":" + $tag) `
--build-arg target=$target_wkdir `
--build-arg script=$target_script `
$build_path

# Set build status code
$status = $LASTEXITCODE

# Remove testing image
docker rmi ($img + ":" + $tag)

# Remove target script from pwd
Remove-Item -Recurse ($build_path + "/" + (Get-Item $target_dir).BaseName)

# Exit with build status code
exit $status