Skip to content

Releases: Chucky2401/Restic-Scripts

Pre-Release v3.0 Beta 2

21 May 16:53
6dc2dde
Compare
Choose a tag to compare
Pre-release

Beta 2!

Hello everyone!

Today, new beta release! To be honest, I would like to release this one sooner, but I told myself it was not fair as the update was very small.

So, I come to you with a middle update (some modesty). I change a little thing, but add some things very interesting.

The change is now the -TagFilter has been renamed to -IncludeTag, but I added the parameter -ExcludeTag very interesting when you want to remove snapshots with the tag 'stopped', but one snapshot has the tag 'keep' and you want to keep it. That's the purpose of the new parameter.

The big change is now, you can use the remove action in the menu to remove specifics snapshots. Imagine, you don't want to clean the oldest snapshots, but you have one snapshots, in the middle of the list, that you don't want to keep, because you restored it. With this new action, and the associate script Remove-ResticSnapshots.ps1 you can!

I hope you will love these changes!

New

  • (Clean-Restic): Add parameter -ExcludeTag
  • (Get-ResticSnapshots): ability to choose tag to exclude before calling the script to clean
  • (Get-ResticSnapshots): add parameter -Listing which show snapshots list and quit
  • (Remove-ResticSnapshots): let you remove one or some specific snapshots!
  • (Get-ResticSnapshots): let you call Remove-ResticSnapshots after you choose the snapshots to remove

Change

  • (Clean-Restic): rename parameter -TagFilter to -IncludeTag

Changelog

Only relevant commit

  • ae30c7c - feat(Clean-Restic): rename parameter -TagFilter to -IncludeTag.
  • 5e86325 - feat: implement new parameter -ExcludeTag to Clean-Restic
  • eeab12e - feat(Get-ResticGameSnapshots): add possibility to choose exclude tag filter
  • 322ecfc - feat(Get-ResticGameSnapshots): add -Listing parameter which show snapshots list and quit.
  • bef2b18 - feat: script to remove specific Restic snapshots!
  • f306443 - feat(Get-ResticGameSnapshots): implement Remove in the menu!

Pre-Release v3.0 Beta 1

14 May 18:10
817987a
Compare
Choose a tag to compare
Pre-release

v3.0-Beta.1

Hello folks!

Surprise! Yes! Today new release! But, this time a pre-release, because I would like to add a lot of more things to this version 3.0.
I will not waste your time and I will explain you the major update and what next!

In this pre-release, you will be able to launch the cleaning of your snapshots directly from the script Get-ResticSnapshots. After you have the list of the snapshots, it will be asked to choose filter (eg: gameplay, stopped) or just cancel if you don't want to filter. It will be asked you to input a number of snapshots to keep. By default, it will be the number of snapshots defined in your settings file.

Just after, the Clean-Restic will start, and you'll be back to the snapshots list. You can choose to run another cleaning or quit.

The Delete option is not develop for the moment, just present.

I just want to be clear, when you choose the filter, if you choose gameplay and manual, it will remove both snapshots. If I have three snapshots, one with manual, one with gameplay and one with stopped, at the end, only one snapshots will remain, the stopped one.

And yes, you understand, you can use Clean-Restic with several filter! Like this:

.\Clean-Restic.ps1 -Game "Hogwarts Legacy" -TagFilter "gameplay", "manual"

That's all for this first pre-release!

See you soon 😉!

New

  • (Get-ResticSnapshots): after the list of snapshots appear, you can now choose to run the clean step. The script will ask you to choose filter, or not, and the number of snapshots to keep. After this step, you will be back to choose to clean, or you can quit.

Change

  • (Clean-Restic): you can now pass multiple tag to the -TagFilter parameter. Example: if you yse -TagFilter "gameplay", "manual" the snapshots that have the tag gameplay or manual will be deleted.

Changelog

Only relevant commit

  • df3c662 - feat(Clean-Restic): can use multiple different filters!
  • 681d4a1 - feat: add possibility to clean snapshots from Get-ResticGameSnapshots!

