add socket impl

This commit is contained in:
Ward from fusion-voyager-3 2024-08-24 09:15:08 +03:00
parent 1e0c5cb510
commit c8d0d75f68
8 changed files with 903 additions and 46 deletions

721
Cargo.lock generated
View File

@ -2,6 +2,21 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "1.1.2"
@ -11,6 +26,21 @@ dependencies = [
"memchr",
]
[[package]]
name = "android-tzdata"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "arc-swap"
version = "1.6.0"
@ -35,9 +65,9 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -46,6 +76,21 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
dependencies = [
"addr2line",
"cc",
"cfg-if 1.0.0",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -68,6 +113,34 @@ dependencies = [
"serde",
]
[[package]]
name = "bumpalo"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
dependencies = [
"byteorder",
"iovec",
]
[[package]]
name = "bytes"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
[[package]]
name = "cairo-rs"
version = "0.20.0"
@ -92,25 +165,75 @@ dependencies = [
"system-deps 7.0.1",
]
[[package]]
name = "cc"
version = "1.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932"
dependencies = [
"shlex",
]
[[package]]
name = "cfg-expr"
version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6100bc57b6209840798d95cb2775684849d332f7bd788db2a8c8caf7ef82a41a"
dependencies = [
"smallvec",
"smallvec 1.13.1",
"target-lexicon",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-targets",
]
[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
"crossbeam-utils 0.8.19",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
@ -118,7 +241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
"crossbeam-utils 0.8.19",
]
[[package]]
@ -127,7 +250,18 @@ version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
"crossbeam-utils 0.8.19",
]
[[package]]
name = "crossbeam-utils"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
"autocfg",
"cfg-if 0.1.10",
"lazy_static",
]
[[package]]
@ -191,9 +325,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
dependencies = [
"memoffset",
"rustc_version",
"rustc_version 0.4.0",
]
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
dependencies = [
"bitflags 1.3.2",
"fuchsia-zircon-sys",
]
[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
[[package]]
name = "futures-channel"
version = "0.3.30"
@ -349,6 +511,12 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "gimli"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
[[package]]
name = "gio"
version = "0.18.4"
@ -364,7 +532,7 @@ dependencies = [
"libc",
"once_cell",
"pin-project-lite",
"smallvec",
"smallvec 1.13.1",
"thiserror",
]
@ -382,7 +550,7 @@ dependencies = [
"glib 0.20.0",
"libc",
"pin-project-lite",
"smallvec",
"smallvec 1.13.1",
"thiserror",
]
@ -396,7 +564,7 @@ dependencies = [
"gobject-sys 0.18.0",
"libc",
"system-deps 6.2.0",
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -431,7 +599,7 @@ dependencies = [
"libc",
"memchr",
"once_cell",
"smallvec",
"smallvec 1.13.1",
"thiserror",
]
@ -453,7 +621,7 @@ dependencies = [
"gobject-sys 0.20.0",
"libc",
"memchr",
"smallvec",
"smallvec 1.13.1",
"thiserror",
]
@ -747,6 +915,35 @@ dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "iana-time-zone"
version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]]
name = "ignore"
version = "0.4.22"
@ -789,12 +986,40 @@ version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c"
[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
"libc",
]
[[package]]
name = "itoa"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "js-sys"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -844,12 +1069,37 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "lock_api"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
dependencies = [
"scopeguard",
]
[[package]]
name = "lock_api"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "memchr"
version = "2.7.4"
@ -865,6 +1115,80 @@ dependencies = [
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
dependencies = [
"adler",
]
[[package]]
name = "mio"
version = "0.6.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
dependencies = [
"cfg-if 0.1.10",
"fuchsia-zircon",
"fuchsia-zircon-sys",
"iovec",
"kernel32-sys",
"libc",
"log",
"miow",
"net2",
"slab",
"winapi 0.2.8",
]
[[package]]
name = "mio"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
dependencies = [
"hermit-abi 0.3.9",
"libc",
"wasi",
"windows-sys 0.52.0",
]
[[package]]
name = "mio-uds"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
dependencies = [
"iovec",
"libc",
"mio 0.6.23",
]
[[package]]
name = "miow"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
dependencies = [
"kernel32-sys",
"net2",
"winapi 0.2.8",
"ws2_32-sys",
]
[[package]]
name = "net2"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac"
dependencies = [
"cfg-if 0.1.10",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "normpath"
version = "1.2.0"
@ -874,6 +1198,34 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi 0.3.9",
"libc",
]
[[package]]
name = "object"
version = "0.36.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.19.0"
@ -920,11 +1272,61 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
[[package]]
name = "parking_lot"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
dependencies = [
"lock_api 0.3.4",
"parking_lot_core 0.6.3",
"rustc_version 0.2.3",
]
[[package]]
name = "parking_lot"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api 0.4.12",
"parking_lot_core 0.9.10",
]
[[package]]
name = "parking_lot_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a"
dependencies = [
"cfg-if 0.1.10",
"cloudabi",
"libc",
"redox_syscall 0.1.57",
"rustc_version 0.2.3",
"smallvec 0.6.14",
"winapi 0.3.9",
]
[[package]]
name = "parking_lot_core"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall 0.5.3",
"smallvec 1.13.1",
"windows-targets",
]
[[package]]
name = "pika-installer-gtk4"
version = "1.0.2"
dependencies = [
"async-channel",
"chrono",
"duct",
"glob",
"gnome-desktop",
@ -938,6 +1340,8 @@ dependencies = [
"strfmt",
"sys-locale",
"time",
"tokio",
"tokio-uds",
"vte4",
]
@ -1035,6 +1439,21 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "redox_syscall"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
dependencies = [
"bitflags 2.6.0",
]
[[package]]
name = "regex"
version = "1.10.3"
@ -1075,7 +1494,7 @@ dependencies = [
"regex",
"rust-i18n-macro",
"rust-i18n-support",
"smallvec",
"smallvec 1.13.1",
]
[[package]]
@ -1115,13 +1534,28 @@ dependencies = [
"triomphe",
]
[[package]]
name = "rustc-demangle"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver 0.9.0",
]
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
"semver 1.0.21",
]
[[package]]
@ -1139,12 +1573,33 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0"
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.196"
@ -1205,7 +1660,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
dependencies = [
"libc",
"winapi",
"winapi 0.3.9",
]
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-hook-registry"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
dependencies = [
"libc",
]
[[package]]
@ -1217,12 +1687,31 @@ dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0"
dependencies = [
"maybe-uninit",
]
[[package]]
name = "smallvec"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "socket2"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
@ -1335,6 +1824,114 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "tokio"
version = "1.39.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
dependencies = [
"backtrace",
"bytes 1.7.1",
"libc",
"mio 1.0.2",
"parking_lot 0.12.3",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"windows-sys 0.52.0",
]
[[package]]
name = "tokio-codec"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b"
dependencies = [
"bytes 0.4.12",
"futures",
"tokio-io",
]
[[package]]
name = "tokio-executor"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671"
dependencies = [
"crossbeam-utils 0.7.2",
"futures",
]
[[package]]
name = "tokio-io"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
dependencies = [
"bytes 0.4.12",
"futures",
"log",
]
[[package]]
name = "tokio-macros"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.72",
]
[[package]]
name = "tokio-reactor"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351"
dependencies = [
"crossbeam-utils 0.7.2",
"futures",
"lazy_static",
"log",
"mio 0.6.23",
"num_cpus",
"parking_lot 0.9.0",
"slab",
"tokio-executor",
"tokio-io",
"tokio-sync",
]
[[package]]
name = "tokio-sync"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee"
dependencies = [
"fnv",
"futures",
]
[[package]]
name = "tokio-uds"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0"
dependencies = [
"bytes 0.4.12",
"futures",
"iovec",
"libc",
"log",
"mio 0.6.23",
"mio-uds",
"tokio-codec",
"tokio-io",
"tokio-reactor",
]
[[package]]
name = "toml"
version = "0.7.8"
@ -1489,6 +2086,73 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if 1.0.0",
"once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.72",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.72",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -1499,6 +2163,12 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@ -1511,7 +2181,7 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
"winapi 0.3.9",
]
[[package]]
@ -1520,6 +2190,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
@ -1611,6 +2290,16 @@ dependencies = [
"memchr",
]
[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "yaml-rust"
version = "0.4.5"

View File

@ -21,3 +21,6 @@ rust-i18n = "3.0.1"
sys-locale = "0.3.1"
strfmt = "0.2.4"
os_pipe = "1.2.1"
chrono = "0.4.38"
tokio = { version = "1", features = ["full"] }
tokio-uds = "0.2"

View File

@ -185,6 +185,7 @@ pub fn build_ui(app: &adw::Application) {
&language_changed_action,
&page_done_action,
installation_log_loop_sender,
installation_log_status_loop_sender,
&language_selection_text_refcell,
&keymap_selection_text_refcell,
&timezone_selection_text_refcell,

View File

@ -8,3 +8,4 @@ pub const DISTRO_ICON: &str = "pika-logo";
pub const MINIMUM_EFI_BYTE_SIZE: f64 = 500000000.0;
pub const MINIMUM_BOOT_BYTE_SIZE: f64 = 1000000000.0;
pub const MINIMUM_ROOT_BYTE_SIZE: f64 = 39000000000.0;
pub const LOG_FILE_PATH: &str = "/tmp/pika-installer-gtk4.log";

View File

@ -3,12 +3,13 @@ use crate::{
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, DISTRO_ICON},
installer_stack_page,
installation_progress_page,
unix_socket_tools
};
use adw::prelude::*;
use glib::{clone, closure_local, GString};
use gtk::{gio, glib};
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc};
use std::{cell::RefCell, fs, ops::Deref, path::Path, process::Command, rc::Rc, thread};
use tokio::runtime::Runtime;
/// DEBUG
use std::io::{self, Write};
use duct::cmd;
@ -19,6 +20,16 @@ pub fn installation_progress_page(
language_changed_action: &gio::SimpleAction,
installation_log_loop_receiver: async_channel::Receiver<String>,
) {
let (socket_status_sender, socket_status_receiver) = async_channel::unbounded();
let socket_status_sender: async_channel::Sender<String> = socket_status_sender.clone();
thread::spawn(move || {
Runtime::new().unwrap().block_on(unix_socket_tools::start_socket_server(
socket_status_sender,
"/tmp/pikainstall-status.sock",
));
});
let installation_progress_box = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
@ -151,6 +162,76 @@ pub fn installation_progress_page(
//
let socket_status_context = glib::MainContext::default();
// The main loop executes the asynchronous block
socket_status_context.spawn_local(clone!(
#[weak]
installation_progress_bar,
#[strong]
socket_status_receiver,
async move {
while let Ok(state) = socket_status_receiver.recv().await {
match state.as_str() {
"PARTING" => {
installation_progress_bar.set_fraction(0.15);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"IMAGE" => {
installation_progress_bar.set_fraction(0.50);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_image")));
}
"FLAG" => {
installation_progress_bar.set_fraction(0.55);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_flag")));
}
"BIND" => {
installation_progress_bar.set_fraction(0.65);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"ARCH_COPY" => {
installation_progress_bar.set_fraction(0.85);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"ENCRYPTION" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"SWAP" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"UNBIND" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"GEN_FSTAB" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"LOCALE" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"BOOTLOADER" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"LIVE_REMOVE" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
"BASIC_USER" => {
installation_progress_bar.set_fraction(0.20);
installation_progress_bar.set_text(Some(&t!("installation_progress_bar_text_parting")));
}
_ => {}
}
}
}
));
//
language_changed_action.connect_activate(clone!(
#[weak]
progress_log_button,

View File

@ -1,6 +1,6 @@
use crate::{
build_ui::{BlockDevice, CrypttabEntry, FstabEntry, PikaKeymap, PikaLocale},
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE},
config::{MINIMUM_BOOT_BYTE_SIZE, MINIMUM_EFI_BYTE_SIZE, LOG_FILE_PATH},
installer_stack_page,
installation_progress_page,
};
@ -21,29 +21,44 @@ use std::{
};
/// DEBUG END
const GAMEUTILS_INSTALL_PROG: &str = r###"
#! /bin/bash
let i=0
while true
do
sleep 1
echo $i
let i++
done
"###;
fn gameutils_install(
log_loop_sender: async_channel::Sender<String>,
fn run_install_process(
sender: async_channel::Sender<String>,
preq: &str,
log_file_path: &str,
) -> Result<(), std::boxed::Box<dyn Error + Send + Sync>> {
if !Path::new(&log_file_path).exists() {
match fs::File::create(&log_file_path) {
Ok(_) => {}
Err(_) => {
eprintln!("Warning: {} file couldn't be created", log_file_path);
}
};
}
let (pipe_reader, pipe_writer) = os_pipe::pipe()?;
let child = cmd!("bash", "-c", GAMEUTILS_INSTALL_PROG)
let child = cmd!("sudo", "bash", "-c", preq)
.stderr_to_stdout()
.stdout_file(pipe_writer)
.start()?;
for line in BufReader::new(pipe_reader).lines() {
log_loop_sender
.send_blocking(line?)
.expect("Channel needs to be opened.")
let line = line?;
let line_clone0 = line.clone();
sender
.send_blocking(line)
.expect("Channel needs to be opened.");
let mut log_file = fs::OpenOptions::new()
.write(true)
.append(true)
.open(&log_file_path)
.unwrap();
if let Err(e) = writeln!(
log_file,
"[{}] {}",
chrono::offset::Local::now().format("%Y/%m/%d_%H:%M"),
line_clone0
) {
eprintln!("Couldn't write to file: {}", e);
}
}
child.wait()?;
@ -55,6 +70,7 @@ pub fn installation_summary_page(
language_changed_action: &gio::SimpleAction,
page_done_action: &gio::SimpleAction,
installation_log_loop_sender: async_channel::Sender<String>,
installation_log_status_loop_sender: async_channel::Sender<bool>,
language_selection_text_refcell: &Rc<RefCell<PikaLocale>>,
keymap_selection_text_refcell: &Rc<RefCell<PikaKeymap>>,
timezone_selection_text_refcell: &Rc<RefCell<String>>,
@ -113,16 +129,16 @@ pub fn installation_summary_page(
installation_summary_page.set_child_widget(&content_box);
thread::spawn(|| {
gameutils_install(installation_log_loop_sender);
});
//
install_confirm_button.connect_clicked(clone!(
#[weak]
main_carousel,
#[strong]
installation_log_loop_sender,
#[strong]
installation_log_status_loop_sender,
#[strong]
language_selection_text_refcell,
#[strong]
keymap_selection_text_refcell,
@ -150,7 +166,6 @@ pub fn installation_summary_page(
partition_method_manual_crypttab_entry_array_refcell,
move |_|
{
std::io::stdout().flush().unwrap();
let cmd = script_gen::create_installation_script(
&language_selection_text_refcell,
&keymap_selection_text_refcell,
@ -165,11 +180,17 @@ pub fn installation_summary_page(
&partition_method_manual_fstab_entry_array_refcell,
&partition_method_manual_luks_enabled_refcell,
&partition_method_manual_crypttab_entry_array_refcell,);
println!("{}", cmd);
let big_cmd = cmd!("sudo", "bash", "-c",
cmd
);
//assert!(big_cmd.run().is_ok());
let installation_log_loop_sender_clone0 = installation_log_loop_sender.clone();
let installation_log_status_loop_sender_clone0 = installation_log_status_loop_sender.clone();
thread::spawn(move || {
if Path::new(LOG_FILE_PATH).exists() {
fs::remove_file(LOG_FILE_PATH).expect("bad perms on log file");
}
match run_install_process(installation_log_loop_sender_clone0, &cmd, LOG_FILE_PATH) {
Ok(_) => installation_log_status_loop_sender_clone0.send_blocking(true).expect("channel needs to be open"),
Err(_) => installation_log_status_loop_sender_clone0.send_blocking(false).expect("channel needs to be open")
}
});
main_carousel.scroll_to(&main_carousel.nth_page(7), true);
}
)

View File

@ -3,6 +3,7 @@ use gtk::{gdk, glib, prelude::*, CssProvider, STYLE_PROVIDER_PRIORITY_APPLICATIO
use std::env;
mod build_ui;
mod config;
mod unix_socket_tools;
//
mod drive_mount_row;
mod installer_stack_page;

View File

@ -0,0 +1,60 @@
use std::fs;
use std::path::Path;
use tokio::io::{AsyncReadExt};
use tokio::net::{UnixListener, UnixStream};
use tokio::task;
pub async fn handle_client(
mut stream: UnixStream,
buffer_sender: async_channel::Sender<String>,
) {
// Buffer to store incoming data
let mut buffer = [0; 1024];
// Read data from the stream
match stream.read(&mut buffer).await {
Ok(size) => {
let message = String::from_utf8_lossy(&buffer[..size]).to_string();
// Write to log file
// Send to async buffer sender
buffer_sender
.send_blocking(message)
.expect("Buffer channel closed")
}
Err(e) => {
// Print error message if reading fails
eprintln!("Failed to read from stream: {}", e);
}
}
}
pub async fn start_socket_server(
buffer_sender: async_channel::Sender<String>,
socket_path: &str,
) {
// Remove the socket file if it already exists
if Path::new(socket_path).exists() {
fs::remove_file(socket_path).expect("Could not remove existing socket file");
}
// Bind the Unix listener to the socket path
let listener = UnixListener::bind(socket_path).expect("Could not bind");
println!("Server listening on {}", socket_path);
// Loop to accept incoming connections
loop {
// Accept an incoming connection
match listener.accept().await {
Ok((stream, _)) => {
// Handle the connection in a separate task
task::spawn(handle_client(stream, buffer_sender.clone()));
}
Err(e) => {
// Print error message if a connection fails
eprintln!("Connection failed: {}", e);
}
}
}
}