Migrate ALMA to anyhow (#54)

This commit is contained in:
James McMurray 2020-05-31 07:38:20 +02:00 committed by GitHub
parent c8b151fe5f
commit 7152901820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 448 additions and 626 deletions

515
Cargo.lock generated
View File

@ -1,30 +1,38 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "aho-corasick" name = "addr2line"
version = "0.7.6" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gimli 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "aho-corasick"
version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "alma" name = "alma"
version = "0.10.0" version = "0.10.0"
dependencies = [ dependencies = [
"byte-unit 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
"console 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "byte-unit 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"dialoguer 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "dialoguer 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.110 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "which 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -32,181 +40,150 @@ name = "ansi_term"
version = "0.11.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "anyhow"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "hermit-abi 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.34" version = "0.3.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "addr2line 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"object 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "backtrace-sys"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.1.0" version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "byte-unit" name = "byte-unit"
version = "3.0.1" version = "3.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "c2-chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.40" version = "1.0.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "0.1.9" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.0" version = "2.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clicolors-control"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "console" name = "console"
version = "0.9.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "terminal_size 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "dialoguer" name = "dialoguer"
version = "0.5.0" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"console 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "encode_unicode" name = "encode_unicode"
version = "0.3.5" version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "env_logger"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.7.1" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "failure" name = "failure"
version = "0.1.6" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure_derive"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.8" version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "gimli"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.1" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hermit-abi"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -214,7 +191,7 @@ name = "humantime"
version = "1.3.0" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -224,7 +201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.67" version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -232,12 +209,12 @@ name = "log"
version = "0.4.8" version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.2.1" version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -245,16 +222,21 @@ name = "nix"
version = "0.17.0" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "object"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.5" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -268,39 +250,31 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "0.4.10" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro-error-attr 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-error-attr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "proc-macro-error-attr" name = "proc-macro-error-attr"
version = "0.4.10" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "0.4.30" version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -308,52 +282,44 @@ dependencies = [
[[package]] [[package]]
name = "quick-error" name = "quick-error"
version = "1.2.2" version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "quote" name = "quote"
version = "0.6.13" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.7.0" version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"getrandom 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "rand_chacha" name = "rand_chacha"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.5.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"getrandom 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -361,7 +327,7 @@ name = "rand_hc"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -371,18 +337,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.3.4" version = "1.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.15" version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -390,7 +356,7 @@ name = "remove_dir_all"
version = "0.5.2" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -400,20 +366,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.98" version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.110 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.98" version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -423,43 +389,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "structopt" name = "structopt"
version = "0.3.11" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt-derive 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "structopt-derive 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "structopt-derive" name = "structopt-derive"
version = "0.4.4" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro-error 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-error 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "syn" name = "syn"
version = "0.15.44" version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -468,20 +424,9 @@ name = "syn-mid"
version = "0.5.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synstructure"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -489,28 +434,37 @@ name = "tempfile"
version = "3.1.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.0.5" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "terminal_size"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "termios" name = "termios"
version = "0.3.1" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -518,7 +472,7 @@ name = "textwrap"
version = "0.11.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -531,25 +485,20 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.2" version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.110 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.3.0" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.5" version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -559,12 +508,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.1" version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.1" version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -572,18 +521,23 @@ name = "void"
version = "1.0.2" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "which" name = "which"
version = "3.1.0" version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.7" version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -597,10 +551,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "winapi-util" name = "winapi-util"
version = "0.1.2" version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -608,86 +562,73 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wincolor"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata] [metadata]
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum addr2line 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543"
"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum anyhow 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum backtrace 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130"
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum byte-unit 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90139954ec9776c4832d44f212e558ccdacbe915a881bf3de3a1a487fa8d1e87" "checksum byte-unit 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55390dbbf21ce70683f3e926dace00a21da373e35e44a60cafd232e3e9bf2041"
"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)" = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum console 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8c0994e656bba7b922d8dd1245db90672ffb701e684e45be58f20719d69abc5a"
"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" "checksum dialoguer 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4aa86af7b19b40ef9cbef761ed411a49f0afa06b7b6dcd3dfe2f96a3c546138"
"checksum console 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45e0f3986890b3acbc782009e2629dfe2baa430ac091519ce3be26164a2ae6c0" "checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
"checksum dialoguer 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94616e25d2c04fc97253d145f6ca33ad84a584258dc70c4e621cc79a57f903b6"
"checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd"
"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" "checksum failure 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
"checksum getrandom 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "34f33de6f0ae7c9cb5e574502a562e2b512799e32abb801cd1e79ad952b62b49" "checksum gimli 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum hermit-abi 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" "checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)" = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" "checksum libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
"checksum nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" "checksum nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum object 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
"checksum ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
"checksum pretty_env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" "checksum pretty_env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"
"checksum proc-macro-error 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8a857f7c61b149c868eb7e40311b48502fcc924744fb73191962748643336568" "checksum proc-macro-error 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678"
"checksum proc-macro-error-attr 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "075d00534b62f176b55a48b68319be2f3fc05616d68ecd2bcb66bac0a49170e1" "checksum proc-macro-error-attr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101"
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca"
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" "checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
"checksum regex-syntax 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7246cd0a0a6ec2239a5405b2b16e3f404fa0dcc6d28f5f5b877bf80e33e0f294" "checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" "checksum serde 1.0.110 (registry+https://github.com/rust-lang/crates.io-index)" = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c"
"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" "checksum serde_derive 1.0.110 (registry+https://github.com/rust-lang/crates.io-index)" = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum structopt 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe43617218c0805c6eb37160119dc3c548110a67786da7218d1c6555212f073" "checksum structopt 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "863246aaf5ddd0d6928dfeb1a9ca65f505599e4e1b399935ef7e75107516b4ef"
"checksum structopt-derive 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c6e79c80e0f4efd86ca960218d4e056249be189ff1c42824dcd9a7f51a56f0bd" "checksum structopt-derive 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d239ca4b13aee7a2142e6795cbd69e457665ff8037aed33b3effdc430d2f927a"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum syn 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e33a62f20d3dc02a1bc9c1d385f92b459bbf35e4dc325eed20c53db5b90c03"
"checksum syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
"checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" "checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" "checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" "checksum terminal_size 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8038f95fc7a6f351163f4b964af631bd26c9e828f7db085f2a84aca56f70d13b"
"checksum termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
"checksum toml 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54ae44b0b2c443e7ef6dd3be16a776bae4daa40684f81e15126bc04e7747308" "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum which 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5475d47078209a02e60614f7ba5e645ef3ed60f771920ac1906d7c1cc65024c8" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum which 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"

View File

@ -5,16 +5,16 @@ authors = ["Roey Darwish Dror"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
which = "3.1.0" which = "3"
failure = "0.1.5" log = "0.4"
log = "0.4.6" structopt = "0.3"
structopt = "0.3.11" tempfile = "3"
tempfile = "3.0.5" serde = { version = "1", features = ["derive"] }
serde = { version = "1.0.92", features = ["derive"] } toml = "0.5"
toml = "0.5.1" byte-unit = "3"
byte-unit = "3.0.1" nix = "0.17"
nix = "0.17.0" env_logger = "0.7"
env_logger = "0.6.2" pretty_env_logger = "0.4"
pretty_env_logger = "0.4.0" dialoguer = "0.6"
dialoguer = "0.5.0" console = "0.11"
console = "0.9.2" anyhow = "1"

View File

@ -1,4 +1,4 @@
use crate::error::ErrorKind; use anyhow::anyhow;
use std::str::FromStr; use std::str::FromStr;
pub struct AurHelper { pub struct AurHelper {
@ -7,9 +7,9 @@ pub struct AurHelper {
} }
impl FromStr for AurHelper { impl FromStr for AurHelper {
type Err = ErrorKind; type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> anyhow::Result<Self> {
match s { match s {
"yay" => Ok(AurHelper { "yay" => Ok(AurHelper {
name: String::from("yay"), name: String::from("yay"),
@ -32,7 +32,7 @@ impl FromStr for AurHelper {
String::from("--noconfirm"), String::from("--noconfirm"),
], ],
}), }),
_ => Err(ErrorKind::AurHelper {}), _ => Err(anyhow!("Error parsing AUR helper string: {}", s)),
} }
} }
} }

View File

@ -1,133 +0,0 @@
use failure::{Backtrace, Context, Fail};
use std::fmt::{self, Display};
#[derive(Debug)]
pub struct Error {
inner: Context<ErrorKind>,
}
#[derive(Clone, Eq, PartialEq, Debug, Fail)]
pub enum ErrorKind {
#[fail(display = "Error quering information about the block device")]
DeviceQuery,
#[fail(display = "Invalid device name")]
InvalidDeviceName,
#[fail(display = "The given block device is neither removable nor a loop device")]
DangerousDevice,
#[fail(display = "Partition {} does not exist", _0)]
NoSuchPartition(u8),
#[fail(display = "Could not find {}", _0)]
NoTool(&'static str),
#[fail(display = "Error creating a temporary directory")]
TmpDirError,
#[fail(display = "Partitioning error")]
Partitioning,
#[fail(display = "Error formatting filesystems")]
Formatting,
#[fail(display = "Error mounting filesystems")]
Mounting,
#[fail(display = "Error creating the boot directory")]
CreateBoot,
#[fail(display = "Pacstrap error")]
Pacstrap,
#[fail(display = "fstab error")]
Fstab,
#[fail(display = "Post installation configuration error")]
PostInstallation,
#[fail(display = "Initramfs error")]
Initramfs,
#[fail(display = "Bootloader error")]
Bootloader,
#[fail(display = "Error caused by the interactive mode")]
Interactive,
#[fail(display = "Failed umounting filesystems")]
UmountFailure,
#[fail(display = "Error setting up an encrypted device")]
LuksSetup,
#[fail(display = "Error opening the encrypted device")]
LuksOpen,
#[fail(display = "Error closing the encrypted device")]
LuksClose,
#[fail(display = "Error detecting whether the root partition is an encrypted device")]
LuksDetection,
#[fail(display = "Error setting the locale")]
Locale,
#[fail(display = "Failed launching Qemu")]
Qemu,
#[fail(display = "Error loading preset \"{}\"", _0)]
Preset(String),
#[fail(display = "Missing environment variables \"{:?}\"", _0)]
MissingEnvironmentVariables(Vec<String>),
#[fail(display = "Error executing preset script")]
PresetScript,
#[fail(display = "Error parsing AUR helper string")]
AurHelper,
#[fail(display = "Error creating the image")]
Image,
#[fail(display = "Error setting up a loop device: {}", _0)]
Losetup(String),
#[fail(display = "Error querying storage devices")]
StorageDevicesQuery,
#[fail(display = "There are no removable devices")]
NoRemovableDevices,
}
impl Fail for Error {
fn cause(&self) -> Option<&dyn Fail> {
self.inner.cause()
}
fn backtrace(&self) -> Option<&Backtrace> {
self.inner.backtrace()
}
}
impl Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Display::fmt(&self.inner, f)
}
}
impl From<ErrorKind> for Error {
fn from(kind: ErrorKind) -> Error {
Error {
inner: Context::new(kind),
}
}
}
impl From<Context<ErrorKind>> for Error {
fn from(inner: Context<ErrorKind>) -> Error {
Error { inner }
}
}

View File

@ -9,7 +9,7 @@ impl Initcpio {
Self { encrypted } Self { encrypted }
} }
pub fn to_config(&self) -> String { pub fn to_config(&self) -> anyhow::Result<String> {
let mut output = String::from( let mut output = String::from(
"MODULES=() "MODULES=()
BINARIES=() BINARIES=()
@ -18,11 +18,11 @@ HOOKS=(base udev keyboard consolefont block ",
); );
if self.encrypted { if self.encrypted {
output.write_str("encrypt ").unwrap(); output.write_str("encrypt ")?;
} }
output.write_str("filesystems keyboard fsck)\n").unwrap(); output.write_str("filesystems keyboard fsck)\n")?;
output Ok(output)
} }
} }

