From e3a12c0d47efb2165703467a71884c869dd06446 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 27 Sep 2023 12:32:04 +0200 Subject: [PATCH] Create a script for managing generic apps --- scripts/Windows/Collections/Generic.ps1 | 97 ++++++++++++++++++++++++ scripts/Windows/Collections/Personal.ps1 | 64 +--------------- 2 files changed, 101 insertions(+), 60 deletions(-) create mode 100644 scripts/Windows/Collections/Generic.ps1 diff --git a/scripts/Windows/Collections/Generic.ps1 b/scripts/Windows/Collections/Generic.ps1 new file mode 100644 index 00000000..04a6c40b --- /dev/null +++ b/scripts/Windows/Collections/Generic.ps1 @@ -0,0 +1,97 @@ +#!/bin/pwsh +. "$PSScriptRoot/../Scripts/Context.ps1"; +. "$PSScriptRoot/../Scripts/SoftwarePackage.ps1"; +. "$PSScriptRoot/../Software/Firefox/Install.ps1"; +. "$PSScriptRoot/../Software/git/Manage.ps1"; +. "$PSScriptRoot/../Software/LGHub/Manage.ps1"; +. "$PSScriptRoot/../Software/ManiaPlanet/Manage.ps1"; +. "$PSScriptRoot/../Software/osu!/Manage.ps1"; +. "$PSScriptRoot/../Software/osu!lazer/Manage.ps1"; +. "$PSScriptRoot/../Software/PuTTY/Manage.ps1"; +. "$PSScriptRoot/../Software/RetroArch/Manage.ps1"; +. "$PSScriptRoot/../Software/reWASD/Manage.ps1"; +. "$PSScriptRoot/../Software/TrackMania Nations Forever/Manage.ps1"; +. "$PSScriptRoot/../Software/TrackMania United Forever/Manage.ps1"; +. "$PSScriptRoot/../Software/VisualStudio/Manage.ps1"; + +function Backup-GenericApps([Context] $context) { + Backup-Git $context; + Backup-PuTTY $context; +} + +function Restore-GenericApps([Context] $context) { + # Device specific + if ((Get-Command Install-PersonalDrivers -ErrorAction SilentlyContinue)) { + Write-Information "Driver installation function was found. Starting installation"; + Install-PersonalDrivers $context; + } + + # Backed up applications + Restore-Git $context; + Restore-PuTTY $context; + + # Design + choco install -y ` + nerd-fonts-CascadiaCode; + + # Browsing + Install-Firefox $context; + . "$PSScriptRoot/../Software/MSEdgeRedirect/Install.ps1"; + + winget install --accept-source-agreements --accept-package-agreements ` + -e --id Mozilla.Firefox.DeveloperEdition ` + -e --id Mozilla.Firefox.Nightly ` + -e --id Brave.Brave ` + -e --id Brave.Brave.Beta ` + -e --id Brave.Brave.Nightly; + + $context.RemoveTaskbarItem("*Firefox*"); + $context.RemoveDesktopIcon("*Brave*"); + $context.RemoveTaskbarItem("*Brave*"); + + choco install -y ` + 7zip ` + chocolateygui ` + DefaultProgramsEditor ` + bitwarden ` + keepass ` + procexp ` + procmon; + + winget install --accept-source-agreements --accept-package-agreements ` + -e --id KDE.KDEConnect; + + # Media + choco install -y k-litecodecpackmega; + + # Coding + choco install -y --params "/NoDesktopIcon" vscode vscode-insiders; + choco install -y --params "/NoDesktopIcon /AssociateWithFiles" vscodium; + winget install --scope machine --accept-source-agreements --accept-package-agreements -e --id VSCodium.VSCodium.Insiders --override '/VerySilent /MergeTasks="!runCode,quicklaunchicon,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"'; + + choco install -y ` + gh ` + github-desktop; + + $context.RemoveDesktopIcon("GitHub*"); + + choco install -y ` + python ` + visualstudio2019-workload-vctools; + + . "$PSScriptRoot/../Software/NVS/Install.ps1"; + + # Terminal + @($PROFILE, (powershell -c '$PROFILE')) | ForEach-Object { + Get-Item "$(Split-Path -Parent $_)/profile.d/*Oh My Posh*"; + } | ForEach-Object { + $oldContent = Get-Content $_; + + $oldContent | ForEach-Object { + $indicator = "oh-my-posh init"; + $_ -replace $indicator,"$indicator --config ~/Nextcloud/.omp/manuel.omp.json"; + } | Set-Content $_; + } + + $context.RemoveDesktopIcon("*Microsoft Edge*"); +} diff --git a/scripts/Windows/Collections/Personal.ps1 b/scripts/Windows/Collections/Personal.ps1 index b0f60073..5e5fa116 100644 --- a/scripts/Windows/Collections/Personal.ps1 +++ b/scripts/Windows/Collections/Personal.ps1 @@ -1,5 +1,6 @@ #!/bin/pwsh . "$PSScriptRoot/../Scripts/Context.ps1"; +. "$PSScriptRoot/Generic.ps1"; . "$PSScriptRoot/../Scripts/SoftwarePackage.ps1"; . "$PSScriptRoot/../Software/Firefox/Install.ps1"; . "$PSScriptRoot/../Software/git/Manage.ps1"; @@ -15,12 +16,11 @@ . "$PSScriptRoot/../Software/VisualStudio/Manage.ps1"; function Backup-PersonalApps([Context] $context) { - Backup-Git $context; + Backup-GenericApps $context; Backup-LogitechGHUB $context; Backup-ManiaPlanet $context; Backup-Osu $context; Backup-OsuLazer $context; - Backup-PuTTY $context; Backup-RetroArch $context; Backup-reWASD $context; Backup-TmNations $context; @@ -29,29 +29,17 @@ function Backup-PersonalApps([Context] $context) { } function Restore-PersonalApps([Context] $context) { - # Device specific - if ((Get-Command Install-PersonalDrivers -ErrorAction SilentlyContinue)) { - Write-Information "Driver installation function was found. Starting installation"; - Install-PersonalDrivers $context; - } - # Backed up applications - Restore-Git $context; Restore-LogitechGHUB $context; Restore-TmNations $context; Restore-TmUnited $context; Restore-ManiaPlanet $context; Restore-Osu $context; Restore-OsuLazer $context; - Restore-PuTTY $context; Restore-RetroArch $context; Restore-reWASD $context; Restore-VisualStudio $context; - # Design - choco install -y ` - nerd-fonts-CascadiaCode; - # Social Media choco install -y ` signal; @@ -66,30 +54,10 @@ function Restore-PersonalApps([Context] $context) { $context.RemoveDesktopIcon("*Element*"); $context.RemoveDesktopIcon("*TeamSpeak*"); - # Browsing - Install-Firefox $context; - . "$PSScriptRoot/../Software/MSEdgeRedirect/Install.ps1"; - - winget install --accept-source-agreements --accept-package-agreements ` - -e --id Mozilla.Firefox.DeveloperEdition ` - -e --id Mozilla.Firefox.Nightly ` - -e --id Brave.Brave ` - -e --id Brave.Brave.Beta ` - -e --id Brave.Brave.Nightly; - - $context.RemoveTaskbarItem("*Firefox*"); - $context.RemoveDesktopIcon("*Brave*"); - $context.RemoveTaskbarItem("*Brave*"); - # Tools Install-SoftwarePackage $context "https://github.com/mRemoteNG/mRemoteNG/releases/download/2023.03.03-v1.77.3-nb/mRemoteNG-Installer-1.77.3.nb-1784.msi" @("/Quiet"); choco install -y ` - 7zip ` - chocolateygui ` - DefaultProgramsEditor ` - bitwarden ` - keepass ` gimp ` gpu-z ` windirstat ` @@ -102,13 +70,10 @@ function Restore-PersonalApps([Context] $context) { krita ` MetaX ` obs-studio ` - openvpn ` - procexp ` - procmon; + openvpn; winget install --accept-source-agreements --accept-package-agreements ` - -e --id AntSoftware.AntRenamer ` - -e --id KDE.KDEConnect; + -e --id AntSoftware.AntRenamer; $context.RemoveDesktopIcon("GPU-Z*"); $context.RemoveDesktopIcon("WinDirStat*"); @@ -126,17 +91,12 @@ function Restore-PersonalApps([Context] $context) { # Media choco install -y ` jellyfin-media-player ` - k-litecodecpackmega ` vlc; winget install --accept-source-agreements --accept-package-agreements -e --id Ytmdesktop.Ytmdesktop; $context.RemoveDesktopIcon("YouTube Music*"); # Coding - choco install -y --params "/NoDesktopIcon" vscode vscode-insiders; - choco install -y --params "/NoDesktopIcon /AssociateWithFiles" vscodium; - winget install --scope machine --accept-source-agreements --accept-package-agreements -e --id VSCodium.VSCodium.Insiders --override '/VerySilent /MergeTasks="!runCode,quicklaunchicon,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"'; - choco install -y --ignore-checksums ` ida-free; @@ -145,13 +105,10 @@ function Restore-PersonalApps([Context] $context) { choco install -y ` HxD ` docker-desktop ` - gh ` - github-desktop ` imhex ` dotpeek; $context.RemoveDesktopIcon("Docker*"); - $context.RemoveDesktopIcon("GitHub*"); choco install -y ` python ` @@ -159,18 +116,6 @@ function Restore-PersonalApps([Context] $context) { . "$PSScriptRoot/../Software/NVS/Install.ps1"; - # Terminal - @($PROFILE, (powershell -c '$PROFILE')) | ForEach-Object { - Get-Item "$(Split-Path -Parent $_)/profile.d/*Oh My Posh*"; - } | ForEach-Object { - $oldContent = Get-Content $_; - - $oldContent | ForEach-Object { - $indicator = "oh-my-posh init"; - $_ -replace $indicator,"$indicator --config ~/Nextcloud/.omp/manuel.omp.json"; - } | Set-Content $_; - } - # Gaming choco install -y goggalaxy; @@ -194,5 +139,4 @@ function Restore-PersonalApps([Context] $context) { ppsspp; $context.RemoveDesktopIcon("PPSSPP *32-Bit*"); - $context.RemoveDesktopIcon("*Microsoft Edge*"); }