Improved check for $lastExitCode

This commit is contained in:
Markus Fleschutz 2025-02-24 20:42:52 +01:00
parent c6929fc266
commit e36021f3b2
91 changed files with 204 additions and 204 deletions

View File

@ -29,28 +29,28 @@ function BuildInDir([string]$path) {
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake ..
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'cmake ..' exited with error code $lastExitCode" }
"⏳ (3/4) Executing 'make -j4' to compile and link..."
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' exited with error code $lastExitCode" }
"⏳ (4/4) Executing 'ctest -V' to perform tests (optional)..."
& ctest -V
if ($lastExitCode -ne "0") { throw "Executing 'ctest -V' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'ctest -V' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'autogen.sh'..."
Set-Location "$path/"
& ./autogen.sh --force
if ($lastExitCode -ne "0") { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing './autogen.sh --force' exited with error code $lastExitCode" }
& ./configure
if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing './configure' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/configure" -pathType leaf) {
@ -58,70 +58,70 @@ function BuildInDir([string]$path) {
Set-Location "$path/"
& ./configure
#if ($lastExitCode -ne "0") { throw "Executing './configure' exited with error code $lastExitCode" }
#if ($lastExitCode -ne 0) { throw "Executing './configure' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' has failed" }
& make test
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make test' has failed" }
} elseif (Test-Path "$path/build.gradle" -pathType leaf) {
"⏳ Building 📂$dirName by using Gradle..."
Set-Location "$path"
& gradle build
if ($lastExitCode -ne "0") { throw "Executing 'gradle build' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'gradle build' exited with error code $lastExitCode" }
& gradle test
if ($lastExitCode -ne "0") { throw "Executing 'gradle test' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'gradle test' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
"⏳ Building 📂$dirName by using Meson..."
Set-Location "$path"
& meson . build --prefix=/usr/local
if ($lastExitCode -ne "0") { throw "Executing 'meson . build' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'meson . build' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/Imakefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Imakefile..."
Set-Location "$path/"
& xmkmf
if ($lastExitCode -ne "0") { throw "Executing 'xmkmf' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'xmkmf' has failed" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/Makefile" -pathType leaf) {
"⏳ Building 📂$dirName by using Makefile..."
Set-Location "$path"
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/makefile" -pathType leaf) {
"⏳ Building 📂$dirName by using makefile..."
Set-Location "$path"
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/compile.sh" -pathType leaf) {
"⏳ Building 📂$dirName by using 'compile.sh'..."
Set-Location "$path/"
& ./compile.sh
if ($lastExitCode -ne "0") { throw "Executing './compile.sh' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing './compile.sh' exited with error code $lastExitCode" }
& make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
if ($lastExitCode -ne 0) { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/attower/src/build/DevBuild/build.bat" -pathType leaf) {
"⏳ Building 📂$dirName by using build.bat ..."
Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-all-release
if ($lastExitCode -ne "0") { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Executing 'build.bat build-all-release' exited with error code $lastExitCode" }
} elseif (Test-Path "$path/$dirName" -pathType container) {
"⏳ No make rule found, trying subfolder 📂$($dirName)..."

View File

@ -27,7 +27,7 @@ try {
$Path = "$(GetTempDir)/next_wallpaper.jpg"
& wget -O $Path "https://source.unsplash.com/3840x2160?$Category"
if ($lastExitCode -ne "0") { throw "Download failed" }
if ($lastExitCode -ne 0) { throw "Download failed" }
& "$PSScriptRoot/set-wallpaper.ps1" -ImageFile "$Path"
exit 0 # success

View File

@ -28,7 +28,7 @@ try {
Write-Host "⏳ (1/10) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
$FullPath = Resolve-Path "$pathToRepo"
@ -37,15 +37,15 @@ try {
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
& git -C "$FullPath" remote get-url origin
if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
Write-Host "⏳ (4/10) Querying current branch... " -noNewline
& git -C "$FullPath" branch --show-current
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git branch --show-current' failed with exit code $lastExitCode" }
Write-Host "⏳ (5/10) Fetching remote updates... " -noNewline
& git -C "$FullPath" fetch --all --recurse-submodules --tags --force --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed with exit code $lastExitCode" }
Write-Host "OK"
Write-Host "⏳ (6/10) Querying latest tag... " -noNewline
@ -55,19 +55,19 @@ try {
Write-Host "⏳ (7/10) Verifying data integrity..."
& git -C "$FullPath" fsck
if ($lastExitCode -ne "0") { throw "'git fsck' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fsck' failed with exit code $lastExitCode" }
Write-Host "⏳ (8/10) Running maintenance tasks..."
& git -C "$FullPath" maintenance run
if ($lastExitCode -ne "0") { throw "'git maintenance run' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git maintenance run' failed with exit code $lastExitCode" }
Write-Host "⏳ (9/10) Checking submodule status..."
& git -C "$FullPath" submodule status
if ($lastExitCode -ne "0") { throw "'git submodule status' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git submodule status' failed with exit code $lastExitCode" }
Write-Host "⏳ (10/10) Checking repo status... " -noNewline
& git -C "$FullPath" status
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git status --short' failed with exit code $lastExitCode" }
$repoDirName = (Get-Item "$FullPath").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds

View File

@ -30,7 +30,7 @@ function Bytes2String([int64]$bytes) {
try {
$result = (smartctl --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
if ($lastExitCode -ne 0) { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
if ($IsLinux) {
$devices = $(sudo smartctl --scan-open)

View File

@ -16,7 +16,7 @@
try {
sfc /verifyOnly
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
if ($lastExitCode -ne 0) { throw "'sfc /verifyOnly' failed" }
"✅ checked Windows system files"
exit 0 # success

View File

@ -26,7 +26,7 @@ try {
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
"⏳ (2/4) Checking local repository... $path"
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access repo folder '$path' - maybe a typo or missing folder permissions?" }
@ -34,15 +34,15 @@ try {
"⏳ (3/4) Removing untracked files in repository..."
& git -C "$path" clean -xfd -f # to delete all untracked files in the main repo
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
Write-Warning "'git clean' failed with exit code $lastExitCode, retrying once..."
& git -C "$path" clean -xfd -f
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean' failed with exit code $lastExitCode" }
}
"⏳ (4/4) Removing untracked files in submodules..."
& git -C "$path" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Cleaned the 📂$repoName repository in $($elapsed)s."

View File

@ -24,7 +24,7 @@ try {
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
$parentDirName = (Get-Item "$ParentDir").Name
Write-Host "⏳ (2) Checking parent folder 📂$parentDirName... " -noNewline
@ -40,10 +40,10 @@ try {
"⏳ ($Step/$($numFolders + 2)) Cleaning 📂$FolderName..."
& git -C "$folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
& git -C "$folder" submodule foreach --recursive git clean -xfd -f
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Cleaned $numFolders Git repositories under 📂$parentDirName in $($elapsed)s."

View File

@ -14,7 +14,7 @@
try {
Clear-RecycleBin -Confirm:$false
if ($lastExitCode -ne "0") { throw "'Clear-RecycleBin' failed" }
if ($lastExitCode -ne 0) { throw "'Clear-RecycleBin' failed" }
& "$PSScriptRoot/speak-english.ps1" "It's clean now."
exit 0 # success

View File

@ -25,7 +25,7 @@ try {
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline
$table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv"
@ -53,12 +53,12 @@ try {
} elseif ($shallow -eq "yes") {
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL ($branch branch only)..."
& git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
$cloned++
} else {
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (full $branch branch)..."
& git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName"
if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" }
$clone++
}
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im msedge.exe /f /t
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Edge isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im GitExtensions.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Git Extensions isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im mspaint.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Paint isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im WinStore.App.exe /f /t
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Store isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im obs64.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, OBS Studio isn't running"
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /f /im CalendarApp.Gui.Win10.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, OneCalendar isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im outlook.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Outlook isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im PaintStudio.View.exe /f
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Paint 3D isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im 3DViewer.exe /f
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, 3D Viewer isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im thunderbird.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Mozilla Thunderbird isn't running."
exit 1
}

View File

@ -12,7 +12,7 @@
#>
TaskKill /im devenv.exe
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
& "$PSScriptRoot/speak-english.ps1" "Sorry, Visual Studio isn't running."
exit 1
}

View File

@ -29,7 +29,7 @@ param([string]$fullName = "", [string]$emailAddress = "", [string]$favoriteEdito
try {
Write-Host "⏳ (1/5) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
"⏳ (2/5) Asking for user details..."
if ($fullName -eq "") { $fullName = Read-Host "Enter your full name" }
@ -45,13 +45,13 @@ try {
& git config --global merge.renamelimit 99999 # raise the rename limit
& git config --global pull.rebase false
& git config --global fetch.parallel 0 # enable parallel fetching to improve the speed
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git config' failed with exit code $lastExitCode" }
"⏳ (4/5) Saving user settings (name,email,editor)..."
& git config --global user.name $fullName
& git config --global user.email $emailAddress
& git config --global core.editor $favoriteEditor
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git config' failed with exit code $lastExitCode" }
"⏳ (5/5) Saving user shortcuts ('git br', 'git ls', 'git st', etc.)..."
& git config --global alias.br "branch"
@ -64,7 +64,7 @@ try {
& git config --global alias.ps "push"
& git config --global alias.smu "submodule update --init"
& git config --global alias.st "status"
if ($lastExitCode -ne "0") { throw "'git config' failed" }
if ($lastExitCode -ne 0) { throw "'git config' failed" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Saved your Git configuration to ~/.gitconfig in $($elapsed)s."

View File

@ -18,7 +18,7 @@ try {
if ($Connection.ConnectionStatus -ne "Disconnected") { continue }
"Connecting to VPN $($Connection.Name)..."
& rasdial.exe "$($Connection.Name)"
if ($lastExitCode -ne "0") { throw "Cannot establish connection" }
if ($lastExitCode -ne 0) { throw "Cannot establish connection" }
"Connected now."
exit 0 # success
}

View File

@ -22,7 +22,7 @@ try {
Write-Host "⏳ Searching for pandoc..."
$null = (pandoc --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'pandoc' - make sure it's installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'pandoc' - make sure it's installed and available" }
Write-Host "⏳ Converting..."
gci -r -i $FilePattern | foreach {

View File

@ -24,7 +24,7 @@ try {
"⏳ (1/3) Searching for ffmpeg..."
& ffmpeg -L
if ($lastExitCode -ne "0") { throw "Can't execute 'ffmpeg' - make sure ffmpeg is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'ffmpeg' - make sure ffmpeg is installed and available" }
"⏳ (2/3) Checking file pattern of the image frames..."
$Files = (Get-ChildItem -path "$SourcePattern" -attributes !Directory)

View File

@ -29,7 +29,7 @@ try {
"⏳ (2/$Frames) Searching for ImageMagick 6..."
& convert-im6 --version
if ($lastExitCode -ne "0") { throw "Can't execute 'convert-im6' - make sure ImageMagick 6 is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'convert-im6' - make sure ImageMagick 6 is installed and available" }
[int]$centerX = $ImageWidth / 2
[int]$centerY = $ImageHeight / 2

View File

@ -29,7 +29,7 @@ try {
"⏳ (2/$Frames) Searching for ImageMagick 6 executable..."
& convert-im6 --version
if ($lastExitCode -ne "0") { throw "Can't execute 'convert-im6' - make sure ImageMagick 6 is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'convert-im6' - make sure ImageMagick 6 is installed and available" }
$Factor = 0.001
for ($i = 0; $i -lt $Frames; $i++) {

View File

@ -22,7 +22,7 @@ try {
Write-Host "⏳ Searching for pandoc..."
$null = (pandoc --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'pandoc' - make sure it's installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'pandoc' - make sure it's installed and available" }
Write-Host "⏳ Converting..."
gci -r -i $FilePattern | foreach {

View File

@ -18,7 +18,7 @@ try {
if ($Connection.ConnectionStatus -ne "Connected") { continue }
"Disconnecting $($Connection.Name)..."
& rasdial.exe "$($Connection.Name)" /DISCONNECT
if ($lastExitCode -ne "0") { throw "Disconnect failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "Disconnect failed with exit code $lastExitCode" }
"Disconnected now."
exit 0 # success
}

View File

@ -21,10 +21,10 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
& wget --version
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'wget' - make sure wget is installed and available" }
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
if ($lastExitCode -ne 0) { throw "Can't execute 'wget --mirror $URL'" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ downloaded directory from $URL in $Elapsed sec"

View File

@ -21,10 +21,10 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
& wget --version
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'wget' - make sure wget is installed and available" }
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
if ($lastExitCode -ne 0) { throw "Can't execute 'wget --mirror $URL'" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ downloaded file from $URL in $Elapsed sec"

View File

@ -19,7 +19,7 @@ function TryEditor { param([string]$editor, [string]$path)
try {
Write-Host "$editor.." -noNewline
& $editor "$path"
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
"⚠️ Can't execute '$editor' - make sure it's installed and available"
exit 1
}

View File

@ -31,14 +31,14 @@ try {
}
& "$PSScriptRoot/ping-host.ps1" $remoteHost
if ($lastExitCode -ne "0") {
if ($lastExitCode -ne 0) {
Write-Host "Let's try to wake '$remoteHost' up..."
& "$PSScriptRoot/wake-up-host.ps1"
}
Write-Host "⏳ Connecting as user '$remoteUser' using " -noNewline
& ssh -V
if ($lastExitCode -ne "0") { throw "'ssh -V' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ssh -V' failed with exit code $lastExitCode" }
& ssh "$($remoteUser)@$($remoteHost)"
exit 0 # success

View File

@ -24,7 +24,7 @@ try {
Write-Host "⏳ (1/3) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/3) Checking local repository... $path"
if (!(Test-Path "$path" -pathType container)) { throw "Can't access folder: $path" }
@ -32,7 +32,7 @@ try {
Write-Host "⏳ (3/3) Fetching updates (including submodules)..."
& git -C "$path" fetch --all --recurse-submodules --tags --prune --prune-tags --force --quiet
if ($lastExitCode -ne "0") { throw "'git fetch --all' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch --all' failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Updates fetched into 📂$repoDirName repo in $($elapsed)s."

View File

@ -24,7 +24,7 @@ try {
Write-Host "⏳ (1) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2) Checking parent folder... " -noNewline
if (-not(Test-Path "$parentDirPath" -pathType container)) { throw "Can't access folder: $parentDirPath" }
@ -39,7 +39,7 @@ try {
Write-Host "⏳ ($step/$($numFolders + 2)) Fetching into 📂$folderName...`t`t"
& git -C "$folder" fetch --all --recurse-submodules --prune --prune-tags --force
if ($lastExitCode -ne "0") { throw "'git fetch --all' in 📂$folder failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch --all' in 📂$folder failed with exit code $lastExitCode" }
$step++
}

View File

@ -15,7 +15,7 @@ try {
"Installing Audacity, please wait..."
& winget install --id Audacity.Audacity --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Audacity installed successfully."
exit 0 # success

View File

@ -42,7 +42,7 @@ try {
Write-Host " "
Write-Host "⏳ ($step/$($numEntries + 2)) Installing $category '$appName'..."
& winget install --id $appID --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { $numSkipped++ }
if ($lastExitCode -ne 0) { $numSkipped++ }
$step++
}
[int]$numInstalled = ($numEntries - $numSkipped)

View File

@ -32,15 +32,15 @@ try {
"`n⏳ (1/5) Updating package infos..."
& sudo apt update -y
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
if ($lastExitCode -ne 0) { throw "'apt update' failed" }
"`n⏳ (2/5) Installing Calibre package..."
& sudo apt install calibre -y
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
if ($lastExitCode -ne 0) { throw "'apt install calibre' failed" }
"`n⏳ (3/5) Searching for Calibre server executable..."
& calibre-server --version
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre server is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'calibre-server' - make sure Calibre server is installed and available" }
"`n⏳ (4/5) Creating media folder at: $mediaFolder ... (if non-existent)"
& mkdir $mediaFolder

View File

@ -15,7 +15,7 @@ try {
"Installing Google Chrome, please wait..."
& winget install --id Google.Chrome --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Google Chrome installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing CrystalDiskInfo, please wait..."
& winget install "CrystalDiskInfo" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"CrystalDiskInfo installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing CrystalDiskMark, please wait..."
& winget install "CrystalDiskMark Shizuku Edition" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"CrystalDiskMark installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Discord, please wait..."
& winget install "Discord" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Discord installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Microsoft Edge, please wait..."
& winget install "Microsoft Edge Browser" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Microsoft Edge installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Mozilla Firefox, please wait..."
& winget install "Mozilla Firefox Browser" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Mozilla Firefox installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Git Extensions, please wait..."
& winget install --id GitExtensionsTeam.GitExtensions --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Git Extensions installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Git for Windows, please wait..."
& winget install --id Git.Git -e --source winget --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Git for Windows installed successfully."
exit 0 # success

View File

@ -23,7 +23,7 @@ try {
& sudo apt install gh
} else {
& winget install --id GitHub.cli
if ($lastExitCode -ne "0") { throw "Installation of GitHub CLI failed, maybe it's already installed." }
if ($lastExitCode -ne 0) { throw "Installation of GitHub CLI failed, maybe it's already installed." }
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ GitHub CLI installed successfully in $($elapsed)s - to authenticate execute: 'gh auth login'"

View File

@ -15,7 +15,7 @@ try {
"Installing IrfanView, please wait..."
& winget install "IrfanView64" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"IrfanView installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Microsoft Teams, please wait..."
& winget install --id Microsoft.Teams --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Microsoft Teams installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Netflix, please wait..."
& winget install "Netflix" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Netflix installed successfully."
exit 0 # success

View File

@ -3,7 +3,7 @@ try {
"⏳ Installing OctoPrint (snap 'octoprint-pfs', channel 'edge')..."
& sudo snap install octoprint-pfs --edge
if ($lastExitCode -ne "0") { throw "'snap install octoprint-pfs' exited with code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'snap install octoprint-pfs' exited with code $lastExitCode" }
"HINT: Access Octoprint's web login at: http://<HOSTNAME>:5000"
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing One Calendar, please wait..."
& winget install "One Calendar" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"One Calendar installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Opera Browser, please wait..."
& winget install "Opera Browser" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Opera Browser installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Opera GX, please wait..."
& winget install "Opera GX" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Opera GX installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Paint 3D, please wait..."
& winget install "Paint 3D" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Paint 3D installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Microsoft Powertoys, please wait..."
& winget install Microsoft.Powertoys --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Microsoft Powertoys installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Rufus, please wait..."
& winget install "Rufus" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Rufus installed successfully."
exit 0 # success

View File

@ -24,19 +24,19 @@ try {
set-location /tmp
& wget --version
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'wget' - make sure wget is installed and available" }
& wget "https://github.com/AsamK/signal-cli/releases/download/v$Version/signal-cli-$($Version).tar.gz"
if ($lastExitCode -ne "0") { throw "'wget' failed" }
if ($lastExitCode -ne 0) { throw "'wget' failed" }
sudo tar xf "signal-cli-$Version.tar.gz" -C /opt
if ($lastExitCode -ne "0") { throw "'sudo tar xf' failed" }
if ($lastExitCode -ne 0) { throw "'sudo tar xf' failed" }
sudo ln -sf "/opt/signal-cli-$Version/bin/signal-cli" /usr/local/bin/
if ($lastExitCode -ne "0") { throw "'sudo ln -sf' failed" }
if ($lastExitCode -ne 0) { throw "'sudo ln -sf' failed" }
rm "signal-cli-$Version.tar.gz"
if ($lastExitCode -ne "0") { throw "'rm' failed" }
if ($lastExitCode -ne 0) { throw "'rm' failed" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ installed signal-cli $Version to /opt and /usr/local/bin in $Elapsed sec"

View File

@ -15,7 +15,7 @@ try {
"Installing Skype, please wait..."
& winget install "Skype" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Skype installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Spotify, please wait..."
& winget install "Spotify - Music and Podcasts" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Spotify installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Mozilla Thunderbird, please wait..."
& winget install --id Mozilla.Thunderbird --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Mozilla Thunderbird installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Twitter, please wait..."
& winget install "Twitter" --source msstore --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Twitter installed successfully."
exit 0 # success

View File

@ -18,27 +18,27 @@ try {
"⏳ (1/10) Updating package infos..."
& sudo apt update -y
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
if ($lastExitCode -ne 0) { throw "'apt update' failed" }
"⏳ (2/10) Installing the Unbound packages..."
& sudo apt install unbound unbound-anchor -y
if ($lastExitCode -ne "0") { throw "'apt install unbound' failed" }
if ($lastExitCode -ne 0) { throw "'apt install unbound' failed" }
"⏳ (3/10) Setting up Unbound..."
& sudo unbound-control-setup
if ($lastExitCode -ne "0") { throw "'unbound-control-setup' failed" }
if ($lastExitCode -ne 0) { throw "'unbound-control-setup' failed" }
"⏳ (4/10) Updating DNSSEC Root Trust Anchors..."
& sudo unbound-anchor
if ($lastExitCode -ne "0") { throw "'unbound-anchor' failed" }
if ($lastExitCode -ne 0) { throw "'unbound-anchor' failed" }
"⏳ (5/10) Checking config file..."
& unbound-checkconf "$PSScriptRoot/../data/unbound.conf"
if ($lastExitCode -ne "0") { throw "'unbound-checkconf' failed - check the syntax" }
if ($lastExitCode -ne 0) { throw "'unbound-checkconf' failed - check the syntax" }
"⏳ (6/10) Copying config file to /etc/unbound/unbound.conf ..."
& sudo cp "$PSScriptRoot/../data/unbound.conf" /etc/unbound/unbound.conf
if ($lastExitCode -ne "0") { throw "'cp' failed" }
if ($lastExitCode -ne 0) { throw "'cp' failed" }
"⏳ (7/10) Stopping default DNS cache daemon systemd-resolved..."
& sudo systemctl stop systemd-resolved
@ -47,15 +47,15 @@ try {
"⏳ (8/10) (Re-)starting Unbound..."
& sudo unbound-control stop
& sudo unbound-control start
if ($lastExitCode -ne "0") { throw "'unbound-control start' failed" }
if ($lastExitCode -ne 0) { throw "'unbound-control start' failed" }
"⏳ (9/10) Checking status of Unbound..."
& sudo unbound-control status
if ($lastExitCode -ne "0") { throw "'unbound-control status' failed" }
if ($lastExitCode -ne 0) { throw "'unbound-control status' failed" }
"⏳ (10/10) Training Unbound with 100 popular domain names..."
& "$PSScriptRoot/check-dns.ps1"
if ($lastExitCode -ne "0") { throw "'unbound-control status' failed" }
if ($lastExitCode -ne 0) { throw "'unbound-control status' failed" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ Installed Unbound in $Elapsed sec"

View File

@ -15,7 +15,7 @@ try {
"Installing Visual Studio Code, please wait..."
& winget install --id Microsoft.VisualStudioCode --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Visual Studio Code installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Vivaldi, please wait..."
& winget install --id VivaldiTechnologies.Vivaldi --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Vivaldi installed successfully."
exit 0 # success

View File

@ -18,7 +18,7 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
& winget install --id XPDM1ZW6815MQM --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "Can't install VLC media player, is it already installed?" }
if ($lastExitCode -ne 0) { throw "Can't install VLC media player, is it already installed?" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ Installation of VLC media player took $Elapsed sec"

View File

@ -15,7 +15,7 @@ try {
"Installing Windows Terminal, please wait..."
& winget install --id Microsoft.WindowsTerminal --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Windows Terminal installed successfully."
exit 0 # success

View File

@ -15,7 +15,7 @@ try {
"Installing Zoom, please wait..."
& winget install --id Zoom.Zoom --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne "0") { throw "'winget install' failed" }
if ($lastExitCode -ne 0) { throw "'winget install' failed" }
"Zoom installed successfully."
exit 0 # success

View File

@ -25,13 +25,13 @@ try {
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder '$pathToRepo' - maybe a typo or missing folder permissions?" }
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
& git -C "$pathToRepo" fetch
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed" }
$branches = $(git -C "$pathToRepo" branch --list --remotes --no-color --no-column)
if ($lastExitCode -ne "0") { throw "'git branch --list' failed" }
if ($lastExitCode -ne 0) { throw "'git branch --list' failed" }
""
"List of Git Branches"

View File

@ -23,14 +23,14 @@ param([string]$path = "$PWD")
try {
Write-Progress "(1/4) Searching for Git executable..."
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Progress "(2/4) Checking local Git repository..."
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access directory: $path" }
Write-Progress "(3/4) Fetching updates..."
& git -C "$path" fetch --all --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed with exit code $lastExitCode" }
Write-Progress "(4/4) Querying commits..."
" "
@ -38,7 +38,7 @@ try {
"------- ------"
Write-Progress -completed "Done."
git -C "$path" shortlog --summary --numbered --email --no-merges
if ($lastExitCode -ne "0") { throw "'git shortlog' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git shortlog' failed with exit code $lastExitCode" }
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -26,11 +26,11 @@ try {
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access directory: $pathToRepo" }
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Progress "Fetching latest updates..."
& git -C "$pathToRepo" fetch --all --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed" }
Write-Progress -Completed "Done."
if ($format -eq "pretty") {
@ -46,7 +46,7 @@ try {
"List of Git Commits"
"-------------------"
& git -C "$pathToRepo" log --graph --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %C(bold blue)by %an %cr%Creset' --abbrev-commit
if ($lastExitCode -ne "0") { throw "'git log' failed" }
if ($lastExitCode -ne 0) { throw "'git log' failed" }
} elseif ($format -eq "JSON") {
& git -C "$pathToRepo" log --pretty=format:'{%n "commit": "%H",%n "abbreviated_commit": "%h",%n "tree": "%T",%n "abbreviated_tree": "%t",%n "parent": "%P",%n "abbreviated_parent": "%p",%n "refs": "%D",%n "encoding": "%e",%n "subject": "%s",%n "sanitized_subject_line": "%f",%n "body": "%b",%n "commit_notes": "%N",%n "verification_flag": "%G?",%n "signer": "%GS",%n "signer_key": "%GK",%n "author": {%n "name": "%aN",%n "email": "%aE",%n "date": "%aD"%n },%n "commiter": {%n "name": "%cN",%n "email": "%cE",%n "date": "%cD"%n }%n},'
} else {
@ -54,7 +54,7 @@ try {
"List of Git Commits"
"-------------------"
& git -C "$pathToRepo" log
if ($lastExitCode -ne "0") { throw "'git log' failed" }
if ($lastExitCode -ne 0) { throw "'git log' failed" }
}
exit 0 # success
} catch {

View File

@ -20,7 +20,7 @@ try {
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
$LatestTagCommit = (git -C "$RepoDir" rev-list --tags --max-count=1)
$LatestTagName = (git -C "$RepoDir" describe --tags $LatestTagCommit)

View File

@ -19,7 +19,7 @@ try {
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
$Folders = (get-childItem "$ParentDir" -attributes Directory)
$FolderCount = $Folders.Count
@ -30,7 +30,7 @@ try {
$FolderName = (get-item "$Folder").Name
# & git -C "$Folder" fetch --tags
# if ($lastExitCode -ne "0") { throw "'git fetch --tags' failed" }
# if ($lastExitCode -ne 0) { throw "'git fetch --tags' failed" }
$LatestTagCommitID = (git -C "$Folder" rev-list --tags --max-count=1)
$LatestTag = (git -C "$Folder" describe --tags $LatestTagCommitID)

View File

@ -14,14 +14,14 @@ param([string]$pathToRepo = "$PWD", [string]$searchPattern = "origin/dev/*")
try {
"(1/3) Searching for Git executable... "
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
"(2/3) Checking local repository..."
if (!(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder: $pathToRepo" }
"(3/3) Querying already merged branches with name '$searchPattern'..."
$branches = $(git -C "$pathToRepo" branch --list --remotes --no-color --no-column --merged HEAD "$searchPattern")
if ($lastExitCode -ne "0") { throw "'git branch --list' failed" }
if ($lastExitCode -ne 0) { throw "'git branch --list' failed" }
""
"LAST COMMIT DATE BRANCH NAME"

View File

@ -18,7 +18,7 @@ param([string]$RepoDir = "$PWD")
try {
Write-Progress "(1/3) Searching for Git executable... "
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Progress "(2/3) Checking local repository..."
if (!(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
@ -26,14 +26,14 @@ try {
Write-Progress "(3/3) Fetching latest updates..."
& git -C "$RepoDir" fetch --all --force --quiet
if ($lastExitCode -ne "0") { throw "'git fetch --all' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch --all' failed with exit code $lastExitCode" }
Write-Progress -completed "Done."
" "
"Commit ID Reference"
"--------- ---------"
& git -C "$RepoDir" ls-remote origin 'pull/*/head'
if ($lastExitCode -ne "0") { throw "'git ls-remote' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git ls-remote' failed with exit code $lastExitCode" }
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -18,7 +18,7 @@ param([string]$RepoDir = "$PWD")
try {
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
$RepoDirName = (Get-Item "$RepoDir").Name
Write-Host "⏳ (2/4) Checking Git repository... 📂$RepoDirName"
@ -26,11 +26,11 @@ try {
Write-Host "⏳ (3/4) Fetching latest updates... "
& git -C "$RepoDir" fetch
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed" }
Write-Host "⏳ (4/4) Listing submodules... "
& git -C "$RepoDir" submodule
if ($lastExitCode -ne "0") { throw "'git submodule' failed" }
if ($lastExitCode -ne 0) { throw "'git submodule' failed" }
exit 0 # success
} catch {

View File

@ -25,25 +25,25 @@ param([string]$repoDir = "$PWD", [string]$searchPattern="*")
try {
Write-Progress "(1/4) Searching for Git executable... "
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Progress "(2/4) Checking local repository... "
if (-not(Test-Path "$repoDir" -pathType container)) { throw "Can't access directory: $repoDir" }
Write-Progress "(3/4) Fetching newer Git tags..."
& git -C "$repoDir" fetch --tags
if ($lastExitCode -ne "0") { throw "'git fetch --tags' failed" }
if ($lastExitCode -ne 0) { throw "'git fetch --tags' failed" }
Write-Progress "(4/4) Fetching out-dated Git tags..."
& git -C "$repoDir" fetch --prune-tags
if ($lastExitCode -ne "0") { throw "'git fetch --prune-tags' failed" }
if ($lastExitCode -ne 0) { throw "'git fetch --prune-tags' failed" }
Write-Progress -completed "Done."
""
"Tag Commit Message"
"--- --------------"
& git -C "$repoDir" tag --list "$searchPattern" -n
if ($lastExitCode -ne "0") { throw "'git tag --list' failed" }
if ($lastExitCode -ne 0) { throw "'git tag --list' failed" }
exit 0 # success
} catch {

View File

@ -31,35 +31,35 @@ try {
Write-Host "⏳ (1/6) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/6) Checking local repository... $pathToRepo"
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder: $pathToRepo" }
$result = (git -C "$pathToRepo" status)
if ($lastExitCode -ne "0") { throw "'git status' in $pathToRepo failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git status' in $pathToRepo failed with exit code $lastExitCode" }
$repoName = (Get-Item "$pathToRepo").Name
Write-Host "⏳ (3/6) Fetching remote updates... " -noNewline
& git -C "$pathToRepo" remote get-url origin
if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
& git -C "$pathToRepo" fetch --all --recurse-submodules --prune --prune-tags --force
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed with exit code $lastExitCode" }
$currentBranch = (git -C "$pathToRepo" rev-parse --abbrev-ref HEAD)
if ($lastExitCode -ne "0") { throw "'git rev-parse' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git rev-parse' failed with exit code $lastExitCode" }
"⏳ (4/6) Creating new branch..."
& git -C "$pathToRepo" checkout -b "$newBranch"
if ($lastExitCode -ne "0") { throw "'git checkout -b $newBranch' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git checkout -b $newBranch' failed with exit code $lastExitCode" }
"⏳ (5/6) Pushing updates..."
& git -C "$pathToRepo" push origin "$newBranch"
if ($lastExitCode -ne "0") { throw "'git push origin $newBranch' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git push origin $newBranch' failed with exit code $lastExitCode" }
"⏳ (6/6) Updating submodules..."
& git -C "$pathToRepo" submodule update --init --recursive
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git submodule update' failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Created branch '$newBranch' based on '$currentBranch' in 📂$repoName repo in $($elapsed)s."

View File

@ -23,7 +23,7 @@ try {
if ($target -eq "" ) { $target = Read-Host "Enter path to target" }
New-Item -path "$symlink" -itemType Junction -value "$target"
if ($lastExitCode -ne "0") { throw "Command 'New-Item' has failed" }
if ($lastExitCode -ne 0) { throw "Command 'New-Item' has failed" }
"✅ Created new junction '$symlink' linking to: $target"
exit 0 # success

View File

@ -15,7 +15,7 @@
try {
& ssh-keygen
if ($lastExitCode -ne "0") { throw "ssh-keygen failed" }
if ($lastExitCode -ne 0) { throw "ssh-keygen failed" }
if (Test-Path "~/.ssh/id_ed25519.pub") {
$publicKey = Get-Content "~/.ssh/id_ed25519.pub"

View File

@ -23,7 +23,7 @@ try {
if ($target -eq "" ) { $target = Read-Host "Enter path to target" }
New-Item -path "$symlink" -itemType SymbolicLink -value "$target"
if ($lastExitCode -ne "0") { throw "Command 'New-Item' has failed" }
if ($lastExitCode -ne 0) { throw "Command 'New-Item' has failed" }
"✅ Created new symlink '$symlink' linking to: $target"
exit 0 # success

View File

@ -26,20 +26,20 @@ try {
set-location "$RepoDir"
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
$Result = (git status)
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
if ($lastExitCode -ne 0) { throw "'git status' failed in $RepoDir" }
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
& "$PSScriptRoot/fetch-repo.ps1"
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
if ($lastExitCode -ne 0) { throw "Script 'fetch-repo.ps1' failed" }
& git tag "$TagName"
if ($lastExitCode -ne "0") { throw "Error: 'git tag $TagName' failed!" }
if ($lastExitCode -ne 0) { throw "Error: 'git tag $TagName' failed!" }
& git push origin "$TagName"
if ($lastExitCode -ne "0") { throw "Error: 'git push origin $TagName' failed!" }
if ($lastExitCode -ne 0) { throw "Error: 'git push origin $TagName' failed!" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ created new tag '$TagName' in $Elapsed sec"

View File

@ -38,39 +38,39 @@ try {
"🍒 Switching to branch $Branch ..."
& git checkout --recurse-submodules --force $Branch
if ($lastExitCode -ne "0") { throw "'git checkout $Branch' failed" }
if ($lastExitCode -ne 0) { throw "'git checkout $Branch' failed" }
"🍒 Updating submodules..."
& git submodule update --init --recursive
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
if ($lastExitCode -ne 0) { throw "'git submodule update' failed" }
"🍒 Cleaning the repository from untracked files..."
& git clean -fdx -f
if ($lastExitCode -ne "0") { throw "'git clean -fdx -f' failed" }
if ($lastExitCode -ne 0) { throw "'git clean -fdx -f' failed" }
& git submodule foreach --recursive git clean -fdx -f
if ($lastExitCode -ne "0") { throw "'git clean -fdx -f' in submodules failed" }
if ($lastExitCode -ne 0) { throw "'git clean -fdx -f' in submodules failed" }
"🍒 Pulling latest updates..."
& git pull --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
if ($lastExitCode -ne 0) { throw "'git pull' failed" }
"🍒 Checking the status..."
$Result = (git status)
if ($lastExitCode -ne "0") { throw "'git status' failed" }
if ($lastExitCode -ne 0) { throw "'git status' failed" }
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Branch is NOT clean: $Result" }
"🍒 Cherry picking..."
& git cherry-pick --no-commit "$CommitID"
if ($lastExitCode -ne "0") { throw "'git cherry-pick $CommitID' failed" }
if ($lastExitCode -ne 0) { throw "'git cherry-pick $CommitID' failed" }
"🍒 Committing..."
& git commit -m "$CommitMessage"
if ($lastExitCode -ne "0") { throw "'git commit' failed" }
if ($lastExitCode -ne 0) { throw "'git commit' failed" }
"🍒 Pushing..."
& git push
if ($lastExitCode -ne "0") { throw "'git push' failed" }
if ($lastExitCode -ne 0) { throw "'git push' failed" }
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✅ cherry picked $CommitID into $NumBranches branches in $Elapsed sec"

View File

@ -26,7 +26,7 @@ try {
Write-Host "⏳ (1/3) Searching for IPFS executable..." -NoNewline
& ipfs --version
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
if (test-path "$FilePattern" -pathType container) {
"⏳ (2/3) Publishing folder $FilePattern/..."

View File

@ -25,7 +25,7 @@ try {
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/4) Checking local repository... $pathToRepo"
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access folder: $pathToRepo" }
@ -35,14 +35,14 @@ try {
Write-Host "⏳ (3/4) Pulling remote updates... " -noNewline
& git -C "$pathToRepo" remote get-url origin
if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
& git -C "$pathToRepo" pull --recurse-submodules=yes
if ($lastExitCode -ne "0") { throw "'git pull' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git pull' failed with exit code $lastExitCode" }
Write-Host "⏳ (4/4) Updating submodules... "
& git -C "$pathToRepo" submodule update --init --recursive
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git submodule update' failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Updates pulled into 📂$pathToRepoName repo in $($elapsed)s."

View File

@ -24,7 +24,7 @@ try {
Write-Host "⏳ (1) Searching for Git executable...`t`t" -NoNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2) Checking parent folder...`t`t" -NoNewline
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access folder: $parentDir" }
@ -40,10 +40,10 @@ try {
Write-Host "⏳ ($step/$($numFolders + 2)) Pulling into 📂$folderName...`t`t" -NoNewline
& git -C "$folder" pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { $failed++; write-warning "'git pull' in 📂$folderName failed" }
if ($lastExitCode -ne 0) { $failed++; write-warning "'git pull' in 📂$folderName failed" }
& git -C "$folder" submodule update --init --recursive
if ($lastExitCode -ne "0") { throw "'git submodule update' in 📂$folder failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git submodule update' in 📂$folder failed with exit code $lastExitCode" }
$step++
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds

View File

@ -28,18 +28,18 @@ try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
if (($Mode -eq "locally") -or ($Mode -eq "both")) {
"Removing local tag..."
& git -C "$RepoDir" tag --delete $TagName
if ($lastExitCode -ne "0") { throw "'git tag --delete' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git tag --delete' failed with exit code $lastExitCode" }
}
if (($Mode -eq "remote") -or ($Mode -eq "both")) {
"Removing remote tag..."
& git -C "$RepoDir" push origin :refs/tags/$TagName
if ($lastExitCode -ne "0") { throw "'git push origin' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git push origin' failed with exit code $lastExitCode" }
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds

View File

@ -26,10 +26,10 @@ try {
if (-not(Test-Path "$path" -pathType container)) { throw "Can't access Git repository at: $path" }
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
& git -C "$path" grep $textPattern
if ($lastExitCode -ne "0") { throw "'git grep' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git grep' failed with exit code $lastExitCode" }
exit 0 # success
} catch {

View File

@ -16,33 +16,33 @@ try {
Write-Host "⏳ (1/5) Searching for IPFS executable... " -noNewline
& ipfs --version
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
"⏳ (2/5) Init IPFS with profile 'lowpower'..."
& ipfs init --profile lowpower
"⏳ (3/5) Configuring IPFS..."
& ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
if ($lastExitCode -ne "0") { throw "'ipfs config Addresses.API' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ipfs config Addresses.API' failed with exit code $lastExitCode" }
& ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8765
if ($lastExitCode -ne "0") { throw "'ipfs config Addresses.Gateway' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ipfs config Addresses.Gateway' failed with exit code $lastExitCode" }
$Hostname = $(hostname)
& ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '[\"http://miami:5001\", \"http://localhost:3000\", \"http://127.0.0.1:5001\", \"https://webui.ipfs.io\"]'
if ($lastExitCode -ne "0") { throw "'ipfs config Access-Control-Allow-Origin' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ipfs config Access-Control-Allow-Origin' failed with exit code $lastExitCode" }
& ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"POST\"]'
if ($lastExitCode -ne "0") { throw "'ipfs config Access-Control-Allow-Methods' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ipfs config Access-Control-Allow-Methods' failed with exit code $lastExitCode" }
& ipfs config --json AutoNAT.Throttle.GlobalLimit 1 # (30 by default)
if ($lastExitCode -ne "0") { throw "'ipfs config AutoNAT.Throttle.GlobalLimit 1' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ipfs config AutoNAT.Throttle.GlobalLimit 1' failed with exit code $lastExitCode" }
& ipfs config --json AutoNAT.Throttle.PeerLimit 1 # (3 by default)
if ($lastExitCode -ne "0") { throw "'ipfs config AutoNAT.Throttle.PeerLimit 1' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'ipfs config AutoNAT.Throttle.PeerLimit 1' failed with exit code $lastExitCode" }
""
Write-Host "⏳ (4/5) Increasing UDP receive buffer size..." -noNewline
& sudo sysctl -w net.core.rmem_max=2500000
if ($lastExitCode -ne "0") { throw "'sysctl' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'sysctl' failed with exit code $lastExitCode" }
"⏳ (5/5) Starting IPFS daemon..."
# Start-Process nohup 'ipfs daemon'
Start-Process nohup -ArgumentList 'ipfs','daemon' -RedirectStandardOutput "$HOME/console.out" -RedirectStandardError "$HOME/console.err"

View File

@ -25,18 +25,18 @@ try {
Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/4) Checking local repository... $path"
if (!(Test-Path "$path" -pathType container)) { throw "Can't access folder: $path" }
Write-Host "⏳ (3/4) Pulling remote updates... " -noNewline
& git -C "$path" pull --all --recurse-submodules
if ($lastExitCode -ne "0") { throw "'git pull --all --recurse-submodes' failed" }
if ($lastExitCode -ne 0) { throw "'git pull --all --recurse-submodes' failed" }
Write-Host "⏳ (4/4) Pushing local updates... " -noNewline
& git -C "$path" push
if ($lastExitCode -ne "0") { throw "'git push' failed" }
if ($lastExitCode -ne 0) { throw "'git push' failed" }
$pathName = (Get-Item "$path").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds

View File

@ -23,7 +23,7 @@ param([string]$pathToRepo = "$PWD", [int]$updateInterval = 60, [int]$speed = 10)
try {
Write-Progress "Searching for Git executable..."
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Progress "Checking local Git repository..."
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access directory: $pathToRepo" }
@ -36,10 +36,10 @@ try {
$tzOffset = (Get-Timezone).BaseUtcOffset.TotalSeconds
for (;;) {
& git -C "$pathToRepo" fetch --all --recurse-submodules=no --jobs=1 --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
if ($lastExitCode -ne 0) { throw "'git fetch' failed" }
$line = (git -C "$pathToRepo" log origin --format=format:'%at %s by %an%d' --max-count=1)
if ($lastExitCode -ne "0") { throw "'git log origin' failed" }
if ($lastExitCode -ne 0) { throw "'git log origin' failed" }
if ("$line" -eq "$prevLine") { Start-Sleep -seconds $updateInterval; continue }
$unixTimestamp = [int64]$line.Substring(0,10)

View File

@ -25,7 +25,7 @@ try {
Write-Progress "(1/6) Searching for Git executable..."
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Progress "(2/6) Checking local repository..."
if (!(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
@ -33,7 +33,7 @@ try {
Write-Progress "(3/6) Fetching the latest commits..."
& git -C "$RepoDir" fetch --all --force --quiet
if ($lastExitCode -ne "0") { throw "'git fetch --all' failed with exit code $lastExitCode" }
if ($lastExitCode -ne 0) { throw "'git fetch --all' failed with exit code $lastExitCode" }
Write-Progress "(4/6) Listing all Git commit messages..."
$commits = (git -C "$RepoDir" log --boundary --pretty=oneline --pretty=format:%s | sort -u)