Rename powershell command
This commit is contained in:
parent
8e4f0ccd9a
commit
9758a6428f
16 changed files with 35 additions and 35 deletions
|
@ -6,7 +6,7 @@ $null = New-Module {
|
||||||
Write-Host "Starting Backup of Windows";
|
Write-Host "Starting Backup of Windows";
|
||||||
$context = [Context]::new();
|
$context = [Context]::new();
|
||||||
$context.BackupName = $env:BACKUP_NAME ?? $(Read-Host -Prompt "Please enter a backup name");
|
$context.BackupName = $env:BACKUP_NAME ?? $(Read-Host -Prompt "Please enter a backup name");
|
||||||
Invoke-WindowsBackup $context;
|
Backup-WindowsInstallation $context;
|
||||||
Write-Host "Never forget to store the backup somewhere safe!";
|
Write-Host "Never forget to store the backup somewhere safe!";
|
||||||
Write-Host "I mean... what kind of a dumbass would ever forget to do so, right?";
|
Write-Host "I mean... what kind of a dumbass would ever forget to do so, right?";
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ function Invoke-WindowsInstallation([Context] $context)
|
||||||
{
|
{
|
||||||
Write-Host "Starting Installation and Restoration of Windows";
|
Write-Host "Starting Installation and Restoration of Windows";
|
||||||
. "$PSScriptRoot/../Scripts/Prerequisites.ps1";
|
. "$PSScriptRoot/../Scripts/Prerequisites.ps1";
|
||||||
Invoke-Upgrade $context;
|
Update-WindowsInstallation $context;
|
||||||
New-PersonalUser $context;
|
New-PersonalUser $context;
|
||||||
Invoke-WindowsRestore $context;
|
Restore-WindowsInstallation $context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,25 @@
|
||||||
. "$PSScriptRoot/../Software/TrackMania United Forever/Manage.ps1";
|
. "$PSScriptRoot/../Software/TrackMania United Forever/Manage.ps1";
|
||||||
. "$PSScriptRoot/../Software/VisualStudio/Manage.ps1";
|
. "$PSScriptRoot/../Software/VisualStudio/Manage.ps1";
|
||||||
|
|
||||||
function Invoke-WindowsBackup([Context] $context) {
|
function Backup-WindowsInstallation([Context] $context) {
|
||||||
Write-Information "Backing up Windows";
|
Write-Information "Backing up Windows";
|
||||||
$backupRoot = $context.BackupRoot();
|
$backupRoot = $context.BackupRoot();
|
||||||
Invoke-FileBackup $context;
|
Backup-PersonalFiles $context;
|
||||||
Invoke-BackupGit $context;
|
Backup-Git $context;
|
||||||
Invoke-BackupLGHub $context;
|
Backup-LogitechGHUB $context;
|
||||||
Invoke-BackupManiaPlanet $context;
|
Backup-ManiaPlanet $context;
|
||||||
Invoke-BackupOsu $context;
|
Backup-Osu $context;
|
||||||
Invoke-BackupOsuLazer $context;
|
Backup-OsuLazer $context;
|
||||||
Invoke-BackupPuTTY $context;
|
Backup-PuTTY $context;
|
||||||
Invoke-BackupRetroArch $context;
|
Backup-RetroArch $context;
|
||||||
Invoke-BackupReWASD $context;
|
Backup-reWASD $context;
|
||||||
Invoke-BackupTmNations $context;
|
Backup-TmNations $context;
|
||||||
Invoke-BackupTmUnited $context;
|
Backup-TmUnited $context;
|
||||||
Invoke-BackupVisualStudio $context;
|
Backup-VisualStudio $context;
|
||||||
$context.Backup($backupRoot, "$backupRoot.7z", @("-sdel"));
|
$context.Backup($backupRoot, "$backupRoot.7z", @("-sdel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-WindowsRestore([Context] $context) {
|
function Restore-WindowsInstallation([Context] $context) {
|
||||||
Write-Host "Restoring Windows";
|
Write-Host "Restoring Windows";
|
||||||
|
|
||||||
function Read-Path()
|
function Read-Path()
|
||||||
|
@ -59,8 +59,8 @@ function Invoke-WindowsRestore([Context] $context) {
|
||||||
$context.Restore($backupPath, $context.BackupRoot());
|
$context.Restore($backupPath, $context.BackupRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
Invoke-FileRestore $context;
|
Restore-PersonalFiles $context;
|
||||||
Invoke-RestoreGit $context;
|
Restore-Git $context;
|
||||||
|
|
||||||
Remove-Item -Recurse $context.RootDir;
|
Remove-Item -Recurse $context.RootDir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
. "$PSScriptRoot/../Scripts/Context.ps1";
|
. "$PSScriptRoot/../Scripts/Context.ps1";
|
||||||
|
|
||||||
function Invoke-Upgrade([Context] $context)
|
function Update-WindowsInstallation([Context] $context)
|
||||||
{
|
{
|
||||||
Write-Host "Upgrading Windows";
|
Write-Host "Upgrading Windows";
|
||||||
Write-Host "Preparing for Windows Update";
|
Write-Host "Preparing for Windows Update";
|
||||||
|
@ -19,7 +19,7 @@ function Invoke-Upgrade([Context] $context)
|
||||||
elseif ((Get-WindowsUpdate -IgnoreReboot).Count -gt 0)
|
elseif ((Get-WindowsUpdate -IgnoreReboot).Count -gt 0)
|
||||||
{
|
{
|
||||||
Write-Information "More updates are available. Restarting upgrade routine.";
|
Write-Information "More updates are available. Restarting upgrade routine.";
|
||||||
$null = Invoke-Upgrade $context;
|
$null = Update-WindowsInstallation $context;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -11,7 +11,7 @@ function Get-BackupCandidates() {
|
||||||
return $candidates;
|
return $candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-FileBackup([Context] $context) {
|
function Backup-PersonalFiles([Context] $context) {
|
||||||
Write-Host "Backing up Personal Files";
|
Write-Host "Backing up Personal Files";
|
||||||
|
|
||||||
foreach ($candidate in Get-BackupCandidates) {
|
foreach ($candidate in Get-BackupCandidates) {
|
||||||
|
@ -19,7 +19,7 @@ function Invoke-FileBackup([Context] $context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-FileRestore([Context] $context) {
|
function Restore-PersonalFiles([Context] $context) {
|
||||||
Write-Host "Restoring Personal Files";
|
Write-Host "Restoring Personal Files";
|
||||||
|
|
||||||
foreach ($candidate in Get-BackupCandidates) {
|
foreach ($candidate in Get-BackupCandidates) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "$env:LOCALAPPDATA/LGHUB";
|
$path = "$env:LOCALAPPDATA/LGHUB";
|
||||||
$softwareName = "LGHub";
|
$softwareName = "LGHub";
|
||||||
|
|
||||||
function Invoke-BackupLGHub([Context] $context) {
|
function Backup-LogitechGHUB([Context] $context) {
|
||||||
$hubName = "lghub.exe";
|
$hubName = "lghub.exe";
|
||||||
$hubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
|
$hubPath = $(Get-Process | Where-Object { [System.IO.Path]::GetFileName($_.Path) -eq $hubName })[0].Path;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "$HOME/Documents/ManiaPlanet";
|
$path = "$HOME/Documents/ManiaPlanet";
|
||||||
$softwareName = "ManiaPlanet";
|
$softwareName = "ManiaPlanet";
|
||||||
|
|
||||||
function Invoke-BackupManiaPlanet([Context] $context) {
|
function Backup-ManiaPlanet([Context] $context) {
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$softwareName = "PuTTY";
|
$softwareName = "PuTTY";
|
||||||
$configFile = "$($softwareName).reg";
|
$configFile = "$($softwareName).reg";
|
||||||
|
|
||||||
function Invoke-BackupPuTTY([Context] $context) {
|
function Backup-PuTTY([Context] $context) {
|
||||||
$tempDir = $context.GetTempDirectory();
|
$tempDir = $context.GetTempDirectory();
|
||||||
$fileName = Join-Path "$tempDir" $configFile;
|
$fileName = Join-Path "$tempDir" $configFile;
|
||||||
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;
|
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "C:/tools/RetroArch-Win64";
|
$path = "C:/tools/RetroArch-Win64";
|
||||||
$softwareName = "RetroArch";
|
$softwareName = "RetroArch";
|
||||||
|
|
||||||
function Invoke-BackupRetroArch([Context] $context) {
|
function Backup-RetroArch([Context] $context) {
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "$HOME/Documents/TmForever";
|
$path = "$HOME/Documents/TmForever";
|
||||||
$softwareName = "TmNationsForever";
|
$softwareName = "TmNationsForever";
|
||||||
|
|
||||||
function Invoke-BackupTmNations([Context] $context) {
|
function Backup-TmNations([Context] $context) {
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "$HOME/Documents/TrackMania";
|
$path = "$HOME/Documents/TrackMania";
|
||||||
$softwareName = "TmUnitedForever";
|
$softwareName = "TmUnitedForever";
|
||||||
|
|
||||||
function Invoke-BackupTmUnited([Context] $context) {
|
function Backup-TmUnited([Context] $context) {
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ $null = New-Module {
|
||||||
return Join-Path $($context.BackupRoot()) $packageName ".vsconfig";
|
return Join-Path $($context.BackupRoot()) $packageName ".vsconfig";
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-BackupVisualStudio([Context] $context) {
|
function Backup-VisualStudio([Context] $context) {
|
||||||
foreach ($version in $versions) {
|
foreach ($version in $versions) {
|
||||||
$configPath = Get-ConfigPath $context $version[0];
|
$configPath = Get-ConfigPath $context $version[0];
|
||||||
$null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";
|
$null = New-Item -Force -ItemType Directory "$(Split-Path -Parent $configPath)";
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
function Invoke-BackupGit([Context] $context) {}
|
function Backup-Git([Context] $context) {}
|
||||||
|
|
||||||
function Invoke-RestoreGit([Context] $context) {
|
function Restore-Git([Context] $context) {
|
||||||
$script = New-TemporaryFile;
|
$script = New-TemporaryFile;
|
||||||
$script = Rename-Item $script "$($script.Name).sh" -PassThru;
|
$script = Rename-Item $script "$($script.Name).sh" -PassThru;
|
||||||
Set-Content $script "bash `"$PSScriptRoot/../../../Common/Config/git/install.sh`"";
|
Set-Content $script "bash `"$PSScriptRoot/../../../Common/Config/git/install.sh`"";
|
||||||
|
|
|
@ -5,7 +5,7 @@ $null = New-Module {
|
||||||
$softwareName = "osu!";
|
$softwareName = "osu!";
|
||||||
$genericConfigName = "osu!.User.cfg";
|
$genericConfigName = "osu!.User.cfg";
|
||||||
|
|
||||||
function Invoke-BackupOsu([Context] $context) {
|
function Backup-Osu([Context] $context) {
|
||||||
$archive = $context.SoftwareArchive($softwareName);
|
$archive = $context.SoftwareArchive($softwareName);
|
||||||
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`""));
|
$context.Backup($path, $archive, @("-i@`"$PSScriptRoot/include.txt`""));
|
||||||
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName;
|
& 7z rn "$archive" "osu!.$env:USERNAME.cfg" $genericConfigName;
|
||||||
|
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "$env:APPDATA/osu";
|
$path = "$env:APPDATA/osu";
|
||||||
$softwareName = "osu!lazer";
|
$softwareName = "osu!lazer";
|
||||||
|
|
||||||
function Invoke-BackupOsuLazer([Context] $context) {
|
function Backup-OsuLazer([Context] $context) {
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-i@`"$PSScriptRoot/include.txt`"", "-i!*.realm", "-i!*.db"));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ $null = New-Module {
|
||||||
$path = "$env:PUBLIC/Documents/reWASD";
|
$path = "$env:PUBLIC/Documents/reWASD";
|
||||||
$softwareName = "reWASD";
|
$softwareName = "reWASD";
|
||||||
|
|
||||||
function Invoke-BackupReWASD([Context] $context) {
|
function Backup-reWASD([Context] $context) {
|
||||||
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`""));
|
$context.Backup($path, $context.SoftwareArchive($softwareName), @("-x@`"$PSScriptRoot/exclude.txt`""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue