scrap git repository idea, download as zip only

This commit is contained in:
Baipyrus 2024-11-28 16:37:39 +01:00
parent c15f2c800c
commit 06977c0db5
3 changed files with 4 additions and 53 deletions

View File

@ -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
}
```

View File

@ -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

View File

@ -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
{