What's Changed

Full Changelog: v2.1...v3.0-Beta.1

Release version 2.1!

11 May 21:21
0e24b7f
Compare
Choose a tag to compare

Hello all!

Minor update today, with, I think, some good features! I will try to explain it simply 😉

Clean-Restic

We start with the small one.

A useful modification is that now you can use the parameter SnapshotToKeep with a value equal to 0! Before, when you set at 0, the script use the default value. But, sometime we need to remove all snapshots, even more so when using the TagFilter parameter.

A visual enhancement, now you have a progress bar instead of a new line of message showing that the snapshot has been removed or not. I keep the error message only.

The TagFilter parameter was badly used and ignore all snapshots. But, the worst bug was the functions that show message, was not properly used, and block the script completely!

Get-ResticGameSnapshots

You can type 'q' to quit the script before choosing a game! Sometimes I just want to see how many snapshots have my games! But, by the way, I added the parameter CountOnly to only show game list with number of snapshots!
I add the parameter Game "Game Name" to not have to choose in the script. But, you have to write the game name correctly.

Miscellaneous

I update some local message to be better. obviously, I added some new message with the new features!

Environment to use restic manually

The best update of this release 😄 !

In the previous update, I told you you can import modules settings and restic, set the settings variable, and the environment with the settings variable. After, you will have to remove environment before removing modules.
It's over!
Now, you just have to import the module restic this way:

Import-Module -Name "C:\path\to\inc\modules\Tjvs.Restic"

Automatically, the Settings module will be imported, the settings variable will be created and the environment set! And, when you have done, you can just remove the module Restic, and the environment will be removed automatically for security purpose, as the password and the path to the repo are stored in the environment var. I don't remove the module settings automatically, I was thinking about it, but it's not importe right now.

That's all for today! I hope these enhancements enjoyed you!
You can see some of these change with animated gif:

Feel free to create new issues if you want new features or you have a bug! Don't forget to attached your log file for bug.


Log

Only relevant commit

  • 4e53345 - feat(Clean-Restic): You can remove all snapshots
  • 4b10aa7 - chore(settings): Better translation for stats parameter
  • 6edc7b4 - chore: add local accordingly to new feature for commit 2fdcc3d
  • 2fdcc3d - feat(Get-ResticGameSnapshots): able to quit at game choice
  • 291187c - chore: better local message for english message
  • b6e4796 - chore(Tjvs.Settings): add creation of settings var
  • d71a1d0 - feat(Clean-Restic): visual update for the remove steps. Easier to understand and less useless messages
  • 8e78af6 - feat(Tjvs.Restic): add Tjvs.Settings modules as required
  • b107912 - feat(Tjvs.Restic): Set-Environment call when module is imported. Call Remove-Environment when module is removed
  • f867394 - feat(Get-ResticGameSnapshots): add parameters CountOnly and Game.

What's Changed

Full Changelog: v2.0...v2.1

Release version 2.0!

06 Jan 18:41
d676c58
Compare
Choose a tag to compare

Hello everyone!

Big update today! First, I will describe major changes and all the changes.

Major changes

Modules and environment

As you know, in the previous release I put all my functions into modules. It was useful, but only for me, I guess.
In the previous version of the script, I used several variables to run Restic, the password and the repository path.
But, I used Restic outside these scripts, so I work on another solution. And, in fact, Restic can use envrionment variable! So, I created two new functions in the Tjvs.Restic module!
So now, you have these functions:

  • Set-Environment: create the environment variable to use Restic
  • Remove-Environment: remove the variable, because password is clear

For the moment you have to pass manually your settings.
So you have to use it like below:

Import-Module -Name "C:\path\to\inc\modules\Tjvs.Settings", "C:\path\to\inc\modules\Tjvs.Restic"

$Settings = Get-Settings "C:\path\to\conf\settings.json"

Set-Environment -Settings $Settings

<#
 # Run your Restic command
 #>

Remove-Environment

I will add that Get-Environment get the settings if you don't use the parameter later

Settings in json format

I previously use a custom functions with an ini file for settings. But, I find this solution dicey.
So, I convert to a json file.
Don't worry! Maybe you don't like, or just don't know this format I thought of everything!

Download all the files in this repository. Remove the settings.json file, because it's mine settings 😆, and juste run one of the PowerShell script! It will ask you some questions to create the settings file!

In the file, you will find entries that start with double underscore, they are the help lines for the settings with the same name.

Language

And the last but not the least, the script support English and French!
In particular culture en-US and fr-FR. You can check yours with: (Get-Culture).Name.

If you want to translate these scripts, let me know with a new issue! You can check in the local folder, I tried to comment a lot to be easily to understand.

Little demo

Just to show you the news, just below some animated gif for demo.
The first one in English, and the second one in French!

EN Demo

EN_Demo

FR Demo

FR_Demo

Complete Changelog

New

  • Add two function to Set and Remove Restic enivronment
    • Yes, environment variables are used now instead of files or script variable. You can import this module in a PowerShell session to use it manually!
  • Script is loclized now! Your language is french? Script is in french now!
    • Precisely, the script will manage en-US and fr-FR. Feel free to ask me for a new language!

Change

  • Rename func folder into modules
  • Replace Microsoft cmdlet Start-Process by the custom command Start-Command which use .Net
  • Using a json file instead of ini file
    • If the file settings.json does not exist, the script will ask questions to create it! Thinking for people don't know (or like 😋) the json!
    • The setting file is test before run to be sure everything is consistent

Fix

  • Some typo

I hope you find this modification very interesting!
Please let me know 😉

What's Changed

Full Changelog: v1.2.1...v2.0

Version 1.2.1

14 Dec 11:10
b8cf702
Compare
Choose a tag to compare

Hello!

New little release of these scripts! Security purpose and simplification!

Change explanation

Password security

At the beginning, I used the parameter --password-file to pass the repository password to restic. But, the password was stored clearly in a temporary text file, not very secured...
So, I decided to try to use the parameter --password-command, and I succeed!
First, I had to understand that restic need a valid program path (.exe) and not a cmdlet. But, as PowerShell need a lot of double quote, it was a mess... But, I find that if I encode the command to pass to powershell.exe it works! Unfortunately, the encoded command can be decoded easily with this code:

[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($sEncodedCommand))

Anyway, the password is not clearly accessible anywhere right now. So, if someone try to hack your password, he needs to have access to your PC and the memory while the script is running.

Other changes

Two more changes in the code.

First, I wrote some shared functions directly in the different scripts. But, any modification need to be reported to the other script, not easy.
I think to put the functions in files (each per functions) but not the best way, I though.
So, I created modules. Module is, I think (too many "I think" in this paragraph), modular! I just have to write one line in the script to add a function, several functions or all of it! And, I have the same advantage of the dot-sourcing: if I change something in a function, it's good for all my scripts!

Finally, the last but not the least, I decided to use a single and shared settings file. Instead of one setting file per script (scriptName.ps1.ini) just one is necessary.
I think I will enhance this part too, in the future 😉 !

Changelog

Change

  • Use the parameter --password-command instead of --password-file in the restic parameters
    • The clear command is Write-Host $($oCredentials.GetNetworkCredential().Password) ; It is encoded before set in the variable to be able to use it
  • Replace all shared function write directly in scripts by different modules
    • Tjvs.Message: functions used to write or out message respectively on the console or in file
    • Tjvs.Process: functions to work with the process restic
    • Tjvs.Restic: functions to get information or convert information from restic
    • Tjvs.Settings: functions to work with the settings of the scripts
  • Use a shared settings file instead of one by script, as the settings are the same

Log

  • 9eab4a7 feat(main): Password passed to Restic
  • eef2897 feat(main): PowerShell modules
  • 58fdbbd feat(main): Use a shared settings file instead of one

Full Changelog: https://github.com/Chucky2401/Restic-Scripts/blob/main/CHANGELOG.md

Clean-Restic v1.1

31 Jul 17:01
e832fe6
Compare
Choose a tag to compare

Clean-Restic: the little update

I need to clean some of my snapshots, but only the one with the tag 'gameplay', for my snapshots during the game.

So I add the parameter 'TagFilter' to be able to do that.
By the way, I fix the stats that did not show the size of files or blobs.

Little update 😄

Changelog

2022.07.31

New

  • Add the parameter TagFilter to filter snapshot of the game

Fix

  • Stats didn't return size

Get Snapshots - Beta 2

31 Jul 17:25
e71695c
Compare
Choose a tag to compare
Pre-release

Get-Snapshot: the little update

Yeah! A second little update! But this time for the Get-Snapshot script and branch!

This time, in addition to the merge from the Clean-Restic v1.1, I write the help header of the script!
You are now able to use the Get-Help PowerShell cmdlet!

For those who did not see the previous beta, click here.

Changelog

2022.07.31

New

  • Add the parameter TagFilter to filter snapshot of the game in Clean-Restic
  • Add the help header in Get-ResticGameSnapshots to be able to use Get-Help PowerShell cmdlet

Get Snapshots - Beta Release

28 Jul 12:18
4f177c0
Compare
Choose a tag to compare
Pre-release

Get snapshots first beta release

I'm proud to propose you my first version of the PowerShell script that list all snapshots with all the details of a game backup into Restic!

This script will first get all the game into Restic, ask you the game and show you all the snapshots for this game with the stats details.
Easy to use and no parameter!

In the future, this script will ask you what to do with the specific snapshots!
Wait and see!

Caution:

  • I must do some change in Clean-Restic script, please update it if you want to try this beta version
  • This is a beta release!

Complete Changelog

2022.07.28

New

  • Get-ResticGameSnapshots.ps1
    • List game in Restic
    • Ask user the game
    • Retrieve snapshots for the game
  • Use .\inc\func\Start-Command.ps1 to call Restic and output
    • Dot sourced in Get-ResticGameSnapshots.ps1
  • Import .\inc\Format\ResticControl.format.ps1xml into Get-ResticGameSnapshots.ps1
  • Add function Read-SnapshotChoice to be able to ask to the use the snapshot to remove or restore
  • Add function Get-SnapshotDetail to retrieve stats about a snapshot
  • Get snapshots stats in a new array
  • Add Tjvs.Restic.SnapshotsStats in .\inc\Format\ResticControl.format.ps1xml

Change

  • Move functions ConvertTo-HashtableSize to .\inc\func\ConvertTo-HashtableSize.ps1 and ConvertTo-ResticStatsCustomObject to .\inc\func\ConvertTo-ResticStatsCustomObject.ps1
    • Dot sourced in Clean-Restic.ps1 and Get-ResticGameSnapshots.ps1
  • Move ResticControl.format.ps1xml from .\inc\ to .\inc\format\
  • Dot sourced .\inc\func\Start-Command.ps1 in Clean-Restic
  • Use Start-Command function in ConvertTo-ResticStatsCustomObject
  • Rename ConvertTo-ResticStatsCustomObject to Get-ResticStats
  • Add control format for the snapshots details object (Tjvs.Restic.SnapshotsStats)
  • Remove temporary files used by Start-Process
  • Remove --json parameter in the variable $sCommonResticArguments
  • Can pass SnapshotId to Get-ResticStats
  • README
  • CHANGELOG

Fix

  • Put the var back to Start-Process cmdlet into ConverTo-HashtableSize because the return of the function returned the Process.Information
  • Read-GameChoice in Get-ResticGameSnapshots.ps1: cast the Read-Choice to an int
  • Condition in Where-Object of the script block of sbFileSizeInString and sbBlobSizeInString: value greater or equal 1 instead of greater than 0 to avoid two results

First release

18 Jul 20:13
Compare
Choose a tag to compare

I'm pleased to announce you the first public release of my script!

You will find in the README.md and CHANGELOG.md all the information you need to use it!

If you find some issues or you want to suggest enhancement, feel free to open a GitHub Issues!