From 06977c0db5a3270a70294594a0c0f43afb5f5458 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 28 Nov 2024 16:37:39 +0100 Subject: [PATCH] scrap git repository idea, download as zip only --- README.md | 4 ++-- install_windows.ps1 | 10 ++-------- util/windows.psm1 | 43 ------------------------------------------- 3 files changed, 4 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 44d3835..7ec0804 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,8 @@ cloning the repository or directly execute it from shell: ```pwsh irm https://api.github.com/repos/Baipyrus/dotfiles/zipball -O "$env:TMP\dotfiles.zip" -Expand-Archive "$env:TMP\dotfiles.zip" -D "$env:TMP\dotfiles-zip" -F -gci "$env:TMP\dotfiles-zip\**\install_windows.ps1" | % { +Expand-Archive "$env:TMP\dotfiles.zip" -D "$env:TMP\dotfiles" -F +gci "$env:TMP\dotfiles\**\install_windows.ps1" | select -F 1 | % { saps powershell.exe -Wait -Wo $_.DirectoryName -A "-Ex", "Bypass", "-F", $_.FullName } ``` diff --git a/install_windows.ps1 b/install_windows.ps1 index fd9e77d..7d88329 100644 --- a/install_windows.ps1 +++ b/install_windows.ps1 @@ -17,16 +17,10 @@ if ($continue.ToLower() -eq 'n') # Define paths for tools and configurations -$dotfilesRepo = "$env:TMP\dotfiles" +$dotfilesRepo = (Get-Location).Path $alacrittyConfigDir = "$env:APPDATA\alacritty" $psProfile = "$env:USERPROFILE\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -$repoUrl = "https://github.com/Baipyrus/dotfiles.git" -# Check if the script is running inside the dotfiles repository -$currentDir = (Get-Location).Path - - -$dotfilesRepo = ReadyDotfilesRepo -cwd $currentDir -url $repoUrl -destination $dotfilesRepo # Setting up Alacritty Configuration Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan @@ -64,7 +58,7 @@ Write-Host "============================================" -ForegroundColor DarkG Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan ProcessUrlFiles -source "$dotfilesRepo\nerd-fonts" -fileExt ".zip" -progress $false Get-ChildItem -Path "$env:TMP\nerd-fonts-config" -Filter "*.zip" | ` - ForEach-Object { InstallNerdFont -source $_.FullName } + ForEach-Object { InstallNerdFont -source $_.FullName } # Final message Write-Host "Windows setup complete!" -ForegroundColor Green diff --git a/util/windows.psm1 b/util/windows.psm1 index 566e81e..6ad0f70 100644 --- a/util/windows.psm1 +++ b/util/windows.psm1 @@ -17,49 +17,6 @@ function IsGitRepository } } -function ReadyDotfilesRepo -{ - param ( - [string]$cwd, - [string]$url, - [Parameter(Mandatory=$false)][string]$destination - ) - - # Clone dotfiles repository to TMP if not already inside it; otherwise pull changes - if (IsGitRepository -dir $cwd -url $url) - { - Write-Host "Already inside the dotfiles repository. Skipping clone step and pulling..." -ForegroundColor Yellow - Write-Host "$(git pull)" - return $cwd - } - - # Mandatory parameter missing - if (-not $PSBoundParameters.ContainsKey('destination')) - { - throw "Missing mandatory parameter for Repo location." - } - - # Clone new repo in destination dir if not exists - if ((Test-Path $destination) -and (IsGitRepository -dir $destination -url $url)) - { - Write-Host "Pulling latest changes from dotfiles repository..." -ForegroundColor Cyan - Write-Host "$(git -C $destination pull)" - return $destination - } - - # Try using current directory - $request = Read-Host "Clone the dotfiles repository anew? [y/N]" - if ($request.ToLower() -ne 'y') - { - Write-Warning "Fallback to current directory (Errors without necessary files)!" - return $cwd - } - - Write-Host "Cloning dotfiles repository..." -ForegroundColor Cyan - git clone $url $destination - return $destination -} - # Function to copy files with overwrite prompt function CopyFileWithPrompt {