Skip to content

Commit

Permalink
Merge pull request #42 from kmwoley/release_1_4_1
Browse files Browse the repository at this point in the history
Release 1.4.1
  • Loading branch information
kmwoley authored May 10, 2021
2 parents d7cc581 + 58558a6 commit e826c32
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Changelog

## [1.4.1](https://github.com/kmwoley/restic-windows-backup/tree/1.4.1) (2021-05-29)
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.4...1.4.1)

Bugfix release.

## Fixes
- Improved URL parsing so that the internet connectivity check works if the URL doesn't provide a protocol
- Add PowerShell 7.1 support to internet connectivity check

## Enhancements
- Setting $InternetTestAttempts to 0 will now bypass the internet connectivity checks entirely

## [1.4](https://github.com/kmwoley/restic-windows-backup/tree/1.4) (2021-02-24)
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.3...HEAD)
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.3...1.4)

Moved to using Restic's inbuilt filesystem shadow copy creation (VSS).

Expand Down
20 changes: 15 additions & 5 deletions backup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function Invoke-Backup {
# Build the new list of folders from settings (if there are any)
$folder_list = New-Object System.Collections.Generic.List[System.Object]
ForEach ($path in $item.Value) {
$p = Join-Path $root_path $path
$p = '"{0}"' -f ((Join-Path $root_path $path) -replace "\\$")
$folder_list.Add($p)
}

Expand Down Expand Up @@ -209,9 +209,15 @@ function Send-Email {

function Invoke-ConnectivityCheck {
Param($SuccessLog, $ErrorLog)

if($InternetTestAttempts -le 0) {
Write-Output "[[Internet]] Internet connectivity check disabled. Skipping." | Tee-Object -Append $SuccessLog
return $true
}

# skip the internet connectivity check for local repos
if(Test-Path $env:RESTIC_REPOSITORY) {
Write-Output "[[Internet]] Skipping internet connectivity check." | Tee-Object -Append $SuccessLog
Write-Output "[[Internet]] Local repository. Skipping internet connectivity check." | Tee-Object -Append $SuccessLog
return $true
}

Expand All @@ -233,9 +239,13 @@ function Invoke-ConnectivityCheck {
}
else {
# parse connection string for hostname
# Uri parser doesn't handle leading connection type info (s3:, sftp:, rest:)
# Uri parser doesn't handle leading connection type info (s3:, sftp:, rest:)
$connection_string = $env:RESTIC_REPOSITORY -replace "^s3:" -replace "^sftp:" -replace "^rest:"
$repository_host = ([System.Uri]$connection_string).host
if(-not ($connection_string -match "://")) {
# Uri parser expects to have a protocol. Add 'https://' to make it parse correctly.
$connection_string = "https://" + $connection_string
}
$repository_host = ([System.Uri]$connection_string).DnsSafeHost
}

if([string]::IsNullOrEmpty($repository_host)) {
Expand All @@ -256,7 +266,7 @@ function Invoke-ConnectivityCheck {
Write-Output "[[Internet]] Waiting for internet connectivity... $sleep_count" | Tee-Object -Append $SuccessLog
Start-Sleep 30
}
elseif(!(Test-Connection -Server $repository_host -Quiet)) {
elseif(!(Test-Connection -ComputerName $repository_host -Quiet)) {
Write-Output "[[Internet]] Waiting for connection to repository ($repository_host)... $sleep_count" | Tee-Object -Append $SuccessLog
Start-Sleep 30
}
Expand Down

0 comments on commit e826c32

Please sign in to comment.