Skip to content

Commit e826c32

Browse files
authored
Merge pull request #42 from kmwoley/release_1_4_1
Release 1.4.1
2 parents d7cc581 + 58558a6 commit e826c32

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
# Changelog
22

3+
## [1.4.1](https://github.com/kmwoley/restic-windows-backup/tree/1.4.1) (2021-05-29)
4+
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.4...1.4.1)
5+
6+
Bugfix release.
7+
8+
## Fixes
9+
- Improved URL parsing so that the internet connectivity check works if the URL doesn't provide a protocol
10+
- Add PowerShell 7.1 support to internet connectivity check
11+
12+
## Enhancements
13+
- Setting $InternetTestAttempts to 0 will now bypass the internet connectivity checks entirely
14+
315
## [1.4](https://github.com/kmwoley/restic-windows-backup/tree/1.4) (2021-02-24)
4-
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.3...HEAD)
16+
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.3...1.4)
517

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

backup.ps1

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function Invoke-Backup {
140140
# Build the new list of folders from settings (if there are any)
141141
$folder_list = New-Object System.Collections.Generic.List[System.Object]
142142
ForEach ($path in $item.Value) {
143-
$p = Join-Path $root_path $path
143+
$p = '"{0}"' -f ((Join-Path $root_path $path) -replace "\\$")
144144
$folder_list.Add($p)
145145
}
146146

@@ -209,9 +209,15 @@ function Send-Email {
209209

210210
function Invoke-ConnectivityCheck {
211211
Param($SuccessLog, $ErrorLog)
212+
213+
if($InternetTestAttempts -le 0) {
214+
Write-Output "[[Internet]] Internet connectivity check disabled. Skipping." | Tee-Object -Append $SuccessLog
215+
return $true
216+
}
217+
212218
# skip the internet connectivity check for local repos
213219
if(Test-Path $env:RESTIC_REPOSITORY) {
214-
Write-Output "[[Internet]] Skipping internet connectivity check." | Tee-Object -Append $SuccessLog
220+
Write-Output "[[Internet]] Local repository. Skipping internet connectivity check." | Tee-Object -Append $SuccessLog
215221
return $true
216222
}
217223

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

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

0 commit comments

Comments
 (0)