15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,5 +1,19 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.2](https://github.com/kmwoley/restic-windows-backup/tree/HEAD)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.1...HEAD)
|
||||||
|
|
||||||
|
* Internet connectivity test now supports more repository types (s3:, sftp:, rest:, azure:, gs:), and ignores unsupported (swift:, rclone: and local)
|
||||||
|
* Add 32-bit support in the `install.ps1`
|
||||||
|
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Use non-s3 repos [\#10](https://github.com/kmwoley/restic-windows-backup/issues/10)
|
||||||
|
- Test-Connection fails [\#9](https://github.com/kmwoley/restic-windows-backup/issues/9)
|
||||||
|
- Add changelog [\#1](https://github.com/kmwoley/restic-windows-backup/issues/1)
|
||||||
|
|
||||||
## [1.1](https://github.com/kmwoley/restic-windows-backup/tree/1.1) (2020-02-15)
|
## [1.1](https://github.com/kmwoley/restic-windows-backup/tree/1.1) (2020-02-15)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.0...1.1)
|
[Full Changelog](https://github.com/kmwoley/restic-windows-backup/compare/1.0...1.1)
|
||||||
@@ -21,6 +35,7 @@ $SendEmailOnError = $true
|
|||||||
|
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- add changelog [\#6](https://github.com/kmwoley/restic-windows-backup/pull/6) ([kmwoley](https://github.com/kmwoley))
|
||||||
- add options to enable/disable email sending and maintenance [\#4](https://github.com/kmwoley/restic-windows-backup/pull/4) ([kmwoley](https://github.com/kmwoley))
|
- add options to enable/disable email sending and maintenance [\#4](https://github.com/kmwoley/restic-windows-backup/pull/4) ([kmwoley](https://github.com/kmwoley))
|
||||||
|
|
||||||
## [1.0](https://github.com/kmwoley/restic-windows-backup/tree/1.0) (2020-02-09)
|
## [1.0](https://github.com/kmwoley/restic-windows-backup/tree/1.0) (2020-02-09)
|
||||||
|
|||||||
19
backup.ps1
19
backup.ps1
@@ -212,20 +212,29 @@ function Send-Email {
|
|||||||
|
|
||||||
function Invoke-ConnectivityCheck {
|
function Invoke-ConnectivityCheck {
|
||||||
Param($SuccessLog, $ErrorLog)
|
Param($SuccessLog, $ErrorLog)
|
||||||
|
# Skip the internet connectivity check unsupported repo types (i.e. swift:, rclone:, or local )
|
||||||
|
if(($env:RESTIC_REPOSITORY -match "^swift:") -or ($env:RESTIC_REPOSITORY -match "^rclone:") -or (Test-Path $env:RESTIC_REPOSITORY)) {
|
||||||
|
Write-Output "[[Internet]] Skipping internet connectivity check." | Tee-Object -Append $SuccessLog
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
|
||||||
# parse connection string for hostname
|
# parse connection string for hostname
|
||||||
# TODO: handle non-s3 repositories
|
# Uri parser doesn't handle leading connection type info (s3:, sftp:, rest:, azure:, gs:)
|
||||||
# Uri parser doesn't handle leading connection type info
|
$connection_string = $env:RESTIC_REPOSITORY -replace "^s3:" -replace "^sftp:" -replace "^rest:" -replace "^azure:" -replace "^gs:"
|
||||||
$connection_string = $env:RESTIC_REPOSITORY -replace "s3:"
|
|
||||||
$repository_host = ([System.Uri]$connection_string).host
|
$repository_host = ([System.Uri]$connection_string).host
|
||||||
|
|
||||||
|
if([string]::IsNullOrEmpty($repository_host)) {
|
||||||
|
Write-Output "[[Internet]] Repository string could not be parsed." | Tee-Object -Append $SuccessLog | Tee-Object -Append $ErrorLog
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
# test for internet connectivity
|
# test for internet connectivity
|
||||||
$connections = 0
|
$connections = 0
|
||||||
$sleep_count = $InternetTestAttempts
|
$sleep_count = $InternetTestAttempts
|
||||||
while($true) {
|
while($true) {
|
||||||
$connections = Get-NetRoute | Where-Object DestinationPrefix -eq '0.0.0.0/0' | Get-NetIPInterface | Where-Object ConnectionState -eq 'Connected' | Measure-Object | ForEach-Object{$_.Count}
|
$connections = Get-NetRoute | Where-Object DestinationPrefix -eq '0.0.0.0/0' | Get-NetIPInterface | Where-Object ConnectionState -eq 'Connected' | Measure-Object | ForEach-Object{$_.Count}
|
||||||
if($sleep_count -le 0) {
|
if($sleep_count -le 0) {
|
||||||
Write-Output "[[Internet]] Connection to repository could not be established." | Tee-Object -Append $SuccessLog | Tee-Object -Append $ErrorLog
|
Write-Output "[[Internet]] Connection to repository ($repository_host) could not be established." | Tee-Object -Append $SuccessLog | Tee-Object -Append $ErrorLog
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
if(($null -eq $connections) -or ($connections -eq 0)) {
|
if(($null -eq $connections) -or ($connections -eq 0)) {
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
|
|
||||||
# download restic
|
# download restic
|
||||||
if(-not (Test-Path $ResticExe)) {
|
if(-not (Test-Path $ResticExe)) {
|
||||||
$url = "https://github.com/restic/restic/releases/download/v0.9.6/restic_0.9.6_windows_amd64.zip"
|
$url = $null
|
||||||
|
if([Environment]::Is64BitOperatingSystem){
|
||||||
|
$url = "https://github.com/restic/restic/releases/download/v0.9.6/restic_0.9.6_windows_amd64.zip"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "https://github.com/restic/restic/releases/download/v0.9.6/restic_0.9.6_windows_386.zip"
|
||||||
|
}
|
||||||
$output = Join-Path $InstallPath "restic.zip"
|
$output = Join-Path $InstallPath "restic.zip"
|
||||||
Invoke-WebRequest -Uri $url -OutFile $output
|
Invoke-WebRequest -Uri $url -OutFile $output
|
||||||
Expand-Archive -LiteralPath $output $InstallPath
|
Expand-Archive -LiteralPath $output $InstallPath
|
||||||
|
|||||||
Reference in New Issue
Block a user