├── .github └── workflows │ ├── release.yml │ ├── tag.yml │ └── test.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── flake.lock ├── flake.nix ├── misc ├── wr_dark.svg ├── wr_light.svg └── wrestic_mockup.png ├── src ├── macros │ ├── errors.rs │ └── mod.rs ├── main.rs ├── modules │ ├── backup.rs │ ├── cache.rs │ ├── check.rs │ ├── custom.rs │ ├── delete.rs │ ├── initialize.rs │ ├── mod.rs │ ├── repair.rs │ ├── restore.rs │ ├── selector.rs │ ├── snapshots.rs │ └── update.rs └── utils │ ├── get_config.rs │ ├── get_current_shell.rs │ ├── get_user.rs │ ├── mod.rs │ ├── restic_checker.rs │ ├── root_checker.rs │ ├── set_environment_variables.rs │ ├── snapshots_selector.rs │ └── tools.rs ├── vhs ├── wrestic.gif └── wrestic.tape └── wrestic.toml /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "Release" 2 | 3 | permissions: 4 | contents: "write" 5 | 6 | on: 7 | workflow_run: 8 | workflows: ["Tag"] 9 | types: 10 | - "completed" 11 | 12 | jobs: 13 | get-tag: 14 | name: "Get Tag From Package Version" 15 | runs-on: "ubuntu-latest" 16 | outputs: 17 | pkg-version: ${{ steps.pkg-version.outputs.PKG_VERSION }} 18 | steps: 19 | - name: "Check out the repo" 20 | uses: actions/checkout@v3 21 | with: 22 | token: ${{ secrets.GITHUB_TOKEN }} 23 | 24 | - name: "Get tag" 25 | id: "pkg-version" 26 | shell: "bash" 27 | run: | 28 | echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT 29 | 30 | create-release: 31 | name: "Create release" 32 | if: ${{ github.event.workflow_run.conclusion == 'success' }} 33 | needs: "get-tag" 34 | runs-on: "ubuntu-latest" 35 | steps: 36 | - name: "Check out the repo" 37 | uses: actions/checkout@v3 38 | 39 | - name: "Create release" 40 | uses: "taiki-e/create-gh-release-action@v1" 41 | with: 42 | # (optional) Path to changelog. 43 | # changelog: CHANGELOG.md 44 | branch: "main" 45 | ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }} 46 | token: ${{ secrets.GITHUB_TOKEN }} 47 | 48 | upload-assets: 49 | name: "Upload assets to Github releases" 50 | if: ${{ github.event.workflow_run.conclusion == 'success' }} 51 | needs: 52 | - "get-tag" 53 | - "create-release" 54 | strategy: 55 | matrix: 56 | include: 57 | - target: "x86_64-unknown-linux-musl" 58 | os: "ubuntu-latest" 59 | # - target: "x86_64-unknown-linux-gnu" 60 | # os: "ubuntu-latest" 61 | runs-on: ${{ matrix.os }} 62 | steps: 63 | - name: "Check out the repo" 64 | uses: actions/checkout@v3 65 | 66 | - name: "Upload Binaries" 67 | uses: "taiki-e/upload-rust-binary-action@v1" 68 | with: 69 | bin: "wrestic" 70 | target: ${{ matrix.target }} 71 | archive: $bin 72 | # archive: $bin-${{ matrix.target }} 73 | ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }} 74 | token: ${{ secrets.GITHUB_TOKEN }} 75 | -------------------------------------------------------------------------------- /.github/workflows/tag.yml: -------------------------------------------------------------------------------- 1 | name: "Tag" 2 | 3 | permissions: 4 | contents: write 5 | 6 | on: 7 | push: 8 | branches: 9 | - "main" 10 | 11 | jobs: 12 | create-tag: 13 | name: "Create tag" 14 | runs-on: "ubuntu-latest" 15 | steps: 16 | - name: "Check out the repo" 17 | uses: actions/checkout@v3 18 | with: 19 | token: ${{ secrets.GITHUB_TOKEN }} 20 | 21 | - name: "Get tag" 22 | id: "get-tag" 23 | shell: "bash" 24 | run: | 25 | echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT 26 | 27 | - name: "Set Tag" 28 | shell: "bash" 29 | run: | 30 | git tag v${{ steps.get-tag.outputs.PKG_VERSION }} && git push --tags 31 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: "Test" 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | check: 8 | name: "Cargo check" 9 | runs-on: "ubuntu-latest" 10 | steps: 11 | - name: "Check out the repo" 12 | uses: actions/checkout@v3 13 | 14 | - uses: "actions-rs/toolchain@v1" 15 | with: 16 | profile: "minimal" 17 | toolchain: "stable" 18 | override: true 19 | 20 | - uses: "actions-rs/cargo@v1" 21 | with: 22 | command: "check" 23 | 24 | test: 25 | name: "Cargo test" 26 | runs-on: "ubuntu-latest" 27 | steps: 28 | - name: "Check out the repo" 29 | uses: actions/checkout@v3 30 | 31 | - uses: "actions-rs/toolchain@v1" 32 | with: 33 | profile: "minimal" 34 | toolchain: "stable" 35 | override: true 36 | 37 | - uses: "actions-rs/cargo@v1" 38 | with: 39 | command: "test" 40 | 41 | fmt: 42 | name: "Cargo format" 43 | runs-on: "ubuntu-latest" 44 | steps: 45 | - name: "Check out the repo" 46 | uses: actions/checkout@v3 47 | 48 | - uses: "actions-rs/toolchain@v1" 49 | with: 50 | profile: "minimal" 51 | toolchain: "stable" 52 | override: true 53 | 54 | - run: "rustup component add rustfmt" 55 | 56 | - uses: "actions-rs/cargo@v1" 57 | with: 58 | command: "fmt" 59 | args: "--all -- --check" 60 | 61 | clippy: 62 | name: "Cargo clippy" 63 | runs-on: "ubuntu-latest" 64 | steps: 65 | - name: "Check out the repo" 66 | uses: actions/checkout@v3 67 | 68 | - uses: "actions-rs/toolchain@v1" 69 | with: 70 | profile: "minimal" 71 | toolchain: "stable" 72 | override: true 73 | 74 | - run: "rustup component add clippy" 75 | 76 | - uses: "actions-rs/cargo@v1" 77 | with: 78 | command: "clippy" 79 | args: "-- -D warnings" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .env 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "ahash" 13 | version = "0.7.8" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" 16 | dependencies = [ 17 | "getrandom", 18 | "once_cell", 19 | "version_check", 20 | ] 21 | 22 | [[package]] 23 | name = "aho-corasick" 24 | version = "1.1.1" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" 27 | dependencies = [ 28 | "memchr", 29 | ] 30 | 31 | [[package]] 32 | name = "anstream" 33 | version = "0.6.8" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "628a8f9bd1e24b4e0db2b4bc2d000b001e7dd032d54afa60a68836aeec5aa54a" 36 | dependencies = [ 37 | "anstyle", 38 | "anstyle-parse", 39 | "anstyle-query", 40 | "anstyle-wincon", 41 | "colorchoice", 42 | "utf8parse", 43 | ] 44 | 45 | [[package]] 46 | name = "anstyle" 47 | version = "1.0.4" 48 | source = "registry+https://github.com/rust-lang/crates.io-index" 49 | checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" 50 | 51 | [[package]] 52 | name = "anstyle-parse" 53 | version = "0.2.2" 54 | source = "registry+https://github.com/rust-lang/crates.io-index" 55 | checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" 56 | dependencies = [ 57 | "utf8parse", 58 | ] 59 | 60 | [[package]] 61 | name = "anstyle-query" 62 | version = "1.0.0" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" 65 | dependencies = [ 66 | "windows-sys 0.48.0", 67 | ] 68 | 69 | [[package]] 70 | name = "anstyle-wincon" 71 | version = "3.0.1" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" 74 | dependencies = [ 75 | "anstyle", 76 | "windows-sys 0.48.0", 77 | ] 78 | 79 | [[package]] 80 | name = "anyhow" 81 | version = "1.0.95" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" 84 | 85 | [[package]] 86 | name = "async-trait" 87 | version = "0.1.73" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" 90 | dependencies = [ 91 | "proc-macro2", 92 | "quote", 93 | "syn 2.0.48", 94 | ] 95 | 96 | [[package]] 97 | name = "base64" 98 | version = "0.13.1" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 101 | 102 | [[package]] 103 | name = "bitflags" 104 | version = "1.3.2" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 107 | 108 | [[package]] 109 | name = "bitflags" 110 | version = "2.4.0" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" 113 | 114 | [[package]] 115 | name = "block-buffer" 116 | version = "0.10.4" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 119 | dependencies = [ 120 | "generic-array", 121 | ] 122 | 123 | [[package]] 124 | name = "cfg-if" 125 | version = "1.0.0" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 128 | 129 | [[package]] 130 | name = "cfg_aliases" 131 | version = "0.1.1" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" 134 | 135 | [[package]] 136 | name = "clap" 137 | version = "4.5.4" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" 140 | dependencies = [ 141 | "clap_builder", 142 | "clap_derive", 143 | ] 144 | 145 | [[package]] 146 | name = "clap_builder" 147 | version = "4.5.2" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" 150 | dependencies = [ 151 | "anstream", 152 | "anstyle", 153 | "clap_lex", 154 | "strsim", 155 | ] 156 | 157 | [[package]] 158 | name = "clap_complete" 159 | version = "4.5.1" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c" 162 | dependencies = [ 163 | "clap", 164 | ] 165 | 166 | [[package]] 167 | name = "clap_derive" 168 | version = "4.5.4" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" 171 | dependencies = [ 172 | "heck", 173 | "proc-macro2", 174 | "quote", 175 | "syn 2.0.48", 176 | ] 177 | 178 | [[package]] 179 | name = "clap_lex" 180 | version = "0.7.0" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" 183 | 184 | [[package]] 185 | name = "cmd_lib" 186 | version = "1.9.3" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "e5f4cbdcab51ca635c5b19c85ece4072ea42e0d2360242826a6fc96fb11f0d40" 189 | dependencies = [ 190 | "cmd_lib_macros", 191 | "env_logger", 192 | "faccess", 193 | "lazy_static", 194 | "log", 195 | "os_pipe", 196 | ] 197 | 198 | [[package]] 199 | name = "cmd_lib_macros" 200 | version = "1.9.3" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | checksum = "ae881960f7e2a409f91ef0b1c09558cf293031a1d6e8b45f908311f2a43f5fdf" 203 | dependencies = [ 204 | "proc-macro-error", 205 | "proc-macro2", 206 | "quote", 207 | "syn 1.0.109", 208 | ] 209 | 210 | [[package]] 211 | name = "color-print" 212 | version = "0.3.5" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "7a858372ff14bab9b1b30ea504f2a4bc534582aee3e42ba2d41d2a7baba63d5d" 215 | dependencies = [ 216 | "color-print-proc-macro", 217 | ] 218 | 219 | [[package]] 220 | name = "color-print-proc-macro" 221 | version = "0.3.5" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "57e37866456a721d0a404439a1adae37a31be4e0055590d053dfe6981e05003f" 224 | dependencies = [ 225 | "nom", 226 | "proc-macro2", 227 | "quote", 228 | "syn 1.0.109", 229 | ] 230 | 231 | [[package]] 232 | name = "colorchoice" 233 | version = "1.0.0" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 236 | 237 | [[package]] 238 | name = "config" 239 | version = "0.13.4" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca" 242 | dependencies = [ 243 | "async-trait", 244 | "json5", 245 | "lazy_static", 246 | "nom", 247 | "pathdiff", 248 | "ron", 249 | "rust-ini", 250 | "serde", 251 | "serde_json", 252 | "toml", 253 | "yaml-rust", 254 | ] 255 | 256 | [[package]] 257 | name = "console" 258 | version = "0.15.7" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" 261 | dependencies = [ 262 | "encode_unicode", 263 | "lazy_static", 264 | "libc", 265 | "unicode-width", 266 | "windows-sys 0.45.0", 267 | ] 268 | 269 | [[package]] 270 | name = "cpufeatures" 271 | version = "0.2.9" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" 274 | dependencies = [ 275 | "libc", 276 | ] 277 | 278 | [[package]] 279 | name = "crc32fast" 280 | version = "1.3.2" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 283 | dependencies = [ 284 | "cfg-if", 285 | ] 286 | 287 | [[package]] 288 | name = "crypto-common" 289 | version = "0.1.6" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 292 | dependencies = [ 293 | "generic-array", 294 | "typenum", 295 | ] 296 | 297 | [[package]] 298 | name = "dialoguer" 299 | version = "0.11.0" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" 302 | dependencies = [ 303 | "console", 304 | "shell-words", 305 | "tempfile", 306 | "thiserror", 307 | "zeroize", 308 | ] 309 | 310 | [[package]] 311 | name = "digest" 312 | version = "0.10.7" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 315 | dependencies = [ 316 | "block-buffer", 317 | "crypto-common", 318 | ] 319 | 320 | [[package]] 321 | name = "dlv-list" 322 | version = "0.3.0" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" 325 | 326 | [[package]] 327 | name = "either" 328 | version = "1.9.0" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 331 | 332 | [[package]] 333 | name = "encode_unicode" 334 | version = "0.3.6" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 337 | 338 | [[package]] 339 | name = "env_logger" 340 | version = "0.10.1" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" 343 | dependencies = [ 344 | "humantime", 345 | "is-terminal", 346 | "log", 347 | "regex", 348 | "termcolor", 349 | ] 350 | 351 | [[package]] 352 | name = "errno" 353 | version = "0.3.8" 354 | source = "registry+https://github.com/rust-lang/crates.io-index" 355 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" 356 | dependencies = [ 357 | "libc", 358 | "windows-sys 0.52.0", 359 | ] 360 | 361 | [[package]] 362 | name = "faccess" 363 | version = "0.2.4" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "59ae66425802d6a903e268ae1a08b8c38ba143520f227a205edf4e9c7e3e26d5" 366 | dependencies = [ 367 | "bitflags 1.3.2", 368 | "libc", 369 | "winapi", 370 | ] 371 | 372 | [[package]] 373 | name = "fastrand" 374 | version = "2.0.1" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" 377 | 378 | [[package]] 379 | name = "filetime" 380 | version = "0.2.22" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" 383 | dependencies = [ 384 | "cfg-if", 385 | "libc", 386 | "redox_syscall", 387 | "windows-sys 0.48.0", 388 | ] 389 | 390 | [[package]] 391 | name = "flate2" 392 | version = "1.0.28" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" 395 | dependencies = [ 396 | "crc32fast", 397 | "miniz_oxide", 398 | ] 399 | 400 | [[package]] 401 | name = "generic-array" 402 | version = "0.14.7" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 405 | dependencies = [ 406 | "typenum", 407 | "version_check", 408 | ] 409 | 410 | [[package]] 411 | name = "getrandom" 412 | version = "0.2.10" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 415 | dependencies = [ 416 | "cfg-if", 417 | "libc", 418 | "wasi", 419 | ] 420 | 421 | [[package]] 422 | name = "hashbrown" 423 | version = "0.12.3" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 426 | dependencies = [ 427 | "ahash", 428 | ] 429 | 430 | [[package]] 431 | name = "heck" 432 | version = "0.5.0" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 435 | 436 | [[package]] 437 | name = "hermit-abi" 438 | version = "0.3.3" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" 441 | 442 | [[package]] 443 | name = "home" 444 | version = "0.5.9" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" 447 | dependencies = [ 448 | "windows-sys 0.52.0", 449 | ] 450 | 451 | [[package]] 452 | name = "humantime" 453 | version = "2.1.0" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 456 | 457 | [[package]] 458 | name = "indicatif" 459 | version = "0.17.8" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" 462 | dependencies = [ 463 | "console", 464 | "instant", 465 | "number_prefix", 466 | "portable-atomic", 467 | "unicode-width", 468 | ] 469 | 470 | [[package]] 471 | name = "instant" 472 | version = "0.1.12" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 475 | dependencies = [ 476 | "cfg-if", 477 | ] 478 | 479 | [[package]] 480 | name = "is-terminal" 481 | version = "0.4.10" 482 | source = "registry+https://github.com/rust-lang/crates.io-index" 483 | checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" 484 | dependencies = [ 485 | "hermit-abi", 486 | "rustix", 487 | "windows-sys 0.52.0", 488 | ] 489 | 490 | [[package]] 491 | name = "itoa" 492 | version = "1.0.9" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" 495 | 496 | [[package]] 497 | name = "json5" 498 | version = "0.4.1" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" 501 | dependencies = [ 502 | "pest", 503 | "pest_derive", 504 | "serde", 505 | ] 506 | 507 | [[package]] 508 | name = "lazy_static" 509 | version = "1.4.0" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 512 | 513 | [[package]] 514 | name = "libc" 515 | version = "0.2.153" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 518 | 519 | [[package]] 520 | name = "linked-hash-map" 521 | version = "0.5.6" 522 | source = "registry+https://github.com/rust-lang/crates.io-index" 523 | checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" 524 | 525 | [[package]] 526 | name = "linux-raw-sys" 527 | version = "0.4.13" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" 530 | 531 | [[package]] 532 | name = "log" 533 | version = "0.4.20" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 536 | 537 | [[package]] 538 | name = "memchr" 539 | version = "2.6.3" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" 542 | 543 | [[package]] 544 | name = "minimal-lexical" 545 | version = "0.2.1" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 548 | 549 | [[package]] 550 | name = "miniz_oxide" 551 | version = "0.7.1" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 554 | dependencies = [ 555 | "adler", 556 | ] 557 | 558 | [[package]] 559 | name = "nix" 560 | version = "0.28.0" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" 563 | dependencies = [ 564 | "bitflags 2.4.0", 565 | "cfg-if", 566 | "cfg_aliases", 567 | "libc", 568 | ] 569 | 570 | [[package]] 571 | name = "nom" 572 | version = "7.1.3" 573 | source = "registry+https://github.com/rust-lang/crates.io-index" 574 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 575 | dependencies = [ 576 | "memchr", 577 | "minimal-lexical", 578 | ] 579 | 580 | [[package]] 581 | name = "number_prefix" 582 | version = "0.4.0" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" 585 | 586 | [[package]] 587 | name = "once_cell" 588 | version = "1.18.0" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 591 | 592 | [[package]] 593 | name = "ordered-multimap" 594 | version = "0.4.3" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" 597 | dependencies = [ 598 | "dlv-list", 599 | "hashbrown", 600 | ] 601 | 602 | [[package]] 603 | name = "os_pipe" 604 | version = "1.1.5" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" 607 | dependencies = [ 608 | "libc", 609 | "windows-sys 0.52.0", 610 | ] 611 | 612 | [[package]] 613 | name = "pathdiff" 614 | version = "0.2.1" 615 | source = "registry+https://github.com/rust-lang/crates.io-index" 616 | checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" 617 | 618 | [[package]] 619 | name = "pest" 620 | version = "2.7.4" 621 | source = "registry+https://github.com/rust-lang/crates.io-index" 622 | checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" 623 | dependencies = [ 624 | "memchr", 625 | "thiserror", 626 | "ucd-trie", 627 | ] 628 | 629 | [[package]] 630 | name = "pest_derive" 631 | version = "2.7.4" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" 634 | dependencies = [ 635 | "pest", 636 | "pest_generator", 637 | ] 638 | 639 | [[package]] 640 | name = "pest_generator" 641 | version = "2.7.4" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" 644 | dependencies = [ 645 | "pest", 646 | "pest_meta", 647 | "proc-macro2", 648 | "quote", 649 | "syn 2.0.48", 650 | ] 651 | 652 | [[package]] 653 | name = "pest_meta" 654 | version = "2.7.4" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" 657 | dependencies = [ 658 | "once_cell", 659 | "pest", 660 | "sha2", 661 | ] 662 | 663 | [[package]] 664 | name = "portable-atomic" 665 | version = "1.4.3" 666 | source = "registry+https://github.com/rust-lang/crates.io-index" 667 | checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" 668 | 669 | [[package]] 670 | name = "proc-macro-error" 671 | version = "1.0.4" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 674 | dependencies = [ 675 | "proc-macro-error-attr", 676 | "proc-macro2", 677 | "quote", 678 | "syn 1.0.109", 679 | "version_check", 680 | ] 681 | 682 | [[package]] 683 | name = "proc-macro-error-attr" 684 | version = "1.0.4" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 687 | dependencies = [ 688 | "proc-macro2", 689 | "quote", 690 | "version_check", 691 | ] 692 | 693 | [[package]] 694 | name = "proc-macro2" 695 | version = "1.0.76" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" 698 | dependencies = [ 699 | "unicode-ident", 700 | ] 701 | 702 | [[package]] 703 | name = "quote" 704 | version = "1.0.35" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 707 | dependencies = [ 708 | "proc-macro2", 709 | ] 710 | 711 | [[package]] 712 | name = "redox_syscall" 713 | version = "0.3.5" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 716 | dependencies = [ 717 | "bitflags 1.3.2", 718 | ] 719 | 720 | [[package]] 721 | name = "regex" 722 | version = "1.10.4" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" 725 | dependencies = [ 726 | "aho-corasick", 727 | "memchr", 728 | "regex-automata", 729 | "regex-syntax", 730 | ] 731 | 732 | [[package]] 733 | name = "regex-automata" 734 | version = "0.4.5" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" 737 | dependencies = [ 738 | "aho-corasick", 739 | "memchr", 740 | "regex-syntax", 741 | ] 742 | 743 | [[package]] 744 | name = "regex-syntax" 745 | version = "0.8.2" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 748 | 749 | [[package]] 750 | name = "ron" 751 | version = "0.7.1" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" 754 | dependencies = [ 755 | "base64", 756 | "bitflags 1.3.2", 757 | "serde", 758 | ] 759 | 760 | [[package]] 761 | name = "rust-ini" 762 | version = "0.18.0" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" 765 | dependencies = [ 766 | "cfg-if", 767 | "ordered-multimap", 768 | ] 769 | 770 | [[package]] 771 | name = "rustix" 772 | version = "0.38.30" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" 775 | dependencies = [ 776 | "bitflags 2.4.0", 777 | "errno", 778 | "libc", 779 | "linux-raw-sys", 780 | "windows-sys 0.52.0", 781 | ] 782 | 783 | [[package]] 784 | name = "ryu" 785 | version = "1.0.15" 786 | source = "registry+https://github.com/rust-lang/crates.io-index" 787 | checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" 788 | 789 | [[package]] 790 | name = "serde" 791 | version = "1.0.197" 792 | source = "registry+https://github.com/rust-lang/crates.io-index" 793 | checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" 794 | dependencies = [ 795 | "serde_derive", 796 | ] 797 | 798 | [[package]] 799 | name = "serde_derive" 800 | version = "1.0.197" 801 | source = "registry+https://github.com/rust-lang/crates.io-index" 802 | checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" 803 | dependencies = [ 804 | "proc-macro2", 805 | "quote", 806 | "syn 2.0.48", 807 | ] 808 | 809 | [[package]] 810 | name = "serde_json" 811 | version = "1.0.115" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" 814 | dependencies = [ 815 | "itoa", 816 | "ryu", 817 | "serde", 818 | ] 819 | 820 | [[package]] 821 | name = "sha2" 822 | version = "0.10.8" 823 | source = "registry+https://github.com/rust-lang/crates.io-index" 824 | checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" 825 | dependencies = [ 826 | "cfg-if", 827 | "cpufeatures", 828 | "digest", 829 | ] 830 | 831 | [[package]] 832 | name = "shell-words" 833 | version = "1.1.0" 834 | source = "registry+https://github.com/rust-lang/crates.io-index" 835 | checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 836 | 837 | [[package]] 838 | name = "strsim" 839 | version = "0.11.0" 840 | source = "registry+https://github.com/rust-lang/crates.io-index" 841 | checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" 842 | 843 | [[package]] 844 | name = "sudo" 845 | version = "0.6.0" 846 | source = "registry+https://github.com/rust-lang/crates.io-index" 847 | checksum = "88bd84d4c082e18e37fef52c0088e4407dabcef19d23a607fb4b5ee03b7d5b83" 848 | dependencies = [ 849 | "libc", 850 | "log", 851 | ] 852 | 853 | [[package]] 854 | name = "syn" 855 | version = "1.0.109" 856 | source = "registry+https://github.com/rust-lang/crates.io-index" 857 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 858 | dependencies = [ 859 | "proc-macro2", 860 | "quote", 861 | "unicode-ident", 862 | ] 863 | 864 | [[package]] 865 | name = "syn" 866 | version = "2.0.48" 867 | source = "registry+https://github.com/rust-lang/crates.io-index" 868 | checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" 869 | dependencies = [ 870 | "proc-macro2", 871 | "quote", 872 | "unicode-ident", 873 | ] 874 | 875 | [[package]] 876 | name = "tar" 877 | version = "0.4.40" 878 | source = "registry+https://github.com/rust-lang/crates.io-index" 879 | checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" 880 | dependencies = [ 881 | "filetime", 882 | "libc", 883 | "xattr", 884 | ] 885 | 886 | [[package]] 887 | name = "tempfile" 888 | version = "3.8.0" 889 | source = "registry+https://github.com/rust-lang/crates.io-index" 890 | checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" 891 | dependencies = [ 892 | "cfg-if", 893 | "fastrand", 894 | "redox_syscall", 895 | "rustix", 896 | "windows-sys 0.48.0", 897 | ] 898 | 899 | [[package]] 900 | name = "termcolor" 901 | version = "1.4.1" 902 | source = "registry+https://github.com/rust-lang/crates.io-index" 903 | checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" 904 | dependencies = [ 905 | "winapi-util", 906 | ] 907 | 908 | [[package]] 909 | name = "thiserror" 910 | version = "1.0.49" 911 | source = "registry+https://github.com/rust-lang/crates.io-index" 912 | checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" 913 | dependencies = [ 914 | "thiserror-impl", 915 | ] 916 | 917 | [[package]] 918 | name = "thiserror-impl" 919 | version = "1.0.49" 920 | source = "registry+https://github.com/rust-lang/crates.io-index" 921 | checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" 922 | dependencies = [ 923 | "proc-macro2", 924 | "quote", 925 | "syn 2.0.48", 926 | ] 927 | 928 | [[package]] 929 | name = "toml" 930 | version = "0.5.11" 931 | source = "registry+https://github.com/rust-lang/crates.io-index" 932 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 933 | dependencies = [ 934 | "serde", 935 | ] 936 | 937 | [[package]] 938 | name = "typenum" 939 | version = "1.17.0" 940 | source = "registry+https://github.com/rust-lang/crates.io-index" 941 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 942 | 943 | [[package]] 944 | name = "ucd-trie" 945 | version = "0.1.6" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" 948 | 949 | [[package]] 950 | name = "unicode-ident" 951 | version = "1.0.12" 952 | source = "registry+https://github.com/rust-lang/crates.io-index" 953 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 954 | 955 | [[package]] 956 | name = "unicode-width" 957 | version = "0.1.11" 958 | source = "registry+https://github.com/rust-lang/crates.io-index" 959 | checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" 960 | 961 | [[package]] 962 | name = "utf8parse" 963 | version = "0.2.1" 964 | source = "registry+https://github.com/rust-lang/crates.io-index" 965 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 966 | 967 | [[package]] 968 | name = "version_check" 969 | version = "0.9.4" 970 | source = "registry+https://github.com/rust-lang/crates.io-index" 971 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 972 | 973 | [[package]] 974 | name = "wasi" 975 | version = "0.11.0+wasi-snapshot-preview1" 976 | source = "registry+https://github.com/rust-lang/crates.io-index" 977 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 978 | 979 | [[package]] 980 | name = "which" 981 | version = "6.0.1" 982 | source = "registry+https://github.com/rust-lang/crates.io-index" 983 | checksum = "8211e4f58a2b2805adfbefbc07bab82958fc91e3836339b1ab7ae32465dce0d7" 984 | dependencies = [ 985 | "either", 986 | "home", 987 | "rustix", 988 | "winsafe", 989 | ] 990 | 991 | [[package]] 992 | name = "winapi" 993 | version = "0.3.9" 994 | source = "registry+https://github.com/rust-lang/crates.io-index" 995 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 996 | dependencies = [ 997 | "winapi-i686-pc-windows-gnu", 998 | "winapi-x86_64-pc-windows-gnu", 999 | ] 1000 | 1001 | [[package]] 1002 | name = "winapi-i686-pc-windows-gnu" 1003 | version = "0.4.0" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1006 | 1007 | [[package]] 1008 | name = "winapi-util" 1009 | version = "0.1.6" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" 1012 | dependencies = [ 1013 | "winapi", 1014 | ] 1015 | 1016 | [[package]] 1017 | name = "winapi-x86_64-pc-windows-gnu" 1018 | version = "0.4.0" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1021 | 1022 | [[package]] 1023 | name = "windows-sys" 1024 | version = "0.45.0" 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" 1026 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1027 | dependencies = [ 1028 | "windows-targets 0.42.2", 1029 | ] 1030 | 1031 | [[package]] 1032 | name = "windows-sys" 1033 | version = "0.48.0" 1034 | source = "registry+https://github.com/rust-lang/crates.io-index" 1035 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1036 | dependencies = [ 1037 | "windows-targets 0.48.5", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "windows-sys" 1042 | version = "0.52.0" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1045 | dependencies = [ 1046 | "windows-targets 0.52.0", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "windows-targets" 1051 | version = "0.42.2" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1054 | dependencies = [ 1055 | "windows_aarch64_gnullvm 0.42.2", 1056 | "windows_aarch64_msvc 0.42.2", 1057 | "windows_i686_gnu 0.42.2", 1058 | "windows_i686_msvc 0.42.2", 1059 | "windows_x86_64_gnu 0.42.2", 1060 | "windows_x86_64_gnullvm 0.42.2", 1061 | "windows_x86_64_msvc 0.42.2", 1062 | ] 1063 | 1064 | [[package]] 1065 | name = "windows-targets" 1066 | version = "0.48.5" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1069 | dependencies = [ 1070 | "windows_aarch64_gnullvm 0.48.5", 1071 | "windows_aarch64_msvc 0.48.5", 1072 | "windows_i686_gnu 0.48.5", 1073 | "windows_i686_msvc 0.48.5", 1074 | "windows_x86_64_gnu 0.48.5", 1075 | "windows_x86_64_gnullvm 0.48.5", 1076 | "windows_x86_64_msvc 0.48.5", 1077 | ] 1078 | 1079 | [[package]] 1080 | name = "windows-targets" 1081 | version = "0.52.0" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 1084 | dependencies = [ 1085 | "windows_aarch64_gnullvm 0.52.0", 1086 | "windows_aarch64_msvc 0.52.0", 1087 | "windows_i686_gnu 0.52.0", 1088 | "windows_i686_msvc 0.52.0", 1089 | "windows_x86_64_gnu 0.52.0", 1090 | "windows_x86_64_gnullvm 0.52.0", 1091 | "windows_x86_64_msvc 0.52.0", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "windows_aarch64_gnullvm" 1096 | version = "0.42.2" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1099 | 1100 | [[package]] 1101 | name = "windows_aarch64_gnullvm" 1102 | version = "0.48.5" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1105 | 1106 | [[package]] 1107 | name = "windows_aarch64_gnullvm" 1108 | version = "0.52.0" 1109 | source = "registry+https://github.com/rust-lang/crates.io-index" 1110 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" 1111 | 1112 | [[package]] 1113 | name = "windows_aarch64_msvc" 1114 | version = "0.42.2" 1115 | source = "registry+https://github.com/rust-lang/crates.io-index" 1116 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1117 | 1118 | [[package]] 1119 | name = "windows_aarch64_msvc" 1120 | version = "0.48.5" 1121 | source = "registry+https://github.com/rust-lang/crates.io-index" 1122 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1123 | 1124 | [[package]] 1125 | name = "windows_aarch64_msvc" 1126 | version = "0.52.0" 1127 | source = "registry+https://github.com/rust-lang/crates.io-index" 1128 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" 1129 | 1130 | [[package]] 1131 | name = "windows_i686_gnu" 1132 | version = "0.42.2" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1135 | 1136 | [[package]] 1137 | name = "windows_i686_gnu" 1138 | version = "0.48.5" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1141 | 1142 | [[package]] 1143 | name = "windows_i686_gnu" 1144 | version = "0.52.0" 1145 | source = "registry+https://github.com/rust-lang/crates.io-index" 1146 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" 1147 | 1148 | [[package]] 1149 | name = "windows_i686_msvc" 1150 | version = "0.42.2" 1151 | source = "registry+https://github.com/rust-lang/crates.io-index" 1152 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1153 | 1154 | [[package]] 1155 | name = "windows_i686_msvc" 1156 | version = "0.48.5" 1157 | source = "registry+https://github.com/rust-lang/crates.io-index" 1158 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1159 | 1160 | [[package]] 1161 | name = "windows_i686_msvc" 1162 | version = "0.52.0" 1163 | source = "registry+https://github.com/rust-lang/crates.io-index" 1164 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" 1165 | 1166 | [[package]] 1167 | name = "windows_x86_64_gnu" 1168 | version = "0.42.2" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1171 | 1172 | [[package]] 1173 | name = "windows_x86_64_gnu" 1174 | version = "0.48.5" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1177 | 1178 | [[package]] 1179 | name = "windows_x86_64_gnu" 1180 | version = "0.52.0" 1181 | source = "registry+https://github.com/rust-lang/crates.io-index" 1182 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" 1183 | 1184 | [[package]] 1185 | name = "windows_x86_64_gnullvm" 1186 | version = "0.42.2" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1189 | 1190 | [[package]] 1191 | name = "windows_x86_64_gnullvm" 1192 | version = "0.48.5" 1193 | source = "registry+https://github.com/rust-lang/crates.io-index" 1194 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1195 | 1196 | [[package]] 1197 | name = "windows_x86_64_gnullvm" 1198 | version = "0.52.0" 1199 | source = "registry+https://github.com/rust-lang/crates.io-index" 1200 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" 1201 | 1202 | [[package]] 1203 | name = "windows_x86_64_msvc" 1204 | version = "0.42.2" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1207 | 1208 | [[package]] 1209 | name = "windows_x86_64_msvc" 1210 | version = "0.48.5" 1211 | source = "registry+https://github.com/rust-lang/crates.io-index" 1212 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1213 | 1214 | [[package]] 1215 | name = "windows_x86_64_msvc" 1216 | version = "0.52.0" 1217 | source = "registry+https://github.com/rust-lang/crates.io-index" 1218 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" 1219 | 1220 | [[package]] 1221 | name = "winsafe" 1222 | version = "0.0.19" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" 1225 | 1226 | [[package]] 1227 | name = "wrestic" 1228 | version = "1.7.2" 1229 | dependencies = [ 1230 | "anyhow", 1231 | "clap", 1232 | "clap_complete", 1233 | "cmd_lib", 1234 | "color-print", 1235 | "config", 1236 | "dialoguer", 1237 | "flate2", 1238 | "indicatif", 1239 | "lazy_static", 1240 | "nix", 1241 | "regex", 1242 | "serde", 1243 | "serde_json", 1244 | "sudo", 1245 | "tar", 1246 | "which", 1247 | ] 1248 | 1249 | [[package]] 1250 | name = "xattr" 1251 | version = "1.0.1" 1252 | source = "registry+https://github.com/rust-lang/crates.io-index" 1253 | checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" 1254 | dependencies = [ 1255 | "libc", 1256 | ] 1257 | 1258 | [[package]] 1259 | name = "yaml-rust" 1260 | version = "0.4.5" 1261 | source = "registry+https://github.com/rust-lang/crates.io-index" 1262 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" 1263 | dependencies = [ 1264 | "linked-hash-map", 1265 | ] 1266 | 1267 | [[package]] 1268 | name = "zeroize" 1269 | version = "1.6.0" 1270 | source = "registry+https://github.com/rust-lang/crates.io-index" 1271 | checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" 1272 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "wrestic" 3 | version = "1.7.2" 4 | authors = ["alvaro17f"] 5 | description = "Restic wrapper built in Rust" 6 | homepage = "https://wrestic.com/" 7 | repository = "https://github.com/alvaro17f/wrestic" 8 | license = "LGPL-3.0" 9 | edition = "2021" 10 | keywords = ["restic", "wrapper", "rust", "backup", "tool"] 11 | 12 | [dependencies] 13 | anyhow = "1.0.95" 14 | clap = { version = "4.5.4", features = ["derive"] } 15 | clap_complete = "4.5.1" 16 | cmd_lib = "1.9.3" 17 | color-print = "0.3.5" 18 | config = "0.13.4" 19 | dialoguer = "0.11.0" 20 | flate2 = "1.0.28" 21 | indicatif = "0.17.8" 22 | lazy_static = "1.4.0" 23 | nix = { version = "0.28.0", features = ["user"] } 24 | regex = "1.10.4" 25 | serde = "1.0.197" 26 | serde_json = "1.0.115" 27 | sudo = "0.6.0" 28 | tar = "0.4.40" 29 | which = "6.0.1" 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WRESTIC 2 | 3 |
4 | 5 | 6 |
7 | 8 | :star: Star me up! 9 | 10 | Wrestic is a backup tool built in Rust that provides a wrapper around Restic, a popular backup program. With Wrestic, you can easily configure and run backups of your files and directories, and take advantage of Restic's powerful features such as deduplication, encryption, and compression. Whether you need to back up your personal files or your organization's data, Wrestic can help you automate the process and ensure your data is safe and secure. 11 | 12 | Wrestic has support for all the restic backends, including: 13 | 14 | > - LOCAL 15 | > - SFTP 16 | > - REST 17 | > - AMAZON S3 18 | > - AZURE 19 | > - BACKBLAZE B2 20 | > - WASABI 21 | > - MINIO 22 | > - GOOGLE CLOUD STORAGE 23 | 24 | ## TABLE OF CONTENTS[![](https://raw.githubusercontent.com/aregtech/areg-sdk/master/docs/img/pin.svg)](#table-of-contents) 25 | - [WRESTIC](#wrestic) 26 | - [TABLE OF CONTENTS](#table-of-contents) 27 | - [INSTALLATION](#installation) 28 | - [WITH CARGO](#with-cargo) 29 | - [AUR](#aur) 30 | - [DOWNLOAD BINARY](#download-binary) 31 | - [BUILD FROM SOURCE](#build-from-source) 32 | - [CONFIGURATION](#configuration) 33 | - [USAGE](#usage) 34 | - [COMPLETIONS](#completions) 35 | 36 | 37 | 38 | ## INSTALLATION 39 | 40 | ### WITH CARGO 41 | ```sh 42 | cargo install wrestic 43 | ``` 44 | 45 | ### AUR 46 | ```sh 47 | paru -S wrestic 48 | ``` 49 | 50 | ### DOWNLOAD BINARY 51 | 52 | ```sh 53 | curl -sL $(curl -s https://api.github.com/repos/alvaro17f/wrestic/releases/latest | grep browser_download_url | cut -d '"' -f 4) | sudo tar zxf - -C /usr/bin --overwrite 54 | ``` 55 | 56 | ### BUILD FROM SOURCE 57 | Requirements: 58 | - [git](https://git-scm.com/) 59 | - [rust](https://rust-lang.org/) 60 | 61 | ```sh 62 | git clone https://github.com/alvaro17f/wrestic.git 63 | cd wrestic 64 | cargo build --release 65 | sudo cp target/release/wrestic /usr/bin 66 | ``` 67 | 68 | ## CONFIGURATION 69 | 70 | Copy `wrestic.toml` to `/home/$USER/.config/wrestic/wrestic.toml` and modify the content for your needs. 71 | 72 | ## USAGE 73 | 74 |
75 | 76 |
77 | 78 | Simply run `sudo wrestic`. 79 | 80 | ``` 81 | $ wrestic help 82 | 83 | Restic wrapper built in Rust 84 | 85 | Usage: wrestic [OPTIONS] [COMMAND] 86 | 87 | Commands: 88 | backup, -b Make a backup of all your repositories 89 | restore, -r Restore a snapshot 90 | snapshots, -s List snapshots 91 | delete, -d Delete a snapshot 92 | init, -i Initialize all of your repositories 93 | check Check repository health 94 | repair Fix any issue 95 | cache Clean cache 96 | update, -u Update Wrestic 97 | custom, -c Custom command 98 | help Print this message or the help of the given subcommand(s) 99 | 100 | Options: 101 | --generate [possible values: bash, elvish, fish, powershell, zsh] 102 | -h, --help Print help 103 | -V, --version Print version 104 | 105 | ``` 106 | 107 | ## COMPLETIONS 108 | 109 | > if your shell is `bash` you'll also need the `bash-completion` package installed. 110 | 111 | To get `` completions run `sudo wrestic --generate ` 112 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1740582133, 6 | "narHash": "sha256-uP0ydEFGG/w30Ja6+nEHIhquGg8qjzpn1RYRph9SbeU=", 7 | "owner": "nixos", 8 | "repo": "nixpkgs", 9 | "rev": "b2f2859ddc345465d64cd0300a246e1b3455ea5f", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "nixos", 14 | "repo": "nixpkgs", 15 | "type": "github" 16 | } 17 | }, 18 | "root": { 19 | "inputs": { 20 | "nixpkgs": "nixpkgs" 21 | } 22 | } 23 | }, 24 | "root": "root", 25 | "version": 7 26 | } 27 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Wrestic"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:nixos/nixpkgs"; 6 | }; 7 | 8 | outputs = 9 | inputs@{ self, nixpkgs, ... }: 10 | let 11 | lib = nixpkgs.lib; 12 | 13 | darwin = [ 14 | "x86_64-darwin" 15 | "aarch64-darwin" 16 | ]; 17 | linux = [ 18 | "x86_64-linux" 19 | "x86_64-linux-musl" 20 | "aarch64-linux" 21 | "aarch64-linux-android" 22 | "i86_64-linux" 23 | ]; 24 | allSystems = darwin ++ linux; 25 | 26 | forEachSystem = systems: f: lib.genAttrs systems (system: f system); 27 | forAllSystems = forEachSystem allSystems; 28 | in 29 | { 30 | packages = forAllSystems ( 31 | system: 32 | let 33 | pkgs = import nixpkgs { inherit system; }; 34 | in 35 | rec { 36 | # e.g. nix build .#wrestic 37 | wrestic = pkgs.rustPlatform.buildRustPackage rec { 38 | name = "wrestic"; 39 | src = ./.; 40 | cargoLock = { 41 | lockFile = ./Cargo.lock; 42 | }; 43 | }; 44 | 45 | # e.g. nix build .#cross.x86_64-linux-musl.wrestic --impure 46 | cross = forEachSystem (lib.filter (sys: sys != system) allSystems) ( 47 | targetSystem: 48 | let 49 | crossPkgs = import nixpkgs { 50 | localSystem = system; 51 | crossSystem = targetSystem; 52 | }; 53 | in 54 | { 55 | inherit (crossPkgs) wrestic; 56 | } 57 | ); 58 | } 59 | ); 60 | defaultPackage = forAllSystems (system: self.packages.${system}.wrestic); 61 | devShells = forAllSystems ( 62 | system: 63 | let 64 | pkgs = import nixpkgs { inherit system; }; 65 | devRequirements = with pkgs; [ 66 | gcc 67 | gnumake 68 | clippy 69 | rustc 70 | cargo 71 | rustfmt 72 | rust-analyzer 73 | ]; 74 | in 75 | { 76 | default = pkgs.mkShell { 77 | RUST_BACKTRACE = 1; 78 | 79 | # For cross compilation 80 | NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM = 1; 81 | 82 | buildInputs = devRequirements; 83 | packages = devRequirements; 84 | }; 85 | } 86 | ); 87 | }; 88 | } 89 | -------------------------------------------------------------------------------- /misc/wr_dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /misc/wr_light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /misc/wrestic_mockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvaro17f/wrestic/4e1d8cd63061eabd263e5632d8087033667d8ba8/misc/wrestic_mockup.png -------------------------------------------------------------------------------- /src/macros/errors.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_macros, unused_imports)] 2 | macro_rules! error_detail { 3 | ($err:expr) => { 4 | anyhow::anyhow!(color_print::cformat!( 5 | r#" 6 | 7 | ############################################### 8 | {} 9 | {} line {} column {} 10 | ############################################### 11 | "#, 12 | $err, 13 | file!(), 14 | line!(), 15 | column!() 16 | )) 17 | }; 18 | } 19 | 20 | macro_rules! error { 21 | ($err:expr) => { 22 | anyhow::anyhow!(color_print::cformat!("{}", $err)) 23 | }; 24 | } 25 | 26 | pub(crate) use error; 27 | pub(crate) use error_detail; 28 | -------------------------------------------------------------------------------- /src/macros/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod errors; 2 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod macros; 2 | mod modules; 3 | mod utils; 4 | 5 | use crate::utils::{ 6 | set_environment_variables::set_environment_variables, 7 | tools::{clear, select}, 8 | }; 9 | use anyhow::Result; 10 | use clap::{CommandFactory, Parser, Subcommand}; 11 | use clap_complete::Shell; 12 | use color_print::cprintln; 13 | use modules::{ 14 | backup::backup, cache::cache, check::check, custom::custom, delete::delete, 15 | initialize::initialize, repair::repair, restore::restore, selector::selector, 16 | snapshots::snapshots, update::update, 17 | }; 18 | use utils::{get_config::get_config, restic_checker::restic_checker}; 19 | 20 | #[derive(Parser, Debug, PartialEq)] 21 | #[command(author, version, about, long_about = None)] 22 | struct Cli { 23 | /// List of available commands 24 | #[command(subcommand)] 25 | commands: Option, 26 | } 27 | 28 | #[derive(Subcommand, Debug, PartialEq)] 29 | enum Commands { 30 | /// Make a backup of all your repositories 31 | #[clap(short_flag = 'b')] 32 | Backup, 33 | /// Restore a snapshot 34 | #[clap(short_flag = 'r')] 35 | Restore, 36 | /// List snapshots 37 | #[clap(short_flag = 's')] 38 | Snapshots, 39 | /// Delete a snapshot 40 | #[clap(short_flag = 'd')] 41 | Delete, 42 | /// Initialize all of your repositories 43 | #[clap(short_flag = 'i')] 44 | Init, 45 | /// Check repository health 46 | Check, 47 | /// Fix any issue 48 | Repair, 49 | /// Clean cache 50 | Cache, 51 | /// Update Wrestic 52 | #[clap(short_flag = 'u')] 53 | Update, 54 | /// Custom command 55 | #[clap(short_flag = 'c', allow_hyphen_values = true)] 56 | #[command(arg_required_else_help = true)] 57 | Custom { args: Vec }, 58 | /// Generate tab-completion scripts for your shell 59 | Completions { 60 | #[clap(value_enum)] 61 | shell: Shell, 62 | }, 63 | } 64 | 65 | fn handle_commands(cli: &Cli) -> Result<()> { 66 | match &cli.commands { 67 | Some(Commands::Backup) => { 68 | backup(true)?; 69 | } 70 | Some(Commands::Restore) => { 71 | restore(true)?; 72 | } 73 | Some(Commands::Snapshots) => { 74 | snapshots(true)?; 75 | } 76 | Some(Commands::Delete) => { 77 | delete(true)?; 78 | } 79 | Some(Commands::Init) => { 80 | initialize(true)?; 81 | } 82 | Some(Commands::Check) => { 83 | check(true)?; 84 | } 85 | Some(Commands::Repair) => { 86 | handle_repair()?; 87 | } 88 | Some(Commands::Cache) => { 89 | cache(true)?; 90 | } 91 | Some(Commands::Update) => { 92 | update()?; 93 | } 94 | Some(Commands::Custom { args }) => { 95 | custom(args)?; 96 | } 97 | Some(Commands::Completions { shell }) => { 98 | clap_complete::generate( 99 | *shell, 100 | &mut Cli::command(), 101 | "wrestic", 102 | &mut std::io::stdout().lock(), 103 | ); 104 | } 105 | None => { 106 | selector()?; 107 | } 108 | } 109 | Ok(()) 110 | } 111 | 112 | fn handle_repair() -> Result<()> { 113 | clear()?; 114 | cprintln!("REPAIR"); 115 | println!(); 116 | 117 | let settings = get_config()?; 118 | 119 | let selection = if settings.len() > 1 { 120 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 121 | select("Where do you want to perform a repair?", selections) 122 | } else { 123 | 0 124 | }; 125 | 126 | set_environment_variables(&settings[selection])?; 127 | 128 | let backend = &settings[selection].backend; 129 | let repository = &settings[selection].repository; 130 | 131 | repair(backend, repository, true)?; 132 | Ok(()) 133 | } 134 | 135 | fn main() -> Result<()> { 136 | restic_checker()?; 137 | 138 | let cli = Cli::parse(); 139 | handle_commands(&cli)?; 140 | 141 | Ok(()) 142 | } 143 | -------------------------------------------------------------------------------- /src/modules/backup.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::{repair::repair, selector::selector}, 3 | utils::{ 4 | get_config::{get_config, Settings}, 5 | root_checker::root_checker, 6 | set_environment_variables::set_environment_variables, 7 | tools::{clear, confirm, pause, select}, 8 | }, 9 | }; 10 | use anyhow::Result; 11 | use cmd_lib::run_cmd; 12 | use color_print::cprintln; 13 | 14 | fn do_backup(setting: &Settings) -> Result<()> { 15 | root_checker()?; 16 | 17 | let backend = &setting.backend; 18 | let repository = &setting.repository; 19 | let backup_folder = &setting.backup_folder; 20 | let keep_last = &setting.keep_last; 21 | 22 | if run_cmd!( 23 | sudo -E restic -r $backend:$repository --verbose --verbose backup $backup_folder 2>/dev/null; 24 | ) 25 | .is_err() 26 | { 27 | cprintln!("\nFailed to backup\n"); 28 | } 29 | 30 | if run_cmd!( 31 | sudo -E restic -r $backend:$repository --verbose --verbose forget --keep-last $keep_last 2>/dev/null; 32 | ) 33 | .is_err() 34 | { 35 | cprintln!("\nFailed to delete old snapshots keeping last {keep_last}\n"); 36 | 37 | if confirm("Do you want to repair? (Y/n): ", true) 38 | { 39 | repair(backend, repository, true)?; 40 | 41 | if run_cmd!( 42 | sudo -E restic -r $backend:$repository --verbose --verbose forget --keep-last $keep_last 2>/dev/null; 43 | ) 44 | .is_err() 45 | { 46 | cprintln!( 47 | "\nHouston, we have a problem! Failed to delete old snapshots keeping last {keep_last} AGAIN\n" 48 | ) 49 | } 50 | } 51 | } 52 | 53 | Ok(()) 54 | } 55 | 56 | pub fn backup(noconfirm: bool) -> Result<()> { 57 | clear()?; 58 | cprintln!("BACKUP"); 59 | println!(); 60 | 61 | let settings = get_config()?; 62 | 63 | if noconfirm { 64 | for setting in settings { 65 | set_environment_variables(&setting)?; 66 | do_backup(&setting)?; 67 | } 68 | } else { 69 | let selection = if settings.len() > 1 { 70 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 71 | select("Where do you want to perform a backup?", selections) 72 | } else { 73 | 0 74 | }; 75 | 76 | let setting = &settings[selection]; 77 | 78 | set_environment_variables(setting)?; 79 | 80 | if confirm( 81 | &format!( 82 | "Do you want to perform a backup for {}? (Y/n): ", 83 | setting.name 84 | ), 85 | true, 86 | ) { 87 | do_backup(setting)?; 88 | pause()?; 89 | } 90 | if !noconfirm { 91 | selector()?; 92 | } 93 | } 94 | 95 | Ok(()) 96 | } 97 | -------------------------------------------------------------------------------- /src/modules/cache.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::selector::selector, 3 | utils::{ 4 | root_checker::root_checker, 5 | tools::{clear, confirm, pause}, 6 | }, 7 | }; 8 | use anyhow::Result; 9 | use cmd_lib::run_cmd; 10 | use color_print::cprintln; 11 | 12 | fn clean_cache() -> Result<()> { 13 | root_checker()?; 14 | 15 | if run_cmd!( 16 | sudo -E restic cache --cleanup 17 | ) 18 | .is_err() 19 | { 20 | cprintln!("\nFailed to clean cache\n"); 21 | } 22 | 23 | Ok(()) 24 | } 25 | 26 | pub fn cache(noconfirm: bool) -> Result<()> { 27 | clear()?; 28 | cprintln!("CACHE"); 29 | println!(); 30 | 31 | if noconfirm || confirm("Do you want to clean cache? (Y/n): ", true) { 32 | clean_cache()?; 33 | 34 | if !noconfirm { 35 | pause()?; 36 | selector()?; 37 | } 38 | } else { 39 | selector()?; 40 | } 41 | 42 | Ok(()) 43 | } 44 | -------------------------------------------------------------------------------- /src/modules/check.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::{repair::repair, selector::selector}, 3 | utils::{ 4 | get_config::get_config, 5 | root_checker::root_checker, 6 | set_environment_variables::set_environment_variables, 7 | tools::{clear, confirm, pause, select}, 8 | }, 9 | }; 10 | use anyhow::Result; 11 | use cmd_lib::run_cmd; 12 | use color_print::cprintln; 13 | 14 | fn do_check(backend: &str, repository: &str) -> Result<()> { 15 | root_checker()?; 16 | 17 | if run_cmd!( 18 | sudo -E restic -r $backend:$repository check; 19 | ) 20 | .is_err() 21 | { 22 | cprintln!("\nFailed to check\n"); 23 | 24 | if confirm("Do you want to repair? (Y/n): ", true) { 25 | repair(backend, repository, true)?; 26 | pause()?; 27 | } 28 | } 29 | Ok(()) 30 | } 31 | 32 | pub fn check(noconfirm: bool) -> Result<()> { 33 | clear()?; 34 | cprintln!("CHECK"); 35 | println!(); 36 | 37 | let settings = get_config()?; 38 | 39 | let selection = if settings.len() > 1 { 40 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 41 | select("Where do you want to check?", selections) 42 | } else { 43 | 0 44 | }; 45 | 46 | set_environment_variables(&settings[selection])?; 47 | 48 | let backend = &settings[selection].backend; 49 | let repository = &settings[selection].repository; 50 | 51 | do_check(backend, repository)?; 52 | pause()?; 53 | 54 | if !noconfirm { 55 | selector()?; 56 | } 57 | Ok(()) 58 | } 59 | -------------------------------------------------------------------------------- /src/modules/custom.rs: -------------------------------------------------------------------------------- 1 | use std::{process::Command, time::Duration}; 2 | 3 | use crate::{ 4 | macros::errors::error, 5 | utils::{ 6 | get_config::get_config, 7 | root_checker::root_checker, 8 | set_environment_variables::set_environment_variables, 9 | tools::{clear, select}, 10 | }, 11 | }; 12 | use anyhow::{Context, Result}; 13 | use color_print::cprintln; 14 | use indicatif::ProgressBar; 15 | 16 | fn run_custom_command(backend: &str, repository: &str, args: &Vec) -> Result<()> { 17 | root_checker()?; 18 | 19 | let pb = ProgressBar::new_spinner(); 20 | pb.enable_steady_tick(Duration::from_millis(120)); 21 | pb.set_message("Loading custom command..."); 22 | 23 | let out = Command::new("sudo") 24 | .arg("-E") 25 | .arg("restic") 26 | .arg("-r") 27 | .arg(format!("{}:{}", &backend, &repository)) 28 | .args(args) 29 | .output() 30 | .context(error!("Failed to run custom command!"))?; 31 | 32 | pb.finish_and_clear(); 33 | 34 | println!("{}", String::from_utf8(out.stdout)?); 35 | 36 | Ok(()) 37 | } 38 | 39 | pub fn custom(args: &Vec) -> Result<()> { 40 | clear()?; 41 | cprintln!("CUSTOM"); 42 | println!(); 43 | 44 | let settings = get_config()?; 45 | 46 | let selection = if settings.len() > 1 { 47 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 48 | select("Where do you want to work?", selections) 49 | } else { 50 | 0 51 | }; 52 | 53 | set_environment_variables(&settings[selection])?; 54 | 55 | let backend = &settings[selection].backend; 56 | let repository = &settings[selection].repository; 57 | 58 | run_custom_command(backend, repository, args)?; 59 | 60 | Ok(()) 61 | } 62 | -------------------------------------------------------------------------------- /src/modules/delete.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::{repair::repair, selector::selector}, 3 | utils::{ 4 | get_config::get_config, 5 | root_checker::root_checker, 6 | set_environment_variables::set_environment_variables, 7 | snapshots_selector::snapshots_selector, 8 | tools::{clear, confirm, pause, select}, 9 | }, 10 | }; 11 | use anyhow::Result; 12 | use cmd_lib::run_cmd; 13 | use color_print::cprintln; 14 | 15 | fn delete_snapshot(backend: &str, repository: &str, delete_snapshots: &str) -> Result<()> { 16 | root_checker()?; 17 | 18 | if run_cmd!( 19 | sudo -E restic -r $backend:$repository forget $delete_snapshots; 20 | ) 21 | .is_err() 22 | { 23 | cprintln!("\nFailed to delete snapshot!\n"); 24 | 25 | if confirm("Do you want to repair? (Y/n): ", true) { 26 | repair(backend, repository, true)?; 27 | if run_cmd!( 28 | sudo -E restic -r $backend:$repository forget $delete_snapshots; 29 | ) 30 | .is_err() 31 | { 32 | cprintln!("\nHouston, we have a problem! Failed to delete the snapshot AGAIN\n"); 33 | } 34 | } 35 | pause()?; 36 | } 37 | 38 | Ok(()) 39 | } 40 | 41 | pub fn delete(noconfirm: bool) -> Result<()> { 42 | clear()?; 43 | cprintln!("DELETE"); 44 | println!(); 45 | 46 | let settings = get_config()?; 47 | 48 | let selection = if settings.len() > 1 { 49 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 50 | select("What snapshot do you want to delete?", selections) 51 | } else { 52 | 0 53 | }; 54 | 55 | set_environment_variables(&settings[selection])?; 56 | 57 | let backend = &settings[selection].backend; 58 | let repository = &settings[selection].repository; 59 | let delete_snapshots = snapshots_selector(backend, repository)?; 60 | 61 | if confirm( 62 | &format!("Do you want to delete the snapshot with ID {delete_snapshots}? (Y/n): "), 63 | true, 64 | ) { 65 | delete_snapshot(backend, repository, &delete_snapshots)?; 66 | } 67 | 68 | if !noconfirm { 69 | selector()?; 70 | } 71 | Ok(()) 72 | } 73 | -------------------------------------------------------------------------------- /src/modules/initialize.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::selector::selector, 3 | utils::{ 4 | get_config::get_config, 5 | root_checker::root_checker, 6 | set_environment_variables::set_environment_variables, 7 | tools::{clear, confirm, pause}, 8 | }, 9 | }; 10 | use anyhow::Result; 11 | use cmd_lib::run_cmd; 12 | use color_print::cprintln; 13 | use indicatif::ProgressBar; 14 | use std::time::Duration; 15 | 16 | fn initialize_repository(backend: &str, repository: &str) -> Result<()> { 17 | root_checker()?; 18 | 19 | let pb = ProgressBar::new_spinner(); 20 | pb.enable_steady_tick(Duration::from_millis(120)); 21 | pb.set_message("Initializing repositories..."); 22 | 23 | if run_cmd!( 24 | sudo -E restic -r $backend:$repository init 2>/dev/null; 25 | ) 26 | .is_err() 27 | { 28 | pb.finish_and_clear(); 29 | cprintln!("\nRepository: {repository} already exists\n"); 30 | } 31 | 32 | pb.finish_and_clear(); 33 | 34 | Ok(()) 35 | } 36 | 37 | pub fn initialize(noconfirm: bool) -> Result<()> { 38 | clear()?; 39 | cprintln!("INITIALIZE REPOSITORIES"); 40 | println!(); 41 | 42 | let settings = get_config()?; 43 | 44 | if confirm("Do you want to initialize all repositories? (Y/n): ", true) { 45 | for conf in settings { 46 | set_environment_variables(&conf)?; 47 | 48 | let backend = &conf.backend; 49 | let repository = &conf.repository; 50 | 51 | initialize_repository(backend, repository)?; 52 | } 53 | pause()?; 54 | } 55 | 56 | if !noconfirm { 57 | selector()?; 58 | } 59 | Ok(()) 60 | } 61 | -------------------------------------------------------------------------------- /src/modules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod backup; 2 | pub mod cache; 3 | pub mod check; 4 | pub mod custom; 5 | pub mod delete; 6 | pub mod initialize; 7 | pub mod repair; 8 | pub mod restore; 9 | pub mod selector; 10 | pub mod snapshots; 11 | pub mod update; 12 | -------------------------------------------------------------------------------- /src/modules/repair.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::selector::selector, 3 | utils::{ 4 | root_checker::root_checker, 5 | tools::{confirm, pause}, 6 | }, 7 | }; 8 | use anyhow::Result; 9 | use cmd_lib::run_cmd; 10 | use color_print::cprintln; 11 | 12 | fn repair_repository(backend: &str, repository: &str) -> Result<()> { 13 | root_checker()?; 14 | 15 | if run_cmd!( 16 | sudo -E restic -r $backend:$repository unlock; 17 | sudo -E restic -r $backend:$repository rebuild-index; 18 | sudo -E restic -r $backend:$repository prune; 19 | sudo -E restic -r $backend:$repository check; 20 | ) 21 | .is_err() 22 | { 23 | cprintln!("\nFailed to repair\n"); 24 | } 25 | 26 | Ok(()) 27 | } 28 | 29 | pub fn repair(backend: &str, repository: &str, noconfirm: bool) -> Result<()> { 30 | if noconfirm || confirm("Do you want to repair your repository? (Y/n): ", true) { 31 | repair_repository(backend, repository)?; 32 | 33 | if !noconfirm { 34 | pause()?; 35 | selector()?; 36 | } 37 | } else { 38 | selector()?; 39 | } 40 | Ok(()) 41 | } 42 | -------------------------------------------------------------------------------- /src/modules/restore.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::selector::selector, 3 | utils::{ 4 | get_config::get_config, 5 | root_checker::root_checker, 6 | set_environment_variables::set_environment_variables, 7 | snapshots_selector::snapshots_selector, 8 | tools::{clear, confirm, pause, select}, 9 | }, 10 | }; 11 | use anyhow::Result; 12 | use cmd_lib::run_cmd; 13 | use color_print::cprintln; 14 | 15 | fn do_restore( 16 | backend: &str, 17 | repository: &str, 18 | restore_folder: &str, 19 | restore_snapshot: &str, 20 | user: &str, 21 | ) -> Result<()> { 22 | root_checker()?; 23 | 24 | if run_cmd!( 25 | sudo -E restic -r $backend:$repository --verbose --verbose restore $restore_snapshot --target $restore_folder; 26 | ) 27 | .is_err() 28 | { 29 | cprintln!("Failed to restore snapshot: {restore_snapshot} into: {restore_folder}"); 30 | } 31 | if run_cmd!(sudo -E chown -R $user:$user $restore_folder 2>/dev/null).is_err() { 32 | cprintln!("\nFailed to change ownership of: {restore_folder}\n"); 33 | } 34 | 35 | Ok(()) 36 | } 37 | 38 | pub fn restore(noconfirm: bool) -> Result<()> { 39 | clear()?; 40 | cprintln!("RESTORE"); 41 | println!(); 42 | 43 | let settings = get_config()?; 44 | 45 | let selection = if settings.len() > 1 { 46 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 47 | select("Where do you want to restore from?", selections) 48 | } else { 49 | 0 50 | }; 51 | 52 | let setting = &settings[selection]; 53 | 54 | set_environment_variables(setting)?; 55 | 56 | let backend = &setting.backend; 57 | let repository = &setting.repository; 58 | let restore_folder = &setting.restore_folder; 59 | let restore_snapshot = snapshots_selector(backend, repository)?; 60 | let user = &setting.user; 61 | 62 | if confirm( 63 | &format!("Do you want to restore the snapshot with ID {restore_snapshot}? (Y/n): "), 64 | true, 65 | ) { 66 | do_restore(backend, repository, restore_folder, &restore_snapshot, user)?; 67 | pause()?; 68 | } 69 | if !noconfirm { 70 | selector()?; 71 | } 72 | Ok(()) 73 | } 74 | -------------------------------------------------------------------------------- /src/modules/selector.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::{ 3 | backup::backup, cache::cache, check::check, delete::delete, initialize::initialize, 4 | repair::repair, restore::restore, snapshots::snapshots, 5 | }, 6 | utils::{ 7 | get_config::get_config, 8 | set_environment_variables::set_environment_variables, 9 | tools::{clear, select, select_title}, 10 | }, 11 | }; 12 | use anyhow::Result; 13 | use color_print::{cformat, cprintln}; 14 | use std::process::exit; 15 | 16 | fn handle_selection(selection: &str) -> Result<()> { 17 | match selection { 18 | "Backup" => backup(false), 19 | "Restore" => restore(false), 20 | "Snapshots" => snapshots(false), 21 | "Delete" => delete(false), 22 | "Initialize" => initialize(false), 23 | "Check" => check(false), 24 | "Repair" => handle_repair(), 25 | "Cache" => cache(false), 26 | "Exit" => { 27 | exit(0); 28 | } 29 | _ => exit(0), 30 | } 31 | } 32 | 33 | fn handle_repair() -> Result<()> { 34 | clear()?; 35 | cprintln!("REPAIR"); 36 | println!(); 37 | 38 | let settings = get_config()?; 39 | 40 | let selection = if settings.len() > 1 { 41 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 42 | select("Where do you want to perform a repair?", selections) 43 | } else { 44 | 0 45 | }; 46 | 47 | set_environment_variables(&settings[selection])?; 48 | 49 | let backend = &settings[selection].backend; 50 | let repository = &settings[selection].repository; 51 | 52 | repair(backend, repository, false) 53 | } 54 | 55 | pub fn selector() -> Result<()> { 56 | clear()?; 57 | let exit_str = cformat!("Exit"); 58 | let selections = vec![ 59 | "Backup".to_string(), 60 | "Restore".to_string(), 61 | "Snapshots".to_string(), 62 | "Delete".to_string(), 63 | "Initialize".to_string(), 64 | "Check".to_string(), 65 | "Repair".to_string(), 66 | "Cache".to_string(), 67 | exit_str, 68 | ]; 69 | let selection = select_title("WRESTIC", selections.clone()); 70 | 71 | handle_selection(&selections[selection]) 72 | } 73 | -------------------------------------------------------------------------------- /src/modules/snapshots.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | modules::selector::selector, 3 | utils::{ 4 | get_config::get_config, 5 | root_checker::root_checker, 6 | set_environment_variables::set_environment_variables, 7 | tools::{clear, pause, select}, 8 | }, 9 | }; 10 | use anyhow::Result; 11 | use cmd_lib::run_cmd; 12 | use color_print::cprintln; 13 | use indicatif::ProgressBar; 14 | use std::time::Duration; 15 | 16 | fn get_snapshots(backend: &str, repository: &str) -> Result<()> { 17 | root_checker()?; 18 | 19 | let pb = ProgressBar::new_spinner(); 20 | pb.enable_steady_tick(Duration::from_millis(120)); 21 | pb.set_message("Loading snapshots..."); 22 | 23 | if run_cmd!( 24 | sudo -E restic -r $backend:$repository --verbose --verbose snapshots; 25 | ) 26 | .is_err() 27 | { 28 | pb.finish_and_clear(); 29 | cprintln!("Failed to list snapshots"); 30 | } 31 | 32 | pb.finish_and_clear(); 33 | 34 | Ok(()) 35 | } 36 | 37 | pub fn snapshots(noconfirm: bool) -> Result<()> { 38 | clear()?; 39 | cprintln!("SNAPSHOTS"); 40 | println!(); 41 | 42 | let settings = get_config()?; 43 | 44 | let selection = if settings.len() > 1 { 45 | let selections: Vec = settings.iter().map(|x| x.name.to_string()).collect(); 46 | select("Where do you want to list snapshots from?", selections) 47 | } else { 48 | 0 49 | }; 50 | 51 | let setting = &settings[selection]; 52 | 53 | set_environment_variables(setting)?; 54 | 55 | let backend = &setting.backend; 56 | let repository = &setting.repository; 57 | 58 | get_snapshots(backend, repository)?; 59 | pause()?; 60 | 61 | if !noconfirm { 62 | selector()?; 63 | } 64 | Ok(()) 65 | } 66 | -------------------------------------------------------------------------------- /src/modules/update.rs: -------------------------------------------------------------------------------- 1 | use crate::macros::errors::error; 2 | use crate::utils::{ 3 | get_current_shell::get_current_shell, 4 | root_checker::root_checker, 5 | tools::{clear, pause}, 6 | }; 7 | use anyhow::{Context, Result}; 8 | use cmd_lib::run_cmd; 9 | use color_print::cprintln; 10 | use flate2::read::GzDecoder; 11 | use indicatif::ProgressBar; 12 | use std::{ 13 | env::current_exe, 14 | fs::{remove_file, File}, 15 | io::{BufReader, ErrorKind}, 16 | os::unix::process::CommandExt, 17 | path::Path, 18 | process::Command, 19 | time::Duration, 20 | }; 21 | use tar::Archive; 22 | 23 | fn get_current_version() -> Result { 24 | let version = env!("CARGO_PKG_VERSION").to_string(); 25 | Ok(version) 26 | } 27 | 28 | fn get_latest_version(url: &str) -> Result { 29 | let shell = get_current_shell()?; 30 | let output = Command::new(shell) 31 | .arg("-c") 32 | .arg(format!( 33 | r#"curl -s "{url}" | grep tag_name | grep -Eo '[0-9.]+'"# 34 | )) 35 | .output() 36 | .context(error!("Failed fetching the latest version of wrestic."))?; 37 | let version_string = String::from_utf8_lossy(&output.stdout); 38 | let version = version_string.trim().to_string(); 39 | if version.is_empty() { 40 | Err(error!( 41 | "Failed fetching the latest version of wrestic. Try again later." 42 | ))?; 43 | } 44 | Ok(version) 45 | } 46 | 47 | fn extract_wrestic(file_path: &str, extract_path: &str) -> Result<()> { 48 | let file = File::open(file_path)?; 49 | let gz = GzDecoder::new(file); 50 | let tar = BufReader::new(gz); 51 | let mut archive = Archive::new(tar); 52 | let extract_path_parent = Path::new(extract_path).parent().unwrap().to_owned(); 53 | 54 | match archive.unpack(&extract_path_parent) { 55 | Ok(_) => Ok(()), 56 | Err(e) => { 57 | if e.kind() == std::io::ErrorKind::PermissionDenied { 58 | Command::new("sudo") 59 | .arg("-E") 60 | .arg("tar") 61 | .arg("-xvf") 62 | .arg(file_path) 63 | .arg("-C") 64 | .arg(extract_path_parent.to_str().unwrap()) 65 | .exec(); 66 | Ok(()) 67 | } else { 68 | Err(e.into()) 69 | } 70 | } 71 | } 72 | } 73 | 74 | fn download_latest_version(shell: &str, url: &str, tmp_path: &str) -> Result<()> { 75 | let command = format!( 76 | r#"curl -sL $(curl -s "{url}" | grep browser_download_url | cut -d '"' -f 4) -o {tmp_path}"# 77 | ); 78 | 79 | let command_result = run_cmd!( 80 | $shell -c $command 2>/dev/null; 81 | ); 82 | 83 | if let Err(e) = command_result { 84 | if format!("{}", e).contains("Permission denied") { 85 | root_checker()?; 86 | 87 | if run_cmd!( 88 | sudo -E $shell -c $command 2>/dev/null; 89 | ) 90 | .is_err() 91 | { 92 | Err(error!("Failed downloading the latest version of wrestic"))?; 93 | } 94 | } else { 95 | Err(error!("Failed downloading the latest version of wrestic"))?; 96 | } 97 | } 98 | 99 | Ok(()) 100 | } 101 | 102 | fn remove_file_with_permission_check(file_path: &str) -> Result<()> { 103 | if let Err(e) = remove_file(file_path) { 104 | if e.kind() == ErrorKind::PermissionDenied { 105 | let output = Command::new("sudo") 106 | .arg("-E") 107 | .arg("rm") 108 | .arg(file_path) 109 | .output() 110 | .expect("Failed to execute command"); 111 | 112 | if !output.status.success() { 113 | return Err(error!("Failed removing file")); 114 | } 115 | } else { 116 | return Err(error!("Failed removing file")); 117 | } 118 | } 119 | 120 | Ok(()) 121 | } 122 | 123 | pub fn update() -> Result<()> { 124 | clear()?; 125 | cprintln!("UPDATER"); 126 | println!(); 127 | 128 | let current_executable = ¤t_exe()?; 129 | let bin_path = current_executable.to_str().unwrap(); 130 | let tmp_path = "/tmp/wrestic.tar.gz"; 131 | let url = "https://api.github.com/repos/alvaro17f/wrestic/releases/latest"; 132 | 133 | if get_current_version()? >= get_latest_version(url)? { 134 | cprintln!("Wrestic is already up to date!\n"); 135 | pause()? 136 | } else { 137 | cprintln!( 138 | "Wrestic is outdated!\ncurrent: {}\nlatest: {}\n", 139 | get_current_version()?, 140 | get_latest_version(url)? 141 | ); 142 | 143 | let pb = ProgressBar::new_spinner(); 144 | pb.enable_steady_tick(Duration::from_millis(120)); 145 | pb.set_message("Updating wrestic..."); 146 | 147 | let shell = get_current_shell()?; 148 | 149 | download_latest_version(&shell, url, tmp_path)?; 150 | 151 | pb.finish_and_clear(); 152 | 153 | remove_file_with_permission_check(bin_path)?; 154 | 155 | pb.finish_and_clear(); 156 | 157 | if extract_wrestic(tmp_path, bin_path).is_err() { 158 | Err(error!("Failed extracting the latest version of wrestic"))?; 159 | } 160 | 161 | pb.finish_and_clear(); 162 | 163 | cprintln!( 164 | "Wrestic has been updated to version {}!", 165 | get_latest_version(url)? 166 | ); 167 | } 168 | 169 | Ok(()) 170 | } 171 | -------------------------------------------------------------------------------- /src/utils/get_config.rs: -------------------------------------------------------------------------------- 1 | use crate::macros::errors::error; 2 | use crate::utils::tools::select; 3 | use anyhow::{Context, Result}; 4 | use config::Config; 5 | use lazy_static::lazy_static; 6 | use std::{collections::HashMap, fs, path::PathBuf, sync::Mutex}; 7 | 8 | #[derive(Debug)] 9 | pub struct Settings { 10 | pub user: String, 11 | pub backend: String, 12 | pub name: String, 13 | pub repository: String, 14 | pub restic_password: String, 15 | pub backup_folder: String, 16 | pub restore_folder: String, 17 | pub keep_last: String, 18 | pub env: Option>, 19 | } 20 | 21 | lazy_static! { 22 | static ref USER_CHOICE: Mutex> = Mutex::new(None); 23 | } 24 | 25 | fn find_config_file() -> Option { 26 | if let Ok(user_choice) = USER_CHOICE.lock() { 27 | if let Some(path) = user_choice.to_owned() { 28 | return Some(path); 29 | } 30 | } 31 | let home_dir = PathBuf::from("/home/"); 32 | let mut config_paths = Vec::new(); 33 | for entry in fs::read_dir(home_dir).ok()? { 34 | let entry = entry.ok()?; 35 | let mut config_path = entry.path(); 36 | config_path.push(".config/wrestic/wrestic.toml"); 37 | if config_path.exists() { 38 | config_paths.push(config_path); 39 | } 40 | } 41 | if config_paths.is_empty() { 42 | let root_dir = PathBuf::from("/root/"); 43 | let mut config_path = root_dir; 44 | config_path.push(".config/wrestic/wrestic.toml"); 45 | if config_path.exists() { 46 | config_paths.push(config_path); 47 | } 48 | } 49 | if config_paths.is_empty() { 50 | None 51 | } else if config_paths.len() == 1 { 52 | Some(config_paths[0].to_path_buf()) 53 | } else { 54 | let items: Vec<&str> = config_paths 55 | .iter() 56 | .map(|p| p.to_str().unwrap_or_default()) 57 | .collect(); 58 | let selection = select( 59 | "Which config file do you want to use?", 60 | items.iter().map(|x| x.to_string()).collect(), 61 | ); 62 | let result = Some(config_paths[selection].to_path_buf()); 63 | if let Ok(mut user_choice) = USER_CHOICE.lock() { 64 | *user_choice = result.to_owned(); 65 | } 66 | result 67 | } 68 | } 69 | 70 | pub fn get_config() -> Result> { 71 | let config = Config::builder() 72 | .add_source(config::File::with_name( 73 | find_config_file() 74 | .context(error!("Failed to find config file"))? 75 | .to_str() 76 | .context(error!("Failed to convert config path to string"))?, 77 | )) 78 | .build()?; 79 | 80 | let user = find_config_file() 81 | .unwrap() 82 | .iter() 83 | .nth(2) 84 | .and_then(|f| f.to_str()) 85 | .unwrap_or_default() 86 | .to_string(); 87 | 88 | let settings_table = config.get_table("settings")?; 89 | 90 | let mut settings: Vec = Vec::new(); 91 | 92 | for (key, value) in &settings_table { 93 | let deserialized_value = value.to_owned().try_deserialize::()?; 94 | 95 | let settings_struct = Settings { 96 | user: user.to_owned().replace('\"', ""), 97 | name: key.to_string().replace('\"', ""), 98 | 99 | backend: deserialized_value 100 | .get("BACKEND") 101 | .context(error!(format!( 102 | "Failed to get the value of BACKEND for {key}" 103 | )))? 104 | .to_string() 105 | .replace('\"', ""), 106 | repository: deserialized_value 107 | .get("REPOSITORY") 108 | .context(error!(format!( 109 | "Failed to get the value of REPOSITORY for {key}" 110 | )))? 111 | .to_string() 112 | .replace('\"', ""), 113 | restic_password: deserialized_value 114 | .get("RESTIC_PASSWORD") 115 | .context(error!(format!( 116 | "Failed to get the value of RESTIC_PASSWORD for {key}" 117 | )))? 118 | .to_string() 119 | .replace('\"', ""), 120 | backup_folder: deserialized_value 121 | .get("BACKUP_FOLDER") 122 | .context(error!(format!( 123 | "Failed to get the value of BACKUP_FOLER for {key}" 124 | )))? 125 | .to_string() 126 | .replace('\"', ""), 127 | restore_folder: deserialized_value 128 | .get("RESTORE_FOLDER") 129 | .context(error!(format!( 130 | "Failed to get the value of RESTORE_FOLDER for {key}" 131 | )))? 132 | .to_string() 133 | .replace('\"', ""), 134 | keep_last: deserialized_value 135 | .get("KEEP_LAST") 136 | .context(error!(format!( 137 | "Failed to get the value of KEEP_LAST for {key}" 138 | )))? 139 | .to_string() 140 | .replace('\"', ""), 141 | env: deserialized_value.get("env").iter().next().map(|x| { 142 | x.as_object() 143 | .unwrap() 144 | .iter() 145 | .map(|(k, v)| (k.to_string(), v.to_string().replace('\"', ""))) 146 | .collect() 147 | }), 148 | }; 149 | 150 | settings.push(settings_struct); 151 | } 152 | settings.sort_by(|a, b| a.name.cmp(&b.name)); 153 | 154 | Ok(settings) 155 | } 156 | -------------------------------------------------------------------------------- /src/utils/get_current_shell.rs: -------------------------------------------------------------------------------- 1 | use crate::macros::errors::error; 2 | use anyhow::{Context, Result}; 3 | use std::env; 4 | 5 | pub fn get_current_shell() -> Result { 6 | let mut shell = env::var("SHELL").context(error!("Failed getting the current shell."))?; 7 | if shell.is_empty() { 8 | shell = "/bin/sh".to_string(); 9 | } 10 | Ok(shell) 11 | } 12 | -------------------------------------------------------------------------------- /src/utils/get_user.rs: -------------------------------------------------------------------------------- 1 | #![allow(dead_code)] 2 | use crate::macros::errors::error; 3 | use crate::utils::tools::select; 4 | use anyhow::Result; 5 | use std::fs; 6 | 7 | pub fn get_user() -> Result { 8 | let mut users = Vec::new(); 9 | 10 | for entry in fs::read_dir("/home")? { 11 | let entry = entry?; 12 | let path = entry.path(); 13 | if path.is_dir() { 14 | let config_path = path.join(".config/wrestic/wrestic.toml"); 15 | if config_path.exists() { 16 | if let Some(user) = path.file_name().and_then(|os_str| os_str.to_str()) { 17 | users.push(user.to_string()); 18 | } 19 | } 20 | } 21 | } 22 | 23 | match users.len() { 24 | 0 => Err(error!( 25 | "No users found. Please create a config file at ~/.config/wrestic/wrestic.toml for a user." 26 | )), 27 | 1 => Ok(users[0].to_string()), 28 | _ => { 29 | let selection = select("Who are you?", users.clone()); 30 | Ok(users[selection].to_string()) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod get_config; 2 | pub mod get_current_shell; 3 | pub mod get_user; 4 | pub mod restic_checker; 5 | pub mod root_checker; 6 | pub mod set_environment_variables; 7 | pub mod snapshots_selector; 8 | pub mod tools; 9 | -------------------------------------------------------------------------------- /src/utils/restic_checker.rs: -------------------------------------------------------------------------------- 1 | use crate::macros::errors::error; 2 | use crate::utils::{ 3 | get_current_shell::get_current_shell, 4 | root_checker::root_checker, 5 | tools::{clear, confirm, pause}, 6 | }; 7 | use anyhow::Result; 8 | use cmd_lib::run_cmd; 9 | use color_print::cprintln; 10 | use std::process::exit; 11 | use which::which; 12 | 13 | fn install_restic(shell: &str, command: &str) -> Result<()> { 14 | root_checker()?; 15 | 16 | if run_cmd!( 17 | sudo -E $shell -c $command; 18 | ) 19 | .is_err() 20 | { 21 | Err(error!("Failed to install Restic")) 22 | } else { 23 | cprintln!("Restic installed successfully!"); 24 | pause()?; 25 | Ok(()) 26 | } 27 | } 28 | 29 | pub fn restic_checker() -> Result<()> { 30 | let url = "https://api.github.com/repos/restic/restic/releases/latest"; 31 | let command = format!( 32 | r#"curl -sL $(curl -s "{url}" | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4) -o /tmp/restic.bz2 && bunzip2 /tmp/restic.bz2 && chmod +x /tmp/restic && mv -f /tmp/restic /usr/bin/restic"# 33 | ); 34 | match which("restic") { 35 | Ok(_) => Ok(()), 36 | Err(_) => { 37 | clear()?; 38 | cprintln!("RESTIC"); 39 | println!(); 40 | cprintln!("Restic not found\n"); 41 | if confirm("Would you like to install Restic? (Y/n): ", true) { 42 | let shell = get_current_shell()?; 43 | Ok(install_restic(&shell, &command)?) 44 | } else { 45 | exit(0); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/utils/root_checker.rs: -------------------------------------------------------------------------------- 1 | use crate::macros::errors::error; 2 | 3 | use anyhow::Result; 4 | use nix::unistd::geteuid; 5 | use std::process::Command; 6 | 7 | pub fn root_checker() -> Result<()> { 8 | if geteuid().is_root() { 9 | Ok(()) 10 | } else { 11 | if Command::new("sudo").arg("-v").status().is_err() { 12 | Err(error!("You need to be root to run this command"))?; 13 | }; 14 | Ok(()) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/utils/set_environment_variables.rs: -------------------------------------------------------------------------------- 1 | use crate::utils::get_config::Settings; 2 | use anyhow::Result; 3 | use std::env; 4 | 5 | pub fn set_environment_variables(setting: &Settings) -> Result<()> { 6 | env::set_var("USER", &setting.user); 7 | env::set_var("RESTIC_PASSWORD", &setting.restic_password); 8 | for env in &setting.env { 9 | for (key, value) in env { 10 | env::set_var(key, value); 11 | } 12 | } 13 | Ok(()) 14 | } 15 | -------------------------------------------------------------------------------- /src/utils/snapshots_selector.rs: -------------------------------------------------------------------------------- 1 | use crate::utils::root_checker::root_checker; 2 | use crate::utils::tools::select; 3 | use anyhow::Result; 4 | use indicatif::ProgressBar; 5 | use regex::Regex; 6 | use std::{process::Command, time::Duration}; 7 | 8 | fn get_snapshots(backend: &str, repository: &str) -> Result { 9 | let restic = Command::new("sudo") 10 | .arg("-E") 11 | .arg("restic") 12 | .arg("-r") 13 | .arg(format!("{}:{}", backend, repository)) 14 | .arg("--verbose") 15 | .arg("--verbose") 16 | .arg("snapshots") 17 | .output()?; 18 | 19 | let restic = String::from_utf8(restic.stdout)?; 20 | 21 | Ok(restic) 22 | } 23 | 24 | fn parse_snapshots(restic: &str) -> Result> { 25 | let restic_rev = restic 26 | .lines() 27 | .rev() 28 | .collect::>() 29 | .to_owned() 30 | .join("\n"); 31 | 32 | let selections = Regex::new(r"(\w+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})")? 33 | .captures_iter(&restic_rev) 34 | .map(|cap| format!("[{}] - {}", &cap[1], &cap[2])) 35 | .collect::>(); 36 | 37 | Ok(selections) 38 | } 39 | 40 | pub fn snapshots_selector(backend: &str, repository: &str) -> Result { 41 | root_checker()?; 42 | 43 | let pb = ProgressBar::new_spinner(); 44 | pb.enable_steady_tick(Duration::from_millis(120)); 45 | pb.set_message("Loading snapshots..."); 46 | 47 | let restic = get_snapshots(backend, repository)?; 48 | 49 | pb.finish_and_clear(); 50 | 51 | let selections = parse_snapshots(&restic)?; 52 | 53 | let selection = select("Snapshots:", selections); 54 | 55 | let selection = Regex::new(r"(\w+)\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})")? 56 | .captures_iter(&restic) 57 | .map(|cap| (cap[1]).to_string()) 58 | .collect::>() 59 | .into_iter() 60 | .rev() 61 | .collect::>()[selection] 62 | .to_owned(); 63 | 64 | Ok(selection) 65 | } 66 | -------------------------------------------------------------------------------- /src/utils/tools.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Result; 2 | use color_print::{cformat, cprintln}; 3 | use dialoguer::{theme::ColorfulTheme, Confirm, Select}; 4 | use std::{ 5 | io::{self, BufRead}, 6 | process::Command, 7 | }; 8 | 9 | pub fn clear() -> Result<()> { 10 | Command::new("clear").status()?; 11 | Ok(()) 12 | } 13 | 14 | pub fn pause() -> Result<()> { 15 | cprintln!("Press 'Enter' to continue..."); 16 | io::stdin().lock().lines().next(); 17 | clear()?; 18 | Ok(()) 19 | } 20 | 21 | pub fn confirm(prompt: &str, default_value: bool) -> bool { 22 | Confirm::with_theme(&ColorfulTheme::default()) 23 | .with_prompt(cformat!("{}", prompt)) 24 | .default(default_value) 25 | .interact() 26 | .unwrap_or(false) 27 | } 28 | 29 | pub fn select(prompt: &str, selections: Vec) -> usize { 30 | Select::with_theme(&ColorfulTheme::default()) 31 | .with_prompt(cformat!("{}", prompt)) 32 | .default(0) 33 | .max_length(10) 34 | .items(&selections[..]) 35 | .interact() 36 | .unwrap() 37 | } 38 | 39 | pub fn select_title(prompt: &str, selections: Vec) -> usize { 40 | Select::with_theme(&ColorfulTheme::default()) 41 | .with_prompt(cformat!("{}", prompt)) 42 | .default(0) 43 | .max_length(10) 44 | .items(&selections[..]) 45 | .interact() 46 | .unwrap() 47 | } 48 | -------------------------------------------------------------------------------- /vhs/wrestic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvaro17f/wrestic/4e1d8cd63061eabd263e5632d8087033667d8ba8/vhs/wrestic.gif -------------------------------------------------------------------------------- /vhs/wrestic.tape: -------------------------------------------------------------------------------- 1 | Output wrestic.gif 2 | 3 | Set Shell "zsh" 4 | Set FontSize 32 5 | Set Width 1200 6 | Set Height 800 7 | 8 | Sleep 1s 9 | 10 | Type "wrestic" Enter 11 | 12 | Down@500ms 7 13 | 14 | Sleep 3s 15 | 16 | -------------------------------------------------------------------------------- /wrestic.toml: -------------------------------------------------------------------------------- 1 | # You can add as many settings as you want, just make sure the id is unique 2 | # and remember, if your repository doesn't exist, it will be created 3 | # and password will be set to the one you provided in RESTIC_PASSWORD 4 | 5 | ################################# 6 | # BACKBLAZE B2 EXAMPLE PROFILE 7 | ################################# 8 | [settings.backblaze_profile] 9 | BACKEND = "b2" 10 | RESTIC_PASSWORD = "your_backblaze_restic_repo_password" 11 | REPOSITORY = "your_backblaze_bucket_name:your_backblaze_repository" 12 | BACKUP_FOLDER = "/home/username/backup_this_folder" 13 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 14 | KEEP_LAST = 10 15 | 16 | [settings.backblaze_profile.env] 17 | B2_ACCOUNT_ID = "backblaze_application_key_id" 18 | B2_ACCOUNT_KEY = "backblaze_application_key" 19 | 20 | ################################# 21 | # AWS S3 EXAMPLE PROFILE 22 | ################################# 23 | [settings.aws_profile] 24 | BACKEND = "s3" 25 | RESTIC_PASSWORD = "your_aws_restic_repo_password" 26 | REPOSITORY = "s3.amazonaws.com/bucket_name" 27 | BACKUP_FOLDER = "/home/username/backup_this_folder" 28 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 29 | KEEP_LAST = 10 30 | 31 | [settings.aws_profile.env] 32 | AWS_ACCESS_KEY_ID = "aws_access_key" 33 | AWS_SECRET_ACCESS_KEY = "aws_secret_access_key" 34 | 35 | ################################# 36 | # GOOGLE CLOUD STORAGE EXAMPLE PROFILE 37 | ################################# 38 | [settings.google_cloud_storage_profile] 39 | BACKEND = "gs" 40 | RESTIC_PASSWORD = "your_google_cloud_storage_restic_repo_password" 41 | REPOSITORY = "your_bucket_name:/path/to/your/repo" 42 | BACKUP_FOLDER = "/home/username/backup_this_folder" 43 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 44 | KEEP_LAST = 10 45 | 46 | [settings.google_cloud_storage_profile.env] 47 | # you can use the following: 48 | GOOGLE_PROJECT_ID = "google_cloud_storage_project_id" 49 | GOOGLE_APPLICATION_CREDENTIALS = "$HOME/.config/gs-secret-restic-key.json" 50 | # or you can use GOOGLE_ACCESS_TOKEN instead: 51 | GOOGLE_ACCESS_TOKEN = "ya29.a0AfH6SMC78..." 52 | 53 | ################################# 54 | # AZURE EXAMPLE PROFILE 55 | ################################# 56 | [settings.azure_profile] 57 | BACKEND = "azure" 58 | RESTIC_PASSWORD = "your_azure_restic_repo_password" 59 | REPOSITORY = "your_bucket_name:/path/to/your/repo" 60 | BACKUP_FOLDER = "/home/username/backup_this_folder" 61 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 62 | KEEP_LAST = 10 63 | 64 | [settings.azure_profile.env] 65 | AZURE_ACCOUNT_NAME = "azure_account_name" 66 | # for autenthication export one of the following: 67 | AZURE_ACCOUNT_KEY = "azure_secret_key" # for storage account key 68 | AZURE_ACCOUNT_SAS = "azure_sas_token" # for sas 69 | 70 | ################################# 71 | # MINIO EXAMPLE PROFILE 72 | ################################# 73 | [settings.minio_profile] 74 | BACKEND = "s3" 75 | RESTIC_PASSWORD = "your_minio_restic_repo_password" 76 | REPOSITORY = "http://localhost:9000/repo" 77 | BACKUP_FOLDER = "/home/username/backup_this_folder" 78 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 79 | KEEP_LAST = 10 80 | 81 | [settings.minio_profile.env] 82 | AWS_ACCESS_KEY_ID = "minio_access_key" 83 | AWS_SECRET_ACCESS_KEY = "minio_secret_access_key" 84 | 85 | ################################# 86 | # WASABI EXAMPLE PROFILE 87 | ################################# 88 | [settings.wasabi_profile] 89 | BACKEND = "s3" 90 | RESTIC_PASSWORD = "your_aws_restic_repo_password" 91 | REPOSITORY = "https://wasabi_service_url/wasabi_bucket_name" 92 | BACKUP_FOLDER = "/home/username/backup_this_folder" 93 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 94 | KEEP_LAST = 10 95 | 96 | [settings.wasabi_profile.env] 97 | AWS_ACCESS_KEY_ID = "wasabi_access_key" 98 | AWS_SECRET_ACCESS_KEY = "wasabi_secret_access_key" 99 | 100 | ################################# 101 | # LOCAL EXAMPLE PROFILE 102 | ################################# 103 | [settings.local_profile] 104 | BACKEND = "local" 105 | RESTIC_PASSWORD = "your_local_restic_repo_password" 106 | REPOSITORY = "/path/to/your/local/repo" 107 | BACKUP_FOLDER = "/home/username/backup_this_folder" 108 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 109 | KEEP_LAST = 8 110 | 111 | ################################# 112 | # SFTP EXAMPLE PROFILE 113 | ################################# 114 | [settings.sftp_profile] 115 | BACKEND = "sftp" 116 | RESTIC_PASSWORD = "your_sftp_restic_repo_password" 117 | REPOSITORY = "user@host:/path/to/repo" 118 | BACKUP_FOLDER = "/home/username/backup_this_folder" 119 | RESTORE_FOLDER = "/home/username/restore_to_this_folder" 120 | KEEP_LAST = 8 121 | --------------------------------------------------------------------------------