View File

@ -1,20 +1,17 @@
mod args; mod args;
mod aur; mod aur;
mod constants; mod constants;
mod error;
mod initcpio; mod initcpio;
mod presets; mod presets;
mod process; mod process;
mod storage; mod storage;
mod tool; mod tool;
use anyhow::{anyhow, Context};
use args::Command; use args::Command;
use byte_unit::Byte; use byte_unit::Byte;
use console::style; use console::style;
use dialoguer::{theme::ColorfulTheme, Select}; use dialoguer::{theme::ColorfulTheme, Select};
use error::Error;
use error::ErrorKind;
use failure::{Fail, ResultExt};
use log::{debug, error, info, log_enabled, Level, LevelFilter}; use log::{debug, error, info, log_enabled, Level, LevelFilter};
use process::CommandExt; use process::CommandExt;
use std::collections::HashSet; use std::collections::HashSet;
@ -22,7 +19,7 @@ use std::fs;
use std::io::Write; use std::io::Write;
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::{exit, Command as ProcessCommand}; use std::process::Command as ProcessCommand;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use storage::EncryptedDevice; use storage::EncryptedDevice;
@ -31,7 +28,7 @@ use structopt::StructOpt;
use tempfile::tempdir; use tempfile::tempdir;
use tool::Tool; use tool::Tool;
fn main() { fn main() -> anyhow::Result<()> {
// Get struct of args using structopt // Get struct of args using structopt
let app = args::App::from_args(); let app = args::App::from_args();
@ -46,26 +43,13 @@ fn main() {
builder.init(); builder.init();
// Match command from arguments and run relevant code // Match command from arguments and run relevant code
let result = match app.cmd { match app.cmd {
Command::Create(command) => create(command), Command::Create(command) => create(command),
Command::Chroot(command) => tool::chroot(command), Command::Chroot(command) => tool::chroot(command),
Command::Qemu(command) => tool::qemu(command), Command::Qemu(command) => tool::qemu(command),
}; }?;
// Check if command return an Error Ok(())
// Print all causes to stderr if so
match result {
Ok(()) => {
exit(0);
}
Err(error) => {
error!("{}", error);
for cause in (&error as &dyn Fail).iter_causes() {
error!("Caused by: {}", cause);
}
exit(1);
}
}
} }
/// Remove swap entry from fstab and any commented lines /// Remove swap entry from fstab and any commented lines
@ -82,7 +66,7 @@ fn fix_fstab(fstab: &str) -> String {
} }
/// Creates a file at the path provided, and mounts it to a loop device /// Creates a file at the path provided, and mounts it to a loop device
fn create_image(path: &Path, size: Byte, overwrite: bool) -> Result<LoopDevice, Error> { fn create_image(path: &Path, size: Byte, overwrite: bool) -> anyhow::Result<LoopDevice> {
{ {
let mut options = fs::OpenOptions::new(); let mut options = fs::OpenOptions::new();
@ -92,21 +76,21 @@ fn create_image(path: &Path, size: Byte, overwrite: bool) -> Result<LoopDevice,
} else { } else {
options.create_new(true); options.create_new(true);
} }
let file = options.open(path).context(ErrorKind::Image)?; let file = options.open(path).context("Error creating the image")?;
file.set_len(size.get_bytes() as u64) file.set_len(size.get_bytes() as u64)
.context(ErrorKind::Image)?; .context("Error creating the image")?;
} }
LoopDevice::create(path) LoopDevice::create(path)
} }
/// Requests selection of block device (no device was given in the arguments) /// Requests selection of block device (no device was given in the arguments)
fn select_block_device(allow_non_removable: bool) -> Result<PathBuf, Error> { fn select_block_device(allow_non_removable: bool) -> anyhow::Result<PathBuf> {
let devices = storage::get_storage_devices(allow_non_removable)?; let devices = storage::get_storage_devices(allow_non_removable)?;
if devices.is_empty() { if devices.is_empty() {
return Err(ErrorKind::NoRemovableDevices.into()); return Err(anyhow!("There are no removable devices"));
} }
if allow_non_removable { if allow_non_removable {
@ -122,15 +106,14 @@ fn select_block_device(allow_non_removable: bool) -> Result<PathBuf, Error> {
.with_prompt("Select a removable device") .with_prompt("Select a removable device")
.default(0) .default(0)
.items(&devices) .items(&devices)
.interact() .interact()?;
.unwrap();
Ok(PathBuf::from("/dev").join(&devices[selection].name)) Ok(PathBuf::from("/dev").join(&devices[selection].name))
} }
/// Creates the installation /// Creates the installation
#[allow(clippy::cognitive_complexity)] // TODO: Split steps into functions and remove this #[allow(clippy::cognitive_complexity)] // TODO: Split steps into functions and remove this
fn create(command: args::CreateCommand) -> Result<(), Error> { fn create(command: args::CreateCommand) -> anyhow::Result<()> {
let presets = presets::PresetsCollection::load(&command.presets)?; let presets = presets::PresetsCollection::load(&command.presets)?;
let sgdisk = Tool::find("sgdisk")?; let sgdisk = Tool::find("sgdisk")?;
@ -173,7 +156,7 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
command.allow_non_removable, command.allow_non_removable,
)?; )?;
let mount_point = tempdir().context(ErrorKind::TmpDirError)?; let mount_point = tempdir().context("Error creating a temporary directory")?;
let disk_path = storage_device.path(); let disk_path = storage_device.path();
info!("Partitioning the block device"); info!("Partitioning the block device");
@ -191,7 +174,8 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
"--typecode=2:EF02", "--typecode=2:EF02",
]) ])
.arg(&disk_path) .arg(&disk_path)
.run(ErrorKind::Partitioning)?; .run()
.context("Partitioning error")?;
thread::sleep(Duration::from_millis(1000)); thread::sleep(Duration::from_millis(1000));
@ -252,23 +236,26 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
.arg(mount_point.path()) .arg(mount_point.path())
.args(packages) .args(packages)
.args(&command.extra_packages) .args(&command.extra_packages)
.run(ErrorKind::Pacstrap)?; .run()
.context("Pacstrap error")?;
let fstab = fix_fstab( let fstab = fix_fstab(
&genfstab &genfstab
.execute() .execute()
.arg("-U") .arg("-U")
.arg(mount_point.path()) .arg(mount_point.path())
.run_text_output(ErrorKind::Fstab)?, .run_text_output()
.context("fstab error")?,
); );
debug!("fstab:\n{}", fstab); debug!("fstab:\n{}", fstab);
fs::write(mount_point.path().join("etc/fstab"), fstab).context(ErrorKind::Fstab)?; fs::write(mount_point.path().join("etc/fstab"), fstab).context("fstab error")?;
if presets.aur_packages.len() > 0 { if presets.aur_packages.len() > 0 {
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.args(&["useradd", "-m", "aur"]) .args(&["useradd", "-m", "aur"])
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to create temporary user to install AUR packages")?;
arch_chroot arch_chroot
.execute() .execute()
@ -279,7 +266,8 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
"s/# %wheel ALL=(ALL) NOPASSWD: ALL/aur ALL=(ALL) NOPASSWD: ALL/g", "s/# %wheel ALL=(ALL) NOPASSWD: ALL/aur ALL=(ALL) NOPASSWD: ALL/g",
]) ])
.arg("/etc/sudoers") .arg("/etc/sudoers")
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to modify sudoers file for AUR packages")?;
arch_chroot arch_chroot
.execute() .execute()
@ -292,7 +280,8 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
&command.aur_helper.name &command.aur_helper.name
)) ))
.arg(format!("/home/aur/{}", &command.aur_helper.name)) .arg(format!("/home/aur/{}", &command.aur_helper.name))
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to clone AUR helper package")?;
arch_chroot arch_chroot
.execute() .execute()
@ -305,7 +294,8 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
&command.aur_helper.name &command.aur_helper.name
), ),
]) ])
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to build AUR helper")?;
arch_chroot arch_chroot
.execute() .execute()
@ -314,14 +304,16 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
.args(&command.aur_helper.install_command) .args(&command.aur_helper.install_command)
.args(presets.aur_packages) .args(presets.aur_packages)
.args(&command.aur_packages) .args(&command.aur_packages)
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to install AUR packages")?;
// Clean up aur user: // Clean up aur user:
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.args(&["userdel", "-r", "aur"]) .args(&["userdel", "-r", "aur"])
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to delete temporary aur user")?;
arch_chroot arch_chroot
.execute() .execute()
@ -332,7 +324,8 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
"s/aur ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/g", "s/aur ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/g",
]) ])
.arg("/etc/sudoers") .arg("/etc/sudoers")
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to undo sudoers changes")?;
} }
if !presets.scripts.is_empty() { if !presets.scripts.is_empty() {
info!("Running custom scripts"); info!("Running custom scripts");
@ -347,23 +340,23 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
mount_point mount_point
.path() .path()
.join(PathBuf::from("shared_dirs/")) .join(PathBuf::from("shared_dirs/"))
.join(dir.file_name().unwrap()), .join(dir.file_name().expect("Dir had no filename")),
) )
.context(ErrorKind::PresetScript)?; .context("Failed mounting shared directories in preset")?;
// Bind mount shared directories // Bind mount shared directories
let target = mount_point let target = mount_point
.path() .path()
.join(PathBuf::from("shared_dirs/")) .join(PathBuf::from("shared_dirs/"))
.join(dir.file_name().unwrap()); .join(dir.file_name().expect("Dir had no filename"));
bind_mount_stack bind_mount_stack
.bind_mount(dir.clone(), target, None) .bind_mount(dir.clone(), target, None)
.context(ErrorKind::Mounting)?; .context("Failed mounting shared directories in preset")?;
} }
} }
let mut script_file = let mut script_file = tempfile::NamedTempFile::new_in(mount_point.path())
tempfile::NamedTempFile::new_in(mount_point.path()).context(ErrorKind::PresetScript)?; .context("Failed creating temporary preset script")?;
script_file script_file
.write_all(script.script_text.as_bytes()) .write_all(script.script_text.as_bytes())
.and_then(|_| script_file.as_file_mut().metadata()) .and_then(|_| script_file.as_file_mut().metadata())
@ -372,14 +365,21 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
permissions.set_mode(0o755); permissions.set_mode(0o755);
fs::set_permissions(script_file.path(), permissions) fs::set_permissions(script_file.path(), permissions)
}) })
.context(ErrorKind::PresetScript)?; .context("Failed creating temporary preset script")?;
let script_path = script_file.into_temp_path(); let script_path = script_file.into_temp_path();
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.arg(Path::new("/").join(script_path.file_name().unwrap())) .arg(
.run(ErrorKind::PostInstallation)?; Path::new("/").join(
script_path
.file_name()
.expect("Script path had no file name"),
),
)
.run()
.context("Failed running preset script")?;
} }
info!("Performing post installation tasks"); info!("Performing post installation tasks");
@ -388,14 +388,15 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.args(&["systemctl", "enable", "NetworkManager"]) .args(&["systemctl", "enable", "NetworkManager"])
.run(ErrorKind::PostInstallation)?; .run()
.context("Failed to enable NetworkManager")?;
info!("Configuring journald"); info!("Configuring journald");
fs::write( fs::write(
mount_point.path().join("etc/systemd/journald.conf"), mount_point.path().join("etc/systemd/journald.conf"),
constants::JOURNALD_CONF, constants::JOURNALD_CONF,
) )
.context(ErrorKind::PostInstallation)?; .context("Failed to write to journald.conf")?;
info!("Setting locale"); info!("Setting locale");
fs::OpenOptions::new() fs::OpenOptions::new()
@ -403,53 +404,56 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
.write(true) .write(true)
.open(mount_point.path().join("etc/locale.gen")) .open(mount_point.path().join("etc/locale.gen"))
.and_then(|mut locale_gen| locale_gen.write_all(b"en_US.UTF-8 UTF-8\n")) .and_then(|mut locale_gen| locale_gen.write_all(b"en_US.UTF-8 UTF-8\n"))
.context(ErrorKind::Locale)?; .context("Failed to create locale.gen")?;
fs::write( fs::write(
mount_point.path().join("etc/locale.conf"), mount_point.path().join("etc/locale.conf"),
"LANG=en_US.UTF-8", "LANG=en_US.UTF-8",
) )
.context(ErrorKind::Locale)?; .context("Failed to write to locale.conf")?;
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.arg("locale-gen") .arg("locale-gen")
.run(ErrorKind::Locale)?; .run()
.context("locale-gen failed")?;
info!("Generating initramfs"); info!("Generating initramfs");
fs::write( fs::write(
mount_point.path().join("etc/mkinitcpio.conf"), mount_point.path().join("etc/mkinitcpio.conf"),
initcpio::Initcpio::new(encrypted_root.is_some()).to_config(), initcpio::Initcpio::new(encrypted_root.is_some()).to_config()?,
) )
.context(ErrorKind::Initramfs)?; .context("Failed to write to mkinitcpio.conf")?;
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.args(&["mkinitcpio", "-p", "linux"]) .args(&["mkinitcpio", "-p", "linux"])
.run(ErrorKind::Initramfs)?; .run()
.context("Failed to run mkinitcpio - do you have the base and linux packages installed?")?;
if encrypted_root.is_some() { if encrypted_root.is_some() {
debug!("Setting up GRUB for an encrypted root partition"); debug!("Setting up GRUB for an encrypted root partition");
let uuid = blkid let uuid = blkid
.unwrap() .expect("No tool for blkid")
.execute() .execute()
.arg(root_partition_base.path()) .arg(root_partition_base.path())
.args(&["-o", "value", "-s", "UUID"]) .args(&["-o", "value", "-s", "UUID"])
.run_text_output(ErrorKind::Partitioning)?; .run_text_output()
.context("Failed to run blkid")?;
let trimmed = uuid.trim(); let trimmed = uuid.trim();
debug!("Root partition UUID: {}", trimmed); debug!("Root partition UUID: {}", trimmed);
let mut grub_file = fs::OpenOptions::new() let mut grub_file = fs::OpenOptions::new()
.append(true) .append(true)
.open(mount_point.path().join("etc/default/grub")) .open(mount_point.path().join("etc/default/grub"))
.context(ErrorKind::Bootloader)?; .context("Failed to create /etc/default/grub")?;
write!( write!(
&mut grub_file, &mut grub_file,
"GRUB_CMDLINE_LINUX=\"cryptdevice=UUID={}:luks_root\"", "GRUB_CMDLINE_LINUX=\"cryptdevice=UUID={}:luks_root\"",
trimmed trimmed
) )
.context(ErrorKind::Bootloader)?; .context("Failed to write to /etc/default/grub")?;
} }
info!("Installing the Bootloader"); info!("Installing the Bootloader");
@ -458,7 +462,7 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
.arg(mount_point.path()) .arg(mount_point.path())
.args(&["bash", "-c"]) .args(&["bash", "-c"])
.arg(format!("grub-install --target=i386-pc --boot-directory /boot {} && grub-install --target=x86_64-efi --efi-directory /boot --boot-directory /boot --removable && grub-mkconfig -o /boot/grub/grub.cfg", disk_path.display())) .arg(format!("grub-install --target=i386-pc --boot-directory /boot {} && grub-install --target=x86_64-efi --efi-directory /boot --boot-directory /boot --removable && grub-mkconfig -o /boot/grub/grub.cfg", disk_path.display()))
.run(ErrorKind::Bootloader)?; .run().context("Failed to install grub")?;
debug!( debug!(
"GRUB configuration: {}", "GRUB configuration: {}",
@ -471,7 +475,8 @@ fn create(command: args::CreateCommand) -> Result<(), Error> {
arch_chroot arch_chroot
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.run(ErrorKind::Interactive)?; .run()
.context("Failed to enter interactive chroot")?;
} }
info!("Unmounting filesystems"); info!("Unmounting filesystems");

View File

@ -1,5 +1,4 @@
use crate::error::{Error, ErrorKind}; use anyhow::{anyhow, Context};
use failure::ResultExt;
use serde::Deserialize; use serde::Deserialize;
use std::collections::HashSet; use std::collections::HashSet;
use std::env; use std::env;
@ -34,11 +33,9 @@ fn visit_dirs(dir: &Path, filevec: &mut Vec<PathBuf>) -> Result<(), io::Error> {
} }
impl Preset { impl Preset {
fn load(path: &Path) -> Result<Self, Error> { fn load(path: &Path) -> anyhow::Result<Self> {
let data = fs::read_to_string(path) let data = fs::read_to_string(path).with_context(|| format!("{}", path.display()))?;
.with_context(|_| ErrorKind::Preset(format!("{}", path.display())))?; Ok(toml::from_str(&data).with_context(|| format!("{}", path.display()))?)
Ok(toml::from_str(&data)
.with_context(|_| ErrorKind::Preset(format!("{}", path.display())))?)
} }
fn process( fn process(
@ -48,7 +45,7 @@ impl Preset {
environment_variables: &mut HashSet<String>, environment_variables: &mut HashSet<String>,
path: &PathBuf, path: &PathBuf,
aur_packages: &mut HashSet<String>, aur_packages: &mut HashSet<String>,
) -> Result<(), ErrorKind> { ) -> anyhow::Result<()> {
if let Some(preset_packages) = &self.packages { if let Some(preset_packages) = &self.packages {
packages.extend(preset_packages.clone()); packages.extend(preset_packages.clone());
} }
@ -73,18 +70,18 @@ impl Preset {
x.iter() x.iter()
.cloned() .cloned()
.map(|y| { .map(|y| {
let full_path = path.parent().unwrap().join(&y); let full_path = path.parent().expect("Path has no parent").join(&y);
if full_path.is_dir() { if full_path.is_dir() {
Ok(full_path) Ok(full_path)
} else { } else {
Err(ErrorKind::Preset(format!( Err(anyhow!(
"Preset: {} - shared directory: {} is not directory", "Preset: {} - shared directory: {} is not directory",
path.display(), path.display(),
y.display() y.display()
))) ))
} }
}) })
.collect::<Result<Vec<_>, ErrorKind>>() .collect::<anyhow::Result<Vec<_>>>()
}) })
.map_or(Ok(None), |r| r.map(Some))?, .map_or(Ok(None), |r| r.map(Some))?,
}); });
@ -105,7 +102,7 @@ pub struct PresetsCollection {
} }
impl PresetsCollection { impl PresetsCollection {
pub fn load(list: &[PathBuf]) -> Result<Self, Error> { pub fn load(list: &[PathBuf]) -> anyhow::Result<Self> {
let mut packages = HashSet::new(); let mut packages = HashSet::new();
let mut aur_packages = HashSet::new(); let mut aur_packages = HashSet::new();
let mut scripts: Vec<Script> = Vec::new(); let mut scripts: Vec<Script> = Vec::new();
@ -117,7 +114,7 @@ impl PresetsCollection {
// Recursively load directories of preset files // Recursively load directories of preset files
let mut dir_paths: Vec<PathBuf> = Vec::new(); let mut dir_paths: Vec<PathBuf> = Vec::new();
visit_dirs(&preset, &mut dir_paths) visit_dirs(&preset, &mut dir_paths)
.with_context(|_| ErrorKind::Preset(format!("{}", preset.display())))?; .with_context(|| format!("{}", preset.display()))?;
// Order not guaranteed so we sort // Order not guaranteed so we sort
// In the future may want to support numerical sort i.e. 15_... < 100_... // In the future may want to support numerical sort i.e. 15_... < 100_...
@ -148,7 +145,10 @@ impl PresetsCollection {
.collect(); .collect();
if !missing_envrionments.is_empty() { if !missing_envrionments.is_empty() {
return Err(ErrorKind::MissingEnvironmentVariables(missing_envrionments).into()); return Err(anyhow!(
"Missing environment variables {:?}",
missing_envrionments
));
} }
Ok(Self { Ok(Self {

View File

@ -1,51 +1,35 @@
use super::error::{Error, ErrorKind}; use anyhow::anyhow;
use failure::{Fail, ResultExt};
use log::error; use log::error;
use std::process::{Command, ExitStatus}; use std::process::Command;
use std::str; use std::str;
#[derive(Debug, Fail)]
enum ProcessError {
#[fail(display = "{}", _0)]
BadExitCode(ExitStatus),
#[fail(display = "Process output isn't valid UTF-8")]
InvalidUtf8,
}
pub trait CommandExt { pub trait CommandExt {
fn run(&mut self, context: ErrorKind) -> Result<(), Error>; fn run(&mut self) -> anyhow::Result<()>;
fn run_text_output(&mut self, context: ErrorKind) -> Result<String, Error>; fn run_text_output(&mut self) -> anyhow::Result<String>;
} }
impl CommandExt for Command { impl CommandExt for Command {
fn run(&mut self, context: ErrorKind) -> Result<(), Error> { fn run(&mut self) -> anyhow::Result<()> {
let exit_status = self let exit_status = self.spawn()?.wait()?;
.spawn()
.with_context(|_| context.clone())?
.wait()
.with_context(|_| context.clone())?;
if !exit_status.success() { if !exit_status.success() {
Err(ProcessError::BadExitCode(exit_status)).with_context(|_| context.clone())?; Err(anyhow!("Bad exit code: {}", exit_status))?;
} }
Ok(()) Ok(())
} }
fn run_text_output(&mut self, context: ErrorKind) -> Result<String, Error> { fn run_text_output(&mut self) -> anyhow::Result<String> {
let output = self.output().with_context(|_| context.clone())?; let output = self.output()?;
if !output.status.success() { if !output.status.success() {
let error = str::from_utf8(&output.stderr).unwrap_or("[INVALID UTF8]"); let error = str::from_utf8(&output.stderr).unwrap_or("[INVALID UTF8]");
error!("{}", error); error!("{}", error);
Err(ProcessError::BadExitCode(output.status)).with_context(|_| context.clone())?; Err(anyhow!("Bad exit code: {}", output.status))?;
} }
Ok(String::from( Ok(String::from(str::from_utf8(&output.stdout).map_err(
str::from_utf8(&output.stdout) |_| anyhow!("Process output is not valid UTF-8"),
.map_err(|_| ProcessError::InvalidUtf8) )?))
.with_context(|_| context.clone())?,
))
} }
} }

View File

@ -1,8 +1,7 @@
use super::markers::BlockDevice; use super::markers::BlockDevice;
use crate::error::{Error, ErrorKind};
use crate::process::CommandExt; use crate::process::CommandExt;
use crate::tool::Tool; use crate::tool::Tool;
use failure::ResultExt; use anyhow::Context;
use log::{debug, warn}; use log::{debug, warn};
use std::fs; use std::fs;
use std::io::Read; use std::io::Read;
@ -21,14 +20,15 @@ pub struct EncryptedDevice<'t, 'o> {
} }
impl<'t, 'o> EncryptedDevice<'t, 'o> { impl<'t, 'o> EncryptedDevice<'t, 'o> {
pub fn prepare(cryptsetup: &Tool, device: &dyn BlockDevice) -> Result<(), Error> { pub fn prepare(cryptsetup: &Tool, device: &dyn BlockDevice) -> anyhow::Result<()> {
debug!("Preparing encrypted device in {}", device.path().display()); debug!("Preparing encrypted device in {}", device.path().display());
cryptsetup cryptsetup
.execute() .execute()
.arg("luksFormat") .arg("luksFormat")
.arg("-q") .arg("-q")
.arg(device.path()) .arg(device.path())
.run(ErrorKind::LuksSetup)?; .run()
.context("Error setting up an encrypted device")?;
Ok(()) Ok(())
} }
@ -37,7 +37,7 @@ impl<'t, 'o> EncryptedDevice<'t, 'o> {
cryptsetup: &'t Tool, cryptsetup: &'t Tool,
device: &'o dyn BlockDevice, device: &'o dyn BlockDevice,
name: String, name: String,
) -> Result<EncryptedDevice<'t, 'o>, Error> { ) -> anyhow::Result<EncryptedDevice<'t, 'o>> {
debug!( debug!(
"Opening encrypted device {} as {}", "Opening encrypted device {} as {}",
device.path().display(), device.path().display(),
@ -48,7 +48,8 @@ impl<'t, 'o> EncryptedDevice<'t, 'o> {
.arg("open") .arg("open")
.arg(device.path()) .arg(device.path())
.arg(&name) .arg(&name)
.run(ErrorKind::LuksOpen)?; .run()
.context("Error opening the encrypted device")?;
let path = PathBuf::from("/dev/mapper").join(&name); let path = PathBuf::from("/dev/mapper").join(&name);
Ok(Self { Ok(Self {
@ -59,13 +60,14 @@ impl<'t, 'o> EncryptedDevice<'t, 'o> {
}) })
} }
fn _close(&mut self) -> Result<(), Error> { fn _close(&mut self) -> anyhow::Result<()> {
debug!("Closing encrypted device {}", self.name); debug!("Closing encrypted device {}", self.name);
self.cryptsetup self.cryptsetup
.execute() .execute()
.arg("close") .arg("close")
.arg(&self.name) .arg(&self.name)
.run(ErrorKind::LuksClose)?; .run()
.context("Error closing the encrypted device")?;
Ok(()) Ok(())
} }
@ -85,16 +87,16 @@ impl<'t, 'o> BlockDevice for EncryptedDevice<'t, 'o> {
} }
} }
pub fn is_encrypted_device(device: &dyn BlockDevice) -> Result<bool, Error> { pub fn is_encrypted_device(device: &dyn BlockDevice) -> anyhow::Result<bool> {
let mut f = fs::OpenOptions::new() let mut f = fs::OpenOptions::new()
.read(true) .read(true)
.write(false) .write(false)
.open(device.path()) .open(device.path())
.context(ErrorKind::LuksDetection)?; .context("Error detecting whether the root partition is an encrypted device")?;
let mut buffer = [0; 6]; let mut buffer = [0; 6];
f.read_exact(&mut buffer) f.read_exact(&mut buffer)
.context(ErrorKind::LuksDetection)?; .context("Error detecting whether the root partition is an encrypted device")?;
Ok(buffer == LUKS_MAGIC_1 || buffer == LUKS_MAGIC_2) Ok(buffer == LUKS_MAGIC_1 || buffer == LUKS_MAGIC_2)
} }

View File

@ -1,9 +1,6 @@
use super::markers::BlockDevice; use super::markers::BlockDevice;
use crate::{ use crate::{process::CommandExt, tool::Tool};
error::{Error, ErrorKind}, use anyhow::Context;
process::CommandExt,
tool::Tool,
};
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum FilesystemType { pub enum FilesystemType {
@ -31,14 +28,14 @@ impl<'a> Filesystem<'a> {
block: &'a dyn BlockDevice, block: &'a dyn BlockDevice,
fs_type: FilesystemType, fs_type: FilesystemType,
mkfs: &Tool, mkfs: &Tool,
) -> Result<Self, Error> { ) -> anyhow::Result<Self> {
let mut command = mkfs.execute(); let mut command = mkfs.execute();
match fs_type { match fs_type {
FilesystemType::Ext4 => command.arg("-F").arg(block.path()), FilesystemType::Ext4 => command.arg("-F").arg(block.path()),
FilesystemType::Vfat => command.arg("-F32").arg(block.path()), FilesystemType::Vfat => command.arg("-F32").arg(block.path()),
}; };
command.run(ErrorKind::Formatting)?; command.run().context("Error formatting filesystem")?;
Ok(Self { fs_type, block }) Ok(Self { fs_type, block })
} }

View File

@ -1,6 +1,5 @@
use crate::error::{Error, ErrorKind};
use crate::tool::Tool; use crate::tool::Tool;
use failure::ResultExt; use anyhow::{anyhow, Context};
use log::info; use log::info;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -11,20 +10,24 @@ pub struct LoopDevice {
} }
impl LoopDevice { impl LoopDevice {
pub fn create(file: &Path) -> Result<Self, Error> { pub fn create(file: &Path) -> anyhow::Result<Self> {
let losetup = Tool::find("losetup")?; let losetup = Tool::find("losetup")?;
let output = losetup let output = losetup
.execute() .execute()
.args(&["--find", "-P", "--show"]) .args(&["--find", "-P", "--show"])
.arg(file) .arg(file)
.output() .output()
.context(ErrorKind::Image)?; .context("Error creating the image")?;
if !output.status.success() { if !output.status.success() {
return Err(ErrorKind::Losetup(String::from_utf8(output.stderr).unwrap()).into()); return Err(anyhow!(String::from_utf8(output.stderr)?));
} }
let path = PathBuf::from(String::from_utf8(output.stdout).unwrap().trim()); let path = PathBuf::from(
String::from_utf8(output.stdout)
.context("Output not valid UTF-8")?
.trim(),
);
info!("Mounted {} to {}", file.display(), path.display()); info!("Mounted {} to {}", file.display(), path.display());
Ok(LoopDevice { path, losetup }) Ok(LoopDevice { path, losetup })
@ -43,7 +46,7 @@ impl Drop for LoopDevice {
.arg("-d") .arg("-d")
.arg(&self.path) .arg(&self.path)
.spawn() .spawn()
.unwrap() .expect("Failed to spawn command to detach loop device")
.wait() .wait()
.ok(); .ok();
} }

View File

@ -1,6 +1,5 @@
use super::Filesystem; use super::Filesystem;
use crate::error::{Error, ErrorKind}; use anyhow::anyhow;
use failure::Fail;
use log::{debug, warn}; use log::{debug, warn};
use nix::mount::{mount, umount, MsFlags}; use nix::mount::{mount, umount, MsFlags};
use std::marker::PhantomData; use std::marker::PhantomData;
@ -56,21 +55,25 @@ impl<'a> MountStack<'a> {
Ok(()) Ok(())
} }
fn _umount(&mut self) -> Result<(), Error> { fn _umount(&mut self) -> anyhow::Result<()> {
let mut result = Ok(()); let mut result = Ok(());
while let Some(target) = self.targets.pop() { while let Some(target) = self.targets.pop() {
debug!("Unmounting {}", target.display()); debug!("Unmounting {}", target.display());
if let Err(e) = umount(&target) { if let Err(e) = umount(&target) {
warn!("Unable to umount {}: {}", target.display(), e); warn!("Unable to umount {}: {}", target.display(), e);
result = Err(Error::from(e.context(ErrorKind::UmountFailure))); result = Err(anyhow!(
"Failed unmounting filesystem: {}, {}",
target.display(),
e
));
}; };
} }
result result
} }
pub fn umount(mut self) -> Result<(), Error> { pub fn umount(mut self) -> anyhow::Result<()> {
self._umount() self._umount()
} }
} }

View File

@ -1,6 +1,5 @@
use crate::error::{Error, ErrorKind}; use anyhow::Context;
use byte_unit::Byte; use byte_unit::Byte;
use failure::ResultExt;
use std::{fmt, fs}; use std::{fmt, fs};
#[derive(Debug)] #[derive(Debug)]
@ -27,16 +26,16 @@ fn trimmed(source: String) -> String {
String::from(source.trim_end()) String::from(source.trim_end())
} }
pub fn get_storage_devices(allow_non_removable: bool) -> Result<Vec<Device>, Error> { pub fn get_storage_devices(allow_non_removable: bool) -> anyhow::Result<Vec<Device>> {
let mut result = Vec::new(); let mut result = Vec::new();
for entry in fs::read_dir("/sys/block").context(ErrorKind::StorageDevicesQuery)? { for entry in fs::read_dir("/sys/block").context("Error querying storage devices")? {
let entry = entry.context(ErrorKind::StorageDevicesQuery)?; let entry = entry.context("Error querying storage devices")?;
let removable = allow_non_removable let removable = allow_non_removable
|| fs::read_to_string(entry.path().join("removable")) || fs::read_to_string(entry.path().join("removable"))
.map(|v| v == "1\n") .map(|v| v == "1\n")
.context(ErrorKind::StorageDevicesQuery)?; .context("Error querying storage devices")?;
if !removable { if !removable {
continue; continue;
@ -44,7 +43,7 @@ pub fn get_storage_devices(allow_non_removable: bool) -> Result<Vec<Device>, Err
let model = fs::read_to_string(entry.path().join("device/model")) let model = fs::read_to_string(entry.path().join("device/model"))
.map(trimmed) .map(trimmed)
.context(ErrorKind::StorageDevicesQuery)?; .context("Error querying storage devices")?;
if model == "CD-ROM" { if model == "CD-ROM" {
continue; continue;
@ -54,19 +53,19 @@ pub fn get_storage_devices(allow_non_removable: bool) -> Result<Vec<Device>, Err
name: entry name: entry
.path() .path()
.file_name() .file_name()
.unwrap() .expect("Could not get file name for dir entry /sys/block")
.to_string_lossy() .to_string_lossy()
.into_owned(), .into_owned(),
model, model,
vendor: fs::read_to_string(entry.path().join("device/vendor")) vendor: fs::read_to_string(entry.path().join("device/vendor"))
.map(trimmed) .map(trimmed)
.context(ErrorKind::StorageDevicesQuery)?, .context("Error querying storage devices")?,
size: Byte::from_bytes( size: Byte::from_bytes(
fs::read_to_string(entry.path().join("size")) fs::read_to_string(entry.path().join("size"))
.context(ErrorKind::StorageDevicesQuery)? .context("Error querying storage devices")?
.trim() .trim()
.parse::<u128>() .parse::<u128>()
.unwrap() .context("Could not parse block size to unsigned integer (u128)")?
* 512, * 512,
), ),
}) })
@ -81,7 +80,7 @@ mod tests {
#[test] #[test]
fn sanity() { fn sanity() {
let devices = get_storage_devices(false).unwrap(); let devices = get_storage_devices(false).expect("No devices");
println!("{:?}", devices); println!("{:?}", devices);
} }
} }

View File

@ -1,7 +1,6 @@
use super::markers::{BlockDevice, Origin}; use super::markers::{BlockDevice, Origin};
use super::partition::Partition; use super::partition::Partition;
use crate::error::{Error, ErrorKind}; use anyhow::{anyhow, Context};
use failure::ResultExt;
use log::debug; use log::debug;
use std::fs::read_to_string; use std::fs::read_to_string;
use std::marker::PhantomData; use std::marker::PhantomData;
@ -15,14 +14,16 @@ pub struct StorageDevice<'a> {
} }
impl<'a> StorageDevice<'a> { impl<'a> StorageDevice<'a> {
pub fn from_path(path: &'a Path, allow_non_removable: bool) -> Result<Self, Error> { pub fn from_path(path: &'a Path, allow_non_removable: bool) -> anyhow::Result<Self> {
debug!("path: {:?}", path); debug!("path: {:?}", path);
let path = path.canonicalize().context(ErrorKind::DeviceQuery)?; let path = path
.canonicalize()
.context("Error querying information about the block device")?;
let device_name = path let device_name = path
.file_name() .file_name()
.and_then(|s| s.to_str()) .and_then(|s| s.to_str())
.map(String::from) .map(String::from)
.ok_or_else(|| Error::from(ErrorKind::InvalidDeviceName))?; .ok_or_else(|| anyhow!("Invalid device name: {}", path.display()))?;
debug!("real path: {:?}, device name: {:?}", path, device_name); debug!("real path: {:?}, device name: {:?}", path, device_name);
@ -35,7 +36,10 @@ impl<'a> StorageDevice<'a> {
// If we only allow removable/loop devices, and the device is neither removable or a loop // If we only allow removable/loop devices, and the device is neither removable or a loop
// device then throw a DangerousDevice error // device then throw a DangerousDevice error
if !(allow_non_removable || _self.is_removable_device()? || _self.is_loop_device()) { if !(allow_non_removable || _self.is_removable_device()? || _self.is_loop_device()) {
return Err(ErrorKind::DangerousDevice.into()); return Err(anyhow!(
"The given block device is neither removable nor a loop device: {}",
_self.name
));
} }
Ok(_self) Ok(_self)
@ -47,12 +51,13 @@ impl<'a> StorageDevice<'a> {
path path
} }
fn is_removable_device(&self) -> Result<bool, Error> { fn is_removable_device(&self) -> anyhow::Result<bool> {
let mut path = self.sys_path(); let mut path = self.sys_path();
path.push("removable"); path.push("removable");
debug!("Reading: {:?}", path); debug!("Reading: {:?}", path);
let result = read_to_string(&path).context(ErrorKind::DeviceQuery)?; let result =
read_to_string(&path).context("Error querying information about the block device")?;
debug!("{:?} -> {}", path, result); debug!("{:?} -> {}", path, result);
Ok(result == "1\n") Ok(result == "1\n")
@ -64,8 +69,15 @@ impl<'a> StorageDevice<'a> {
path.exists() path.exists()
} }
pub fn get_partition(&self, index: u8) -> Result<Partition, Error> { pub fn get_partition(&self, index: u8) -> anyhow::Result<Partition> {
let name = if self.name.chars().rev().next().unwrap().is_digit(10) { let name = if self
.name
.chars()
.rev()
.next()
.expect("Storage device name is empty")
.is_digit(10)
{
format!("{}p{}", self.name, index) format!("{}p{}", self.name, index)
} else { } else {
format!("{}{}", self.name, index) format!("{}{}", self.name, index)
@ -75,7 +87,7 @@ impl<'a> StorageDevice<'a> {
debug!("Partition {} for {} is in {:?}", index, self.name, path); debug!("Partition {} for {} is in {:?}", index, self.name, path);
if !path.exists() { if !path.exists() {
return Err(ErrorKind::NoSuchPartition(index).into()); return Err(anyhow!("Partition {} does not exist", index));
} }
Ok(Partition::new::<Self>(path)) Ok(Partition::new::<Self>(path))
} }

View File

@ -2,19 +2,18 @@ use super::mount;
use super::Tool; use super::Tool;
use crate::args; use crate::args;
use crate::constants::{BOOT_PARTITION_INDEX, ROOT_PARTITION_INDEX}; use crate::constants::{BOOT_PARTITION_INDEX, ROOT_PARTITION_INDEX};
use crate::error::{Error, ErrorKind};
use crate::process::CommandExt; use crate::process::CommandExt;
use crate::storage; use crate::storage;
use crate::storage::{is_encrypted_device, EncryptedDevice}; use crate::storage::{is_encrypted_device, EncryptedDevice};
use crate::storage::{BlockDevice, Filesystem, FilesystemType, LoopDevice}; use crate::storage::{BlockDevice, Filesystem, FilesystemType, LoopDevice};
use anyhow::Context;
use log::info; use log::info;
use failure::ResultExt;
use tempfile::tempdir; use tempfile::tempdir;
/// Use arch-chroot to chroot to the given device /// Use arch-chroot to chroot to the given device
/// Also handles encrypted root partitions (detected by checking for the LUKS magic header) /// Also handles encrypted root partitions (detected by checking for the LUKS magic header)
pub fn chroot(command: args::ChrootCommand) -> Result<(), Error> { pub fn chroot(command: args::ChrootCommand) -> anyhow::Result<()> {
let arch_chroot = Tool::find("arch-chroot")?; let arch_chroot = Tool::find("arch-chroot")?;
let cryptsetup; let cryptsetup;
@ -26,12 +25,12 @@ pub fn chroot(command: args::ChrootCommand) -> Result<(), Error> {
Err(_) => { Err(_) => {
loop_device = Some(LoopDevice::create(&command.block_device)?); loop_device = Some(LoopDevice::create(&command.block_device)?);
storage::StorageDevice::from_path( storage::StorageDevice::from_path(
loop_device.as_ref().unwrap().path(), loop_device.as_ref().expect("loop device not found").path(),
command.allow_non_removable, command.allow_non_removable,
)? )?
} }
}; };
let mount_point = tempdir().context(ErrorKind::TmpDirError)?; let mount_point = tempdir().context("Error creating a temporary directory")?;
let boot_partition = storage_device.get_partition(BOOT_PARTITION_INDEX)?; let boot_partition = storage_device.get_partition(BOOT_PARTITION_INDEX)?;
let boot_filesystem = Filesystem::from_partition(&boot_partition, FilesystemType::Vfat); let boot_filesystem = Filesystem::from_partition(&boot_partition, FilesystemType::Vfat);
@ -40,7 +39,7 @@ pub fn chroot(command: args::ChrootCommand) -> Result<(), Error> {
let encrypted_root = if is_encrypted_device(&root_partition_base)? { let encrypted_root = if is_encrypted_device(&root_partition_base)? {
cryptsetup = Some(Tool::find("cryptsetup")?); cryptsetup = Some(Tool::find("cryptsetup")?);
Some(EncryptedDevice::open( Some(EncryptedDevice::open(
cryptsetup.as_ref().unwrap(), cryptsetup.as_ref().expect("cryptsetup not found"),
&root_partition_base, &root_partition_base,
"alma_root".into(), "alma_root".into(),
)?) )?)
@ -61,7 +60,13 @@ pub fn chroot(command: args::ChrootCommand) -> Result<(), Error> {
.execute() .execute()
.arg(mount_point.path()) .arg(mount_point.path())
.args(&command.command) .args(&command.command)
.run(ErrorKind::Interactive)?; .run()
.with_context(|| {
format!(
"Error running command in chroot: {}",
command.command.join(" "),
)
})?;
info!("Unmounting filesystems"); info!("Unmounting filesystems");
mount_stack.umount()?; mount_stack.umount()?;

View File

@ -6,8 +6,7 @@ pub use chroot::chroot;
pub use mount::mount; pub use mount::mount;
pub use qemu::qemu; pub use qemu::qemu;
use crate::error::*; use anyhow::anyhow;
use failure::ResultExt;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use which::which; use which::which;
@ -18,10 +17,17 @@ pub struct Tool {
} }
impl Tool { impl Tool {
pub fn find(name: &'static str) -> Result<Self, Error> { pub fn find(name: &'static str) -> anyhow::Result<Self> {
Ok(Self { // Note this conversion is only necessary until which releases their new version using
exec: which(name).context(ErrorKind::NoTool(name))?, // thiserror instead of failure - then we can just use .with_context() on the thiserror
}) // Error
// Commit pending release:
// BLOCKED: https://github.com/harryfei/which-rs/commit/e6e839c4f6cdf8d3e33ec7eafdd50d34472740ea
let which = match which(name) {
Ok(x) => Ok(x),
Err(_) => Err(anyhow!("Could not find tool: {}", name)),
}?;
Ok(Self { exec: which })
} }
pub fn execute(&self) -> Command { pub fn execute(&self) -> Command {

View File

@ -1,6 +1,5 @@
use crate::error::{Error, ErrorKind};
use crate::storage::{Filesystem, MountStack}; use crate::storage::{Filesystem, MountStack};
use failure::ResultExt; use anyhow::Context;
use log::{debug, info}; use log::{debug, info};
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
@ -12,7 +11,7 @@ pub fn mount<'a>(
mount_path: &Path, mount_path: &Path,
boot_filesystem: &'a Filesystem, boot_filesystem: &'a Filesystem,
root_filesystem: &'a Filesystem, root_filesystem: &'a Filesystem,
) -> Result<MountStack<'a>, Error> { ) -> anyhow::Result<MountStack<'a>> {
let mut mount_stack = MountStack::new(); let mut mount_stack = MountStack::new();
debug!( debug!(
"Root partition: {}", "Root partition: {}",
@ -22,16 +21,16 @@ pub fn mount<'a>(
info!("Mounting filesystems to {}", mount_path.display()); info!("Mounting filesystems to {}", mount_path.display());
mount_stack mount_stack
.mount(&root_filesystem, mount_path.into(), None) .mount(&root_filesystem, mount_path.into(), None)
.context(ErrorKind::Mounting)?; .with_context(|| format!("Error mounting filesystem to {}", mount_path.display()))?;
let boot_point = mount_path.join("boot"); let boot_point = mount_path.join("boot");
if !boot_point.exists() { if !boot_point.exists() {
fs::create_dir(&boot_point).context(ErrorKind::CreateBoot)?; fs::create_dir(&boot_point).context("Error creating the boot directory")?;
} }
mount_stack mount_stack
.mount(&boot_filesystem, boot_point, None) .mount(&boot_filesystem, boot_point, None)
.context(ErrorKind::Mounting)?; .context("Error mounting the boot point")?;
Ok(mount_stack) Ok(mount_stack)
} }

View File

@ -1,15 +1,14 @@
use super::Tool; use super::Tool;
use crate::args; use crate::args;
use crate::error; use anyhow::Context;
use log::debug; use log::debug;
use failure::ResultExt;
use std::os::unix::process::CommandExt as UnixCommandExt; use std::os::unix::process::CommandExt as UnixCommandExt;
use std::path::PathBuf; use std::path::PathBuf;
/// Loads given block device in qemu /// Loads given block device in qemu
/// Uses kvm if it is enabled /// Uses kvm if it is enabled
pub fn qemu(command: args::QemuCommand) -> Result<(), error::Error> { pub fn qemu(command: args::QemuCommand) -> anyhow::Result<()> {
let qemu = Tool::find("qemu-system-x86_64")?; let qemu = Tool::find("qemu-system-x86_64")?;
let mut run = qemu.execute(); let mut run = qemu.execute();
@ -39,5 +38,5 @@ pub fn qemu(command: args::QemuCommand) -> Result<(), error::Error> {
let err = run.exec(); let err = run.exec();
Err(err).context(error::ErrorKind::Qemu)? Err(err).context("Failed launching Qemu")?
} }