Compare commits

...

20 Commits

Author SHA1 Message Date
Mikaël Cluseau 30cdf9456b chore: Release init version 2.6.10 2026-06-11 12:11:39 +02:00
Mikaël Cluseau 19193a9560 chore 2026-06-11 12:08:42 +02:00
Mikaël Cluseau ee0ff1373f factorize mounting read-only filesystems (squashfs, erofs) 2026-06-11 11:35:50 +02:00
Mikaël Cluseau ee03452591 chore: Release init version 2.6.9 2026-06-09 16:06:20 +02:00
Mikaël Cluseau 7fef9eaf6c add OVMF.fd 2026-06-09 16:06:14 +02:00
Mikaël Cluseau 6a9875fad5 init: symlink modules firmware 2026-06-09 16:05:19 +02:00
Mikaël Cluseau 6a8805346f add example (but useful) dhcp initrd 2026-06-05 14:10:37 +02:00
Mikaël Cluseau acb8f28ab7 cargo update 2026-06-04 19:09:28 +02:00
Mikaël Cluseau d4ec6380f8 untar by ourselves 2026-06-04 19:08:54 +02:00
Mikaël Cluseau 3036b2f417 chore: Release init version 2.6.8 2026-06-02 06:38:05 +02:00
Mikaël Cluseau e72e6a0b3b seed: more atomic 2026-06-02 06:36:45 +02:00
Mikaël Cluseau 2924263cb6 chore: Release init version 2.6.7 2026-05-30 19:50:23 +02:00
Mikaël Cluseau 5ce212b3ef bump rust 2026-05-30 19:49:58 +02:00
Mikaël Cluseau ea49b99dbe chore: Release init version 2.6.6 2026-05-12 10:28:29 +02:00
Mikaël Cluseau c5f3f220c9 cargo update 2026-05-12 10:28:23 +02:00
Mikaël Cluseau fec3cfcb57 add ethtool 2026-05-12 10:20:58 +02:00
Mikaël Cluseau c8437c655c chore: Release init version 2.6.5 2026-05-08 12:00:31 +02:00
Mikaël Cluseau fe3752baf9 auto-create inittab entries for serial consoles 2026-05-08 11:56:45 +02:00
Mikaël Cluseau f29dc650b4 chore: Release init version 2.6.4 2026-05-08 11:54:39 +02:00
Mikaël Cluseau 5ebf1331bb bump dkl 2026-05-08 11:54:39 +02:00
20 changed files with 404 additions and 204 deletions
Generated
+122 -93
View File
@@ -108,9 +108,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "base32"
@@ -126,9 +126,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bitflags"
version = "2.11.1"
version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
[[package]]
name = "blake2b_simd"
@@ -143,9 +143,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.20.2"
version = "3.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
[[package]]
name = "bytecount"
@@ -161,14 +161,14 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "cc"
version = "1.2.61"
version = "1.2.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d"
checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f"
dependencies = [
"find-msvc-tools",
"jobserver",
"libc",
"shlex",
"shlex 2.0.1",
]
[[package]]
@@ -185,9 +185,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chrono"
version = "0.4.44"
version = "0.4.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
dependencies = [
"iana-time-zone",
"num-traits",
@@ -218,14 +218,14 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.6.3"
version = "4.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "660c0520455b1013b9bcb0393d5f643d7e4454fb69c915b8d6d2aa0e9a45acc3"
checksum = "e0a7a9bfdb35811f9e59832f0f05975114d2251b415fb534108e6f34060fd772"
dependencies = [
"clap",
"clap_lex",
"is_executable",
"shlex",
"shlex 1.3.0",
]
[[package]]
@@ -309,9 +309,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "displaydoc"
version = "0.2.5"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
dependencies = [
"proc-macro2",
"quote",
@@ -321,7 +321,7 @@ dependencies = [
[[package]]
name = "dkl"
version = "1.2.1"
source = "git+https://novit.tech/direktil/dkl#71f4faa8cb4570df976b50bd16a4ab43fe85d468"
source = "git+https://novit.tech/direktil/dkl#34a77eb436f104b77e9ab3d9396b4f452b8cca34"
dependencies = [
"async-compression",
"base32",
@@ -335,6 +335,7 @@ dependencies = [
"fastrand",
"futures",
"futures-util",
"getrandom 0.4.2",
"glob",
"hex",
"human-units",
@@ -344,12 +345,12 @@ dependencies = [
"nix",
"openssl",
"page_size",
"reqwest 0.13.3",
"reqwest 0.13.4",
"rpassword",
"rust-argon2",
"serde",
"serde_json",
"serde_yaml",
"serde_yaml_ng",
"signal-hook",
"tabled",
"thiserror",
@@ -358,9 +359,9 @@ dependencies = [
[[package]]
name = "either"
version = "1.15.0"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
[[package]]
name = "env_filter"
@@ -417,6 +418,16 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
[[package]]
name = "filetime"
version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
dependencies = [
"cfg-if",
"libc",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.9"
@@ -589,9 +600,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.17.0"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
[[package]]
name = "heck"
@@ -607,9 +618,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
version = "1.4.0"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425"
dependencies = [
"bytes",
"itoa",
@@ -655,9 +666,9 @@ dependencies = [
[[package]]
name = "hyper"
version = "1.9.0"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca"
checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498"
dependencies = [
"atomic-waker",
"bytes",
@@ -874,14 +885,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
dependencies = [
"equivalent",
"hashbrown 0.17.0",
"hashbrown 0.17.1",
"serde",
"serde_core",
]
[[package]]
name = "init"
version = "2.6.2"
version = "2.6.10"
dependencies = [
"dkl",
"env_logger",
@@ -900,6 +911,7 @@ dependencies = [
"serde_yaml",
"shell-escape",
"sys-info",
"tar",
"termios",
"tokio",
"unix_mode",
@@ -911,16 +923,6 @@ version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
[[package]]
name = "iri-string"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20"
dependencies = [
"memchr",
"serde",
]
[[package]]
name = "is_executable"
version = "1.0.5"
@@ -953,9 +955,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "jiff"
version = "0.2.24"
version = "0.2.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f00b5dbd620d61dfdcb6007c9c1f6054ebd75319f163d886a9055cec1155073d"
checksum = "4603d3033e49e2b0e31229fcab20a5d40089c607d975cd9c80551dc69eed9102"
dependencies = [
"jiff-static",
"log",
@@ -966,9 +968,9 @@ dependencies = [
[[package]]
name = "jiff-static"
version = "0.2.24"
version = "0.2.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e000de030ff8022ea1da3f466fbb0f3a809f5e51ed31f6dd931c35181ad8e6d7"
checksum = "782d32378dddf207193ac91cefb848ad41abb58195c95168e1291227a0832b47"
dependencies = [
"proc-macro2",
"quote",
@@ -987,13 +989,12 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.95"
version = "0.3.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca"
checksum = "f2025f20d7a4fa7785846e7b63d10a76d3f1cee98ee5cb79ea59703f95e42162"
dependencies = [
"cfg-if",
"futures-util",
"once_cell",
"wasm-bindgen",
]
@@ -1023,9 +1024,9 @@ checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
[[package]]
name = "log"
version = "0.4.29"
version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
[[package]]
name = "lz4"
@@ -1048,15 +1049,15 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.8.0"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
[[package]]
name = "mio"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
dependencies = [
"libc",
"wasi",
@@ -1082,9 +1083,9 @@ dependencies = [
[[package]]
name = "nix"
version = "0.31.2"
version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d6d0705320c1e6ba1d912b5e37cf18071b6c2e9b7fa8215a1e8a7651966f5d3"
checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
dependencies = [
"bitflags",
"cfg-if",
@@ -1115,15 +1116,14 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "openssl"
version = "0.10.78"
version = "0.10.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222"
checksum = "a45fa2aa886c42762255da344f0a0d313e254066c46aad76f300c3d3da62d967"
dependencies = [
"bitflags",
"cfg-if",
"foreign-types",
"libc",
"once_cell",
"openssl-macros",
"openssl-sys",
]
@@ -1147,9 +1147,9 @@ checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
[[package]]
name = "openssl-sys"
version = "0.9.114"
version = "0.9.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13ce1245cd07fcc4cfdb438f7507b0c7e4f3849a69fd84d52374c66d83741bb6"
checksum = "f28a22dc7140cda5f096e5e7724a6962ca81a7f8bfd2979f9b18c11af56318c4"
dependencies = [
"cc",
"libc",
@@ -1290,9 +1290,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "regex"
version = "1.12.3"
version = "1.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
dependencies = [
"aho-corasick",
"memchr",
@@ -1313,9 +1313,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.10"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "reqwest"
@@ -1351,9 +1351,9 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.13.3"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0"
checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"
dependencies = [
"base64",
"bytes",
@@ -1389,13 +1389,13 @@ dependencies = [
[[package]]
name = "rpassword"
version = "7.4.0"
version = "7.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66d4c8b64f049c6721ec8ccec37ddfc3d641c4a7fca57e8f2a89de509c73df39"
checksum = "2da316a15f47e3d053de9cb2c439650bd8fa4aaeb9365f2e5f27f492ff73c196"
dependencies = [
"libc",
"rtoolbox",
"windows-sys 0.59.0",
"windows-sys 0.61.2",
]
[[package]]
@@ -1524,9 +1524,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.149"
version = "1.0.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
dependencies = [
"itoa",
"memchr",
@@ -1548,6 +1548,19 @@ dependencies = [
"unsafe-libyaml",
]
[[package]]
name = "serde_yaml_ng"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4db627b98b36d4203a7b458cf3573730f2bb591b28871d916dfa9efabfd41f"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "shell-escape"
version = "0.1.5"
@@ -1560,6 +1573,12 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "signal-hook"
version = "0.4.4"
@@ -1594,9 +1613,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "socket2"
version = "0.6.3"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"
dependencies = [
"libc",
"windows-sys 0.61.2",
@@ -1700,6 +1719,16 @@ dependencies = [
"syn",
]
[[package]]
name = "tar"
version = "0.4.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
dependencies = [
"filetime",
"libc",
]
[[package]]
name = "tempfile"
version = "3.27.0"
@@ -1763,9 +1792,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.52.1"
version = "1.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6"
checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
dependencies = [
"bytes",
"libc",
@@ -1828,20 +1857,20 @@ dependencies = [
[[package]]
name = "tower-http"
version = "0.6.8"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
dependencies = [
"bitflags",
"bytes",
"futures-util",
"http",
"http-body",
"iri-string",
"pin-project-lite",
"tower",
"tower-layer",
"tower-service",
"url",
]
[[package]]
@@ -1976,9 +2005,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89"
checksum = "a254a4b10c19a76f09a27640e7ffbf9bc30bf67e16a3bf28aaefa4920fe81563"
dependencies = [
"cfg-if",
"once_cell",
@@ -1989,9 +2018,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.68"
version = "0.4.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8"
checksum = "54568702fabf5d4849ce2b90fadfa64168a097eaf4b351ce9df8b687a0086aaf"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -1999,9 +2028,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed"
checksum = "24a40fc75b0ec6f3746ceb10d36f53a93dcd68a93b11b6445983945d79eba0dc"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -2009,9 +2038,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904"
checksum = "908f34bd9b9ce3d4caf07b72dfab63d61504d156856c6bd3cd87fa350cf3985b"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -2022,9 +2051,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.118"
version = "0.2.123"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129"
checksum = "7acbf7616c27b194bbb550bf77ed0c2c3e5b7fd1260a93082b95fb7f47959b92"
dependencies = [
"unicode-ident",
]
@@ -2078,9 +2107,9 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.95"
version = "0.3.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d"
checksum = "6e0871acf327f283dc6da28a1696cdc64fb355ba9f935d052021fa77f35cce69"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -2436,9 +2465,9 @@ checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
[[package]]
name = "yoke"
version = "0.8.2"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
dependencies = [
"stable_deref_trait",
"yoke-derive",
@@ -2459,9 +2488,9 @@ dependencies = [
[[package]]
name = "zerofrom"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df"
checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
dependencies = [
"zerofrom-derive",
]
+2 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "init"
version = "2.6.2"
version = "2.6.10"
edition = "2024"
[profile.release]
@@ -32,3 +32,4 @@ openssl = "0.10.73"
reqwest = { git = "https://github.com/mcluseau/rs-reqwest", version = "0.13.1", features = ["native-tls", "system-proxy", "socks"], default-features = false }
glob = "0.3.3"
hex = "0.4.3"
tar = { version = "0.4.46", default-features = false }
+2 -2
View File
@@ -1,4 +1,4 @@
from rust:1.95.0-alpine as rust
from rust:1.96.0-alpine as rust
run apk add --no-cache git musl-dev libudev-zero-dev openssl-dev cryptsetup-dev lvm2-dev clang-libs clang-dev
@@ -17,7 +17,7 @@ run . /etc/os-release \
&& wget -O- https://dl-cdn.alpinelinux.org/alpine/v${VERSION_ID%.*}/releases/x86_64/alpine-minirootfs-${VERSION_ID}-x86_64.tar.gz |tar zxv
run apk add --no-cache --update -p . musl libgcc coreutils \
iproute2 lvm2 lvm2-extra lvm2-dmeventd udev cryptsetup \
ethtool iproute2 lvm2 lvm2-extra lvm2-dmeventd udev cryptsetup \
e2fsprogs lsblk openssl openssh-server wireguard-tools-wg-quick \
&& rm -rf usr/share/apk var/cache/apk etc/motd dev/*
BIN
View File
Binary file not shown.
+62
View File
@@ -0,0 +1,62 @@
#! /bin/bash
base_initrd=dist/initrd
flavor=dhcp
dir=tmp/$flavor-initrd
dist=dist/$flavor
uki=$dist/bootx64.efi
linux_v=6.18.34
set -ex
mkdir -p tmp/dl $dist
linux=tmp/dl/linux-$linux_v
modules=tmp/dl/modules-$linux_v
[ -e $linux ] || curl -o $linux https://dkl.novit.io/dist/kernels/6.18.35
[ -e $modules ] || curl -o $modules https://dkl.novit.io/dist/layers/modules/6.18.35.erofs
rm -fr $dir
mkdir $dir
cpio --quiet --extract --file $base_initrd --directory $dir
cp -rv $flavor/. $dir
cp $modules $dir/modules.fs
(cd $dir && find * |cpio --create -H newc -R 0:0) >$dir.cpio
if cpio -tF $dir.cpio 2>&1 |grep bytes.of.junk; then echo "bad cpio archive"; exit 1; fi
zstd -12 -T0 -vf $dir.cpio &&
mv $dir.cpio.zst $dist/initrd
cp $linux $dist/vmlinuz
ukify build --output $uki --os-release "Direktil DHCP" \
--linux $linux --initrd $dist/initrd
MB=$(( 2**20 ))
sz=$(( ( $(stat -c %s $uki) + MB ) / MB + 2 ))
efi=$dist/efi.img
if [ -e $efi ]; then rm $efi; fi
truncate -s ${sz}M $efi
sgdisk -n 1:2048:0 -t 1:ef00 -c 1:"EFI System" $efi
offset=$(( 2048 * 512 ))
export MTOOLSRC=$(mktemp)
trap "rm -f $MTOOLSRC" exit
echo "drive e: file=\"$efi\" offset=$offset" >$MTOOLSRC
args="-i $efi@@$offset"
mformat -F e:
mmd e:EFI e:EFI/BOOT
mcopy $uki e:EFI/BOOT/BOOTX64.EFI
+1 -1
View File
@@ -1,7 +1,7 @@
use std::process::Command;
fn main() {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.args(["rev-parse", "HEAD"])
.output()
.unwrap();
let git_commit = String::from_utf8(output.stdout).unwrap();
+37
View File
@@ -0,0 +1,37 @@
---
anti_phishing_code: "direktil<3"
modules: /modules.fs
auths:
- name: adm1@novit
sshKey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICkpbU6sf4t0f6XAv9DuW3XH5iLM0AI5rc8PT2jwea1N
- name: adm2@novit
sshKey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILIomzqVAIqb7BedauhAo2VgbLqme5Jx/vjGUqZLoJqF
ssh:
listen: "[::]:22"
networks:
- name: loopback
interfaces: [ { var: iface, n: 1, udev: !eq [INTERFACE, lo] } ]
script: |
ip a add 127.0.0.1/8 dev lo
ip a add ::1/128 dev lo
ip li set lo up
- name: main
interfaces:
- var: ifaces
n: -1
udev: !has ID_NET_NAME_MAC
script: |
ip link add main type bond mode active-backup
for l in $ifaces; do
ip link set $l master main
ip link set $l up
done
ip link set main up
udhcpc -b -i main
bootstrap:
dev: /dev/storage/bootstrap
+46 -7
View File
@@ -1,10 +1,10 @@
use eyre::{format_err, Result};
use eyre::{Result, format_err};
use log::{error, info, warn};
use std::collections::BTreeSet as Set;
use std::convert::Infallible;
use std::os::unix::fs::symlink;
use tokio::sync::Mutex;
use tokio::{fs, process::Command};
use tokio::{fs, io::AsyncReadExt, process::Command};
use crate::{cmd::version::version_string, dklog, input, utils};
use dkl::bootstrap::Config;
@@ -154,7 +154,8 @@ use std::path::Path;
async fn mount_modules(modules: &str, kernel_version: &str) -> Result<()> {
info!("mounting modules");
mount(Some(modules), "/modules", "squashfs", None).await;
mount_ro_fs(modules, "/modules").await?;
fs::create_dir_all("/lib/modules").await?;
let modules_path = &format!("/modules/lib/modules/{kernel_version}");
@@ -166,6 +167,13 @@ async fn mount_modules(modules: &str, kernel_version: &str) -> Result<()> {
}
symlink(modules_path, format!("/lib/modules/{kernel_version}"))?;
let firmware_path = &format!("/modules/lib/firmware/{kernel_version}");
if std::fs::exists(firmware_path)? {
fs::create_dir_all("/lib/firmware").await?;
symlink(firmware_path, format!("/lib/firmware/{kernel_version}"))?;
}
Ok(())
}
@@ -201,6 +209,8 @@ async fn mount<S: AsRef<Path>>(
is_file = (fs::metadata(src).await)
.map_err(|e| format_err!("stat {src} failed: {e}"))?
.is_file();
#[allow(clippy::single_match)] // may be extended later
match fstype {
"ext4" => {
exec("fsck.ext4", &["-p", src]).await;
@@ -236,6 +246,35 @@ async fn mount<S: AsRef<Path>>(
.await
}
async fn mount_ro_fs(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> {
let src = src.as_ref();
let dst = dst.as_ref();
// identify RO fs type
let mut buf = [0u8; 1028];
fs::File::open(src)
.await
.map_err(|e| format_err!("open {}: {e}", src.display()))?
.read_exact(&mut buf)
.await
.map_err(|e| format_err!("read {}: {e}", src.display()))?;
let fstype = if buf[1024..1028] == 0xE0F5E1E2u32.to_le_bytes() {
"erofs"
} else {
"squashfs"
};
if let Err(e) = fs::create_dir_all(dst).await {
error!("failed to create dir {dst}: {e}", dst = dst.display());
}
let mut cmd = Command::new("mount");
cmd.args(["-t", fstype]).arg(src).arg(dst);
try_exec_cmd(cmd).await
}
async fn start_daemon(prog: &str, args: &[&str]) {
let (cmd_str, mut cmd) = cmd_str(prog, args);
retry_or_ignore(async || {
@@ -246,7 +285,7 @@ async fn start_daemon(prog: &str, args: &[&str]) {
.await;
}
async fn try_exec_cmd(mut cmd: tokio::process::Command) -> Result<()> {
async fn try_exec_cmd(mut cmd: Command) -> Result<()> {
info!(
"# {} {}",
cmd.as_std().get_program().to_string_lossy(),
@@ -348,9 +387,9 @@ fn cmd_str(prog: &str, args: &[&str]) -> (String, Command) {
#[allow(unused)]
async fn child_reaper() {
use nix::sys::wait::{waitpid, WaitPidFlag};
use nix::sys::wait::{WaitPidFlag, waitpid};
use nix::unistd::Pid;
use tokio::signal::unix::{signal, SignalKind};
use tokio::signal::unix::{SignalKind, signal};
let Ok(mut sigs) =
signal(SignalKind::child()).inspect_err(|e| warn!("failed to setup SIGCHLD handler: {e}"))
@@ -368,7 +407,7 @@ async fn switch_root(root: &str) -> Result<Infallible> {
info!("killing all processes and switching root");
dklog::LOG.close().await;
use nix::sys::signal::{kill, SIGKILL};
use nix::sys::signal::{SIGKILL, kill};
use nix::unistd::Pid;
if let Err(e) = kill(Pid::from_raw(-1), SIGKILL) {
+72 -38
View File
@@ -1,9 +1,9 @@
use eyre::{format_err, Result};
use eyre::{Result, format_err};
use log::{debug, info, warn};
use std::path::{Path, PathBuf};
use tokio::{
fs,
io::{AsyncBufReadExt, AsyncReadExt, AsyncWrite, AsyncWriteExt, BufReader},
io::{AsyncBufReadExt, AsyncWrite, AsyncWriteExt, BufReader},
};
use dkl::{
@@ -13,7 +13,7 @@ use dkl::{
bootstrap::Config,
};
use super::{exec, mount, retry, retry_or_ignore, try_exec, try_exec_cmd};
use super::{exec, mount, mount_ro_fs, retry, retry_or_ignore, try_exec, try_exec_cmd};
use crate::{fs::walk_dir, utils};
pub async fn bootstrap(cfg: Config) {
@@ -49,7 +49,7 @@ pub async fn bootstrap(cfg: Config) {
.await;
let sys_cfg: dkl::Config = retry(async || {
let sys_cfg_bytes = seed_config(base_dir, &bs, &verifier).await?;
let sys_cfg_bytes = seed_config(base_dir, bs, &verifier).await?;
Ok(serde_yaml::from_slice(&sys_cfg_bytes)?)
})
.await;
@@ -79,7 +79,30 @@ pub async fn bootstrap(cfg: Config) {
})
.await;
exec("chroot", &["/system", "update-ca-certificates"]).await
exec("chroot", &["/system", "update-ca-certificates"]).await;
// activate ttyS* consoles as needed
retry_or_ignore(async || {
const PATH: &str = "/system/etc/inittab";
let mut inittab = fs::read_to_string(PATH).await?;
let mut changed = false;
for opt in utils::cmdline().filter_map(|s| s.strip_prefix("console=ttyS")) {
info!("inittab: adding entry for ttyS{opt}");
changed = true;
let mut params = opt.split(',');
let num = params.next().unwrap();
let speed = params.next().unwrap_or("115200");
inittab.push_str(&format!(
"S{num}:12345:respawn:/sbin/agetty --noclear {speed} ttyS{num} linux\n"
));
}
if changed {
fs::write(PATH, inittab.as_bytes()).await?;
}
Ok(())
})
.await;
}
struct Verifier {
@@ -94,7 +117,7 @@ impl Verifier {
let pubkey = base64_decode(pubkey)?;
let pubkey = Some(pubkey);
return Ok(Self { pubkey });
Ok(Self { pubkey })
}
async fn verify_path(&self, path: impl AsRef<Path>) -> Result<Vec<u8>> {
@@ -129,33 +152,48 @@ impl Verifier {
}
async fn seed_config(
base_dir: &str,
base_dir: impl Into<PathBuf>,
bs: &dkl::bootstrap::Bootstrap,
verifier: &Verifier,
) -> Result<Vec<u8>> {
let cfg_path = &format!("{base_dir}/config.yaml");
let base_dir = base_dir.into();
if fs::try_exists(cfg_path).await? {
return Ok(fs::read(cfg_path).await?);
let cfg_path = base_dir.join("config.yaml");
if fs::try_exists(&cfg_path).await? {
return verifier.verify_path(cfg_path).await;
}
let bs_tar = "/bootstrap.tar";
if !fs::try_exists(bs_tar).await? {
if !fs::try_exists(&bs_tar).await? {
if bs.seed.is_none() {
return Err(format_err!(
"no {cfg_path}, no {bs_tar} and no seed URL, can't bootstrap"
"no {}, no {bs_tar} and no seed URL, can't bootstrap",
cfg_path.display()
));
}
fetch_bootstrap(bs, bs_tar).await?;
}
try_exec("tar", &["xf", bs_tar, "-C", base_dir]).await?;
let tmp_dir = base_dir.with_added_extension("new");
fs::create_dir_all(&tmp_dir).await?;
if !fs::try_exists(cfg_path).await? {
return Err(format_err!("{cfg_path} does not exist after seeding"));
untar(bs_tar, &tmp_dir)
.await
.map_err(|e| format_err!("untar failed: {e}"))?;
let cfg_path = tmp_dir.join("config.yaml");
if !fs::try_exists(&cfg_path).await? {
return Err(format_err!(
"{} does not exist after seeding",
cfg_path.display()
));
}
verifier.verify_path(&cfg_path).await
let cfg_bytes = verifier.verify_path(&cfg_path).await?;
fs::rename(tmp_dir, base_dir).await?;
Ok(cfg_bytes)
}
async fn fetch_bootstrap(bs: &dkl::bootstrap::Bootstrap, output_file: &str) -> Result<()> {
@@ -206,6 +244,18 @@ async fn fetch_bootstrap(bs: &dkl::bootstrap::Bootstrap, output_file: &str) -> R
Ok(())
}
async fn untar(arch: impl Into<PathBuf>, target: impl Into<PathBuf>) -> Result<()> {
let arch = arch.into();
let target = target.into();
tokio::task::spawn_blocking(move || {
let tar = std::fs::File::open(arch)?;
let mut tar = tar::Archive::new(tar);
tar.unpack(target)
})
.await??;
Ok(())
}
fn default_root_tmpfs_opts() -> Option<String> {
let mem = sys_info::mem_info()
.inspect_err(|e| warn!("failed to get system memory info, using default tmpfs size: {e}"))
@@ -261,7 +311,7 @@ impl LayerMounter<'_> {
.await
.map_err(|e| format_err!("write {}: {e}", tgt.display()))?;
let dm_name = &format!("system");
let dm_name = "system";
let mut cmd = tokio::process::Command::new("veritysetup");
cmd.arg("open")
@@ -290,25 +340,7 @@ impl LayerMounter<'_> {
.await
};
retry(async || {
let mut buf = [0u8; 1028];
fs::File::open(&mount_src)
.await
.map_err(|e| format_err!("open {}: {e}", mount_src.display()))?
.read_exact(&mut buf)
.await
.map_err(|e| format_err!("read {}: {e}", mount_src.display()))?;
let fstype = if buf[1024..1028] == 0xE0F5E1E2u32.to_le_bytes() {
"erofs"
} else {
"squashfs"
};
mount(Some(&mount_src), &tgt_dir, fstype, None).await;
Ok(())
})
.await;
retry(async || mount_ro_fs(&mount_src, &tgt_dir).await).await;
if !self.lower_dir.is_empty() {
self.lower_dir.push(':');
@@ -472,8 +504,10 @@ async fn mount_filesystems(mounts: &[dkl::Mount], root: &str) {
}
async fn setup_root_user(user: &dkl::RootUser, root: &str) -> Result<()> {
if let Some(pw_hash) = user.password_hash.as_ref().filter(|v| !v.is_empty()) {
set_user_password("root", &pw_hash, root).await?;
if let Some(pw_hash) = user.password_hash.as_ref()
&& !pw_hash.is_empty()
{
set_user_password("root", pw_hash, root).await?;
}
let mut authorized_keys = Vec::new();
+2 -2
View File
@@ -1,4 +1,4 @@
use eyre::{format_err, Result};
use eyre::{Result, format_err};
use log::{error, info, warn};
use std::collections::BTreeSet as Set;
use std::process::Stdio;
@@ -6,7 +6,7 @@ use tokio::io::AsyncWriteExt;
use tokio::process::Command;
use tokio::sync::Mutex;
use super::{retry_or_ignore, USED_DEVS};
use super::{USED_DEVS, retry_or_ignore};
use crate::blockdev::{is_uninitialized, uninitialize};
use crate::fs::walk_dir;
use crate::input;
+10 -10
View File
@@ -1,8 +1,8 @@
use eyre::{format_err, Result};
use eyre::{Result, format_err};
use log::{error, info, warn};
use tokio::process::Command;
use super::{exec, retry, retry_or_ignore, USED_DEVS};
use super::{USED_DEVS, exec, retry, retry_or_ignore};
use crate::fs::walk_dir;
use crate::{blockdev, lvm};
use dkl::bootstrap::{Config, Filesystem, LvSize, LvmLV, LvmPV, LvmVG, TAKE_ALL};
@@ -31,7 +31,7 @@ pub async fn setup(cfg: &Config) {
if (lvs.iter()).any(|lv| lv.equal_name(vg_name, lv_name)) {
info!("LVM LV {vg_name}/{lv_name} exists");
} else {
retry_or_ignore(async || setup_lv(&vg, &lv).await).await;
retry_or_ignore(async || setup_lv(vg, lv).await).await;
}
}
}
@@ -40,7 +40,7 @@ pub async fn setup(cfg: &Config) {
for vg in &cfg.lvm {
for lv in &vg.lvs {
retry_or_ignore(async || format_lv(&vg, &lv).await).await;
retry_or_ignore(async || format_lv(vg, lv).await).await;
}
}
}
@@ -115,20 +115,20 @@ async fn setup_lv(vg: &LvmVG, lv: &LvmLV) -> Result<()> {
let mut cmd = Command::new("lvcreate");
cmd.arg(&vg.name);
cmd.args(&["--name", &lv.name]);
cmd.args(["--name", &lv.name]);
match &lv.size {
LvSize::Size(sz) => cmd.args(&["-L", sz]),
LvSize::Extents(sz) => cmd.args(&["-l", sz]),
LvSize::Size(sz) => cmd.args(["-L", sz]),
LvSize::Extents(sz) => cmd.args(["-l", sz]),
};
let raid = lv.raid.as_ref().unwrap_or(&vg.defaults.raid);
if let Some(mirrors) = raid.mirrors {
cmd.args(&["--mirrors", &mirrors.to_string()]);
cmd.args(["--mirrors", &mirrors.to_string()]);
}
if let Some(stripes) = raid.stripes {
cmd.args(&["--stripes", &stripes.to_string()]);
cmd.args(["--stripes", &stripes.to_string()]);
}
let status = cmd.status().await?;
@@ -147,7 +147,7 @@ async fn format_lv(vg: &LvmVG, lv: &LvmLV) -> Result<()> {
let name = &format!("{}/{}", vg.name, lv.name);
let dev = &format!("/dev/{name}");
if !blockdev::is_uninitialized(&dev).await? {
if !blockdev::is_uninitialized(dev).await? {
info!("{dev} looks initialized");
return Ok(());
}
+3 -3
View File
@@ -3,10 +3,10 @@ use log::{info, warn};
use std::collections::BTreeSet as Set;
use tokio::process::Command;
use super::{format_err, retry_or_ignore, Result};
use super::{Result, format_err, retry_or_ignore};
use crate::{
udev,
utils::{select_n_by_regex, select_n_by_udev, NameAliases},
utils::{NameAliases, select_n_by_regex, select_n_by_udev},
};
use dkl::bootstrap::{Config, Network};
@@ -50,7 +50,7 @@ async fn setup_network(net: &Network, assigned: &mut Set<String>) -> Result<()>
"net",
"INTERFACE",
&udev_filter.clone().into(),
&assigned,
assigned,
)
.await?
} else {
+3 -7
View File
@@ -1,10 +1,6 @@
use log::{info, warn};
use std::fs;
use std::io::Write;
use std::os::unix::fs::PermissionsExt;
use std::process::Stdio;
use tokio::net;
use tokio::process::Command;
use std::{fs, io::Write, os::unix::fs::PermissionsExt, process::Stdio};
use tokio::{net, process::Command};
use super::retry_or_ignore;
use dkl::bootstrap::{Config, SSHServer};
@@ -60,7 +56,7 @@ async fn handle_ssh_connections(listener: net::TcpListener, cfg: SSHServer) {
}
for opt in &options {
sshd_args.extend(["-o", &opt]);
sshd_args.extend(["-o", opt]);
}
let mut keygen_done = false;
+1 -1
View File
@@ -3,7 +3,7 @@ use crate::input;
pub async fn run() {
tokio::spawn(async {
// give a bit of time for stdout
use tokio::time::{sleep, Duration};
use tokio::time::{Duration, sleep};
sleep(Duration::from_millis(200)).await;
if let Err(e) = input::forward_requests_from_socket().await {
+9 -8
View File
@@ -1,10 +1,9 @@
use std::io::Write;
use std::sync::{LazyLock, Mutex};
use std::time::SystemTime;
use tokio::sync::watch;
use tokio::task::JoinSet;
use tokio::{io::AsyncWriteExt, sync::watch, task::JoinSet};
pub static LOG: LazyLock<Log> = LazyLock::new(Log::new);
pub static LOG: LazyLock<Log> = LazyLock::new(Log::default);
pub fn init() {
log::set_logger(&*LOG).expect("set_logger should not fail");
@@ -19,8 +18,8 @@ pub struct Log {
tasks: Mutex<Option<JoinSet<()>>>,
}
impl Log {
pub fn new() -> Self {
impl Default for Log {
fn default() -> Self {
let (tx, rx) = watch::channel(0);
Self {
start: SystemTime::now(),
@@ -30,7 +29,9 @@ impl Log {
tasks: Mutex::new(Some(JoinSet::new())),
}
}
}
impl Log {
pub fn spawn(&self, task: impl Future<Output = ()> + Send + 'static) {
if let Some(tasks) = self.tasks.lock().unwrap().as_mut() {
tasks.spawn(task);
@@ -47,7 +48,6 @@ impl Log {
pub async fn copy_to<W: tokio::io::AsyncWrite + Unpin>(&self, mut out: W) {
let mut log = self.subscribe();
use tokio::io::AsyncWriteExt;
while let Some(chunk) = log.next().await {
let _ = out.write_all(&chunk).await;
let _ = out.flush().await;
@@ -56,7 +56,8 @@ impl Log {
pub async fn close(&self) {
self.tx.lock().unwrap().take();
if let Some(tasks) = self.tasks.lock().unwrap().take() {
let tasks = self.tasks.lock().unwrap().take();
if let Some(tasks) = tasks {
tasks.join_all().await;
}
}
@@ -115,7 +116,7 @@ pub struct LogWatch<'t> {
impl<'t> LogWatch<'t> {
pub async fn next(&mut self) -> Option<Vec<u8>> {
loop {
let new_pos = self.rx.borrow_and_update().clone();
let new_pos = *self.rx.borrow_and_update();
if new_pos <= self.pos {
if self.rx.changed().await.is_err() {
return None; // finished
+9 -8
View File
@@ -14,7 +14,7 @@ pub async fn read_password(prompt: impl Display) -> String {
}
fn choice_char(s: &str) -> char {
s.chars().skip_while(|c| *c != '[').skip(1).next().unwrap()
s.chars().skip_while(|c| *c != '[').nth(1).unwrap()
}
#[test]
@@ -51,7 +51,7 @@ pub async fn read_choice<const N: usize>(choices: [&str; N]) -> char {
loop {
let line = read_line(&prompt).await;
let Some(ch) = line.chars().nth(0) else {
let Some(ch) = line.chars().next() else {
continue;
};
@@ -70,8 +70,9 @@ pub struct InputRequest {
}
pub type Reply = Arc<Mutex<Option<oneshot::Sender<String>>>>;
type RequestSender = watch::Sender<Option<(InputRequest, Reply)>>;
static REQ: LazyLock<Mutex<watch::Sender<Option<(InputRequest, Reply)>>>> = LazyLock::new(|| {
static REQ: LazyLock<Mutex<RequestSender>> = LazyLock::new(|| {
let (tx, _) = watch::channel(None);
Mutex::new(tx)
});
@@ -117,7 +118,7 @@ pub async fn answer_requests_from_stdin() {
if req.hide {
match termios::Termios::from_fd(0) {
Ok(mut tio) => {
saved_termios = Some(tio.clone());
saved_termios = Some(tio);
tio.c_lflag &= !termios::ECHO;
if let Err(e) = termios::tcsetattr(0, termios::TCSAFLUSH, &tio) {
warn!("password may be echoed! {e}");
@@ -160,10 +161,10 @@ pub async fn answer_requests_from_stdin() {
);
// restore term if input was hidden
if let Some(tio) = saved_termios {
if let Err(e) = termios::tcsetattr(0, termios::TCSAFLUSH, &tio) {
warn!("failed to restore pty attrs: {e}");
}
if let Some(tio) = saved_termios
&& let Err(e) = termios::tcsetattr(0, termios::TCSAFLUSH, &tio)
{
warn!("failed to restore pty attrs: {e}");
}
}
}
+3 -3
View File
@@ -1,4 +1,4 @@
use eyre::{Result, format_err};
use eyre::{format_err, Result};
use tokio::process::Command;
#[derive(Debug, serde::Deserialize, serde::Serialize)]
@@ -55,7 +55,7 @@ pub struct LV {
impl LV {
pub fn equal_name(&self, vg_name: &str, lv_name: &str) -> bool {
vg_name == &self.vg_name && lv_name == &self.lv_name
vg_name == self.vg_name && lv_name == self.lv_name
}
}
@@ -90,7 +90,7 @@ async fn report_cmd<T>(cmd: &str, find: fn(ReportObj) -> Option<Vec<T>>) -> Resu
.await?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr.trim_ascii());
let stderr = String::from_utf8_lossy(output.stderr.trim_ascii());
return Err(format_err!("{cmd} failed: {}", stderr));
}
+15 -15
View File
@@ -1,6 +1,8 @@
use eyre::Result;
use log::warn;
use dkl::bootstrap::UdevFilter;
pub struct Device {
sysname: String,
output: String,
@@ -41,7 +43,7 @@ pub fn get_devices(class: &str) -> Result<Vec<Device>> {
let path = path.to_string_lossy();
let output = std::process::Command::new("udevadm")
.args(&["info", &format!("--path={path}")])
.args(["info", &format!("--path={path}")])
.stderr(std::process::Stdio::piped())
.output()?;
@@ -102,10 +104,7 @@ pub struct Devs {
impl<'t> Devs {
pub fn iter(&'t self) -> impl Iterator<Item = Dev<'t>> {
self.data
.split("\n\n")
.filter(|s| !s.is_empty())
.map(|s| Dev(s))
self.data.split("\n\n").filter(|s| !s.is_empty()).map(Dev)
}
pub fn of_subsystem(&'t self, subsystem: &str) -> impl Iterator<Item = Dev<'t>> {
@@ -174,7 +173,7 @@ pub enum Filter {
False,
}
impl<'t> Filter {
impl Filter {
pub fn matches(&self, dev: &Dev) -> bool {
match self {
Self::False => false,
@@ -190,21 +189,22 @@ impl<'t> Filter {
}
}
impl<'t> Into<Filter> for dkl::bootstrap::UdevFilter {
fn into(self) -> Filter {
match self {
Self::Has(p) => Filter::Has(p),
Self::Eq(p, v) => Filter::Eq(p, v),
Self::Glob(p, pattern) => match glob::Pattern::new(&pattern) {
impl From<UdevFilter> for Filter {
fn from(filter: UdevFilter) -> Filter {
use UdevFilter::*;
match filter {
Has(p) => Filter::Has(p),
Eq(p, v) => Filter::Eq(p, v),
Glob(p, pattern) => match glob::Pattern::new(&pattern) {
Ok(pattern) => Filter::Glob(p, pattern),
Err(e) => {
warn!("pattern {pattern:?} will never match: {e}");
Filter::False
}
},
Self::And(ops) => Filter::And(ops.into_iter().map(Self::into).collect()),
Self::Or(ops) => Filter::Or(ops.into_iter().map(Self::into).collect()),
Self::Not(op) => Filter::Not(Box::new((*op).into())),
And(ops) => Filter::And(ops.into_iter().map(|op| op.into()).collect()),
Or(ops) => Filter::Or(ops.into_iter().map(|op| op.into()).collect()),
Not(op) => Filter::Not(Box::new((*op).into())),
}
}
}
+3 -3
View File
@@ -11,7 +11,7 @@ static CMDLINE: LazyLock<String> = LazyLock::new(|| {
.unwrap_or_default()
});
fn cmdline() -> impl Iterator<Item = &'static str> {
pub fn cmdline() -> impl Iterator<Item = &'static str> {
CMDLINE.split_ascii_whitespace()
}
@@ -66,7 +66,7 @@ impl NameAliases {
pub fn select_n_by_regex<'t>(
n: i16,
regexs: &Vec<String>,
regexs: &[String],
nas: impl Iterator<Item = &'t NameAliases>,
) -> Vec<String> {
// compile regexs
@@ -91,7 +91,7 @@ pub fn select_n_by_regex<'t>(
}
}
pub async fn select_n_by_udev<'t>(
pub async fn select_n_by_udev(
n: i16,
subsystem: &str,
result_property: &str,
+2 -2
View File
@@ -95,8 +95,8 @@ lvm:
#- dev: /dev/storage/bootstrap
#- dev: /dev/storage/dls
signer_public_key: 'MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBe6Y3zGQUIHvVXoS5GI8irY8yoB0ozFpzn/cUykA46TkHdJ8xCEaaM1MpqMrfWgDtP/rA2KeE9HjVerLnEFD01uUAUh4/OYgCBDYJPhridVDoC78KOJpkWBj7Shl0Rp0AtETvatNPa1RRe15V7nDF/Nm75Y6O3IL29lYPQ6jqEGhR810='
signer_public_key: 'MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAd5sR4NqLtjSt8ESNlYWvuufYj7v+aYGDlgxQThcKbzDPVe639IfH94hHE0l9TAfyU94qtN/GpFyKJ68F/u2pu70A/umT1m24ELFDqXlQXqhTsH91r+nYUZ7due3EqSrvru/yjchNNRkpoCCu3QkDF25KnrYfWWHqj9ZIRlBTCJE9SwM='
bootstrap:
dev: /dev/storage/bootstrap
seed: https://192.168.12.254:7606/public/download-set/host/m1/bootstrap.tar?set=IDZTK4AUNCYCTKF3GIEGSNZF3I7XCINCTJSOWL2JPHCJ2IAZWDECY2XCGQ5MCTJBNFIKBNCLIA3PJSN7IOH7URGXYRYZRCGF4VSW4RIAAQRE2GDEOC4RWAAAQA3DSZJZMU4TGOL4NA5G2MJ2MJXW65DTORZGC4BOORQXEAAAAAADJMFLUE
seed: http://192.168.12.254:7606/public/download-set/host/m1/bootstrap.tar?set=ICM5KUZDRAMJPMO5OWW6PSIFYF4AHMYLAQSBZVFUDNG4DQDEW6UFQQJQKMGIXPI4CFOZFVA4CXULRXCAHKX3WELVAYS246FM6SGSGHIOAQRE2GDEOC4RUAAAQA3GEZDFMUZDOMD4NA5CUOTCN5XXI43UOJQXALTUMFZAAAAAACHHUMRU