mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 03:11:45 +00:00
scrap git repository idea, download as zip only
This commit is contained in:
parent
c15f2c800c
commit
06977c0db5
@ -51,8 +51,8 @@ cloning the repository or directly execute it from shell:
|
|||||||
|
|
||||||
```pwsh
|
```pwsh
|
||||||
irm https://api.github.com/repos/Baipyrus/dotfiles/zipball -O "$env:TMP\dotfiles.zip"
|
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
|
Expand-Archive "$env:TMP\dotfiles.zip" -D "$env:TMP\dotfiles" -F
|
||||||
gci "$env:TMP\dotfiles-zip\**\install_windows.ps1" | % {
|
gci "$env:TMP\dotfiles\**\install_windows.ps1" | select -F 1 | % {
|
||||||
saps powershell.exe -Wait -Wo $_.DirectoryName -A "-Ex", "Bypass", "-F", $_.FullName
|
saps powershell.exe -Wait -Wo $_.DirectoryName -A "-Ex", "Bypass", "-F", $_.FullName
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -17,16 +17,10 @@ if ($continue.ToLower() -eq 'n')
|
|||||||
|
|
||||||
|
|
||||||
# Define paths for tools and configurations
|
# Define paths for tools and configurations
|
||||||
$dotfilesRepo = "$env:TMP\dotfiles"
|
$dotfilesRepo = (Get-Location).Path
|
||||||
$alacrittyConfigDir = "$env:APPDATA\alacritty"
|
$alacrittyConfigDir = "$env:APPDATA\alacritty"
|
||||||
$psProfile = "$env:USERPROFILE\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
|
$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
|
# Setting up Alacritty Configuration
|
||||||
Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan
|
Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan
|
||||||
|
@ -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 to copy files with overwrite prompt
|
||||||
function CopyFileWithPrompt
|
function CopyFileWithPrompt
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user