feat: add dev packages"

This commit is contained in:
Kasper Juul Hermansen 2025-01-10 21:40:12 +01:00
parent 22a0d5a22b
commit 0458a8228f
Signed by: kjuulh
SSH Key Fingerprint: SHA256:RjXh0p7U6opxnfd3ga/Y9TCo18FYlHFdSpRIV72S/QM
6 changed files with 444 additions and 42 deletions

View File

@ -8,6 +8,13 @@ interface process {
}
}
interface http {
resource client {
constructor();
get: func(url: string) -> list<u8>;
}
}
interface task {
id: func() -> string;
should-run: func() -> bool;
@ -15,6 +22,7 @@ interface task {
}
world churn {
export task;
export process;
export http;
export task;
}

246
dev-packages/Cargo.lock generated
View File

@ -2,6 +2,18 @@
# It is not intended for manual editing.
version = 4
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "anyhow"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
[[package]]
name = "bitflags"
version = "2.6.0"
@ -14,12 +26,25 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "crc32fast"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [
"cfg-if",
]
[[package]]
name = "dev-packages"
version = "0.1.0"
dependencies = [
"anyhow",
"dirs",
"flate2",
"minijinja",
"tar",
"tempfile",
"wit-bindgen-rt",
]
@ -41,7 +66,45 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
name = "errno"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
"windows-sys 0.59.0",
]
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "filetime"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
dependencies = [
"cfg-if",
"libc",
"libredox",
"windows-sys 0.59.0",
]
[[package]]
name = "flate2"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c"
dependencies = [
"crc32fast",
"miniz_oxide",
]
[[package]]
@ -57,9 +120,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.167"
version = "0.2.169"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]]
name = "libredox"
@ -69,8 +132,15 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "minijinja"
version = "2.5.0"
@ -80,6 +150,21 @@ dependencies = [
"serde",
]
[[package]]
name = "miniz_oxide"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394"
dependencies = [
"adler2",
]
[[package]]
name = "once_cell"
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "option-ext"
version = "0.2.0"
@ -97,13 +182,22 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.37"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_users"
version = "0.4.6"
@ -115,6 +209,19 @@ dependencies = [
"thiserror",
]
[[package]]
name = "rustix"
version = "0.38.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.59.0",
]
[[package]]
name = "serde"
version = "1.0.217"
@ -137,15 +244,40 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.90"
version = "2.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tar"
version = "0.4.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]]
name = "tempfile"
version = "3.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704"
dependencies = [
"cfg-if",
"fastrand",
"getrandom",
"once_cell",
"rustix",
"windows-sys 0.59.0",
]
[[package]]
name = "thiserror"
version = "1.0.69"
@ -184,7 +316,16 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
@ -193,13 +334,29 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
[[package]]
@ -208,42 +365,90 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "wit-bindgen-rt"
version = "0.36.0"
@ -252,3 +457,14 @@ checksum = "7947d0131c7c9da3f01dfde0ab8bd4c4cf3c5bd49b6dba0ae640f1fa752572ea"
dependencies = [
"bitflags",
]
[[package]]
name = "xattr"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e105d177a3871454f754b33bb0ee637ecaaac997446375fd3e5d43a2ed00c909"
dependencies = [
"libc",
"linux-raw-sys",
"rustix",
]

View File

@ -4,8 +4,12 @@ version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = { version = "1.0.95" }
dirs = "5.0.1"
flate2 = "1.0.35"
minijinja = "2.5.0"
tar = "0.4.43"
tempfile = "3.15.0"
wit-bindgen-rt = { version = "0.36.0", features = ["bitflags"] }
[lib]

View File

@ -1,6 +1,9 @@
#[allow(dead_code)]
// Generated by `wit-bindgen` 0.36.0. DO NOT EDIT!
// Options used:
// * runtime_path: "wit_bindgen_rt"
#[rustfmt::skip]
#[allow(dead_code, clippy::all)]
pub mod component {
#[allow(dead_code)]
pub mod churn_tasks {
#[allow(dead_code, clippy::all)]
pub mod process {
@ -162,13 +165,106 @@ pub mod component {
}
}
}
#[allow(dead_code, clippy::all)]
pub mod http {
#[used]
#[doc(hidden)]
static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
use super::super::super::_rt;
#[derive(Debug)]
#[repr(transparent)]
pub struct Client {
handle: _rt::Resource<Client>,
}
impl Client {
#[doc(hidden)]
pub unsafe fn from_handle(handle: u32) -> Self {
Self {
handle: _rt::Resource::from_handle(handle),
}
}
#[doc(hidden)]
pub fn take_handle(&self) -> u32 {
_rt::Resource::take_handle(&self.handle)
}
#[doc(hidden)]
pub fn handle(&self) -> u32 {
_rt::Resource::handle(&self.handle)
}
}
unsafe impl _rt::WasmResource for Client {
#[inline]
unsafe fn drop(_handle: u32) {
#[cfg(not(target_arch = "wasm32"))]
unreachable!();
#[cfg(target_arch = "wasm32")]
{
#[link(wasm_import_module = "component:churn-tasks/http@0.1.0")]
extern "C" {
#[link_name = "[resource-drop]client"]
fn drop(_: u32);
}
drop(_handle);
}
}
}
impl Client {
#[allow(unused_unsafe, clippy::all)]
pub fn new() -> Self {
unsafe {
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:churn-tasks/http@0.1.0")]
extern "C" {
#[link_name = "[constructor]client"]
fn wit_import() -> i32;
}
#[cfg(not(target_arch = "wasm32"))]
fn wit_import() -> i32 {
unreachable!()
}
let ret = wit_import();
Client::from_handle(ret as u32)
}
}
}
impl Client {
#[allow(unused_unsafe, clippy::all)]
pub fn get(&self, url: &str) -> _rt::Vec<u8> {
unsafe {
#[repr(align(4))]
struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
let mut ret_area = RetArea(
[::core::mem::MaybeUninit::uninit(); 8],
);
let vec0 = url;
let ptr0 = vec0.as_ptr().cast::<u8>();
let len0 = vec0.len();
let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
#[cfg(target_arch = "wasm32")]
#[link(wasm_import_module = "component:churn-tasks/http@0.1.0")]
extern "C" {
#[link_name = "[method]client.get"]
fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8);
}
#[cfg(not(target_arch = "wasm32"))]
fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) {
unreachable!()
}
wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
let l2 = *ptr1.add(0).cast::<*mut u8>();
let l3 = *ptr1.add(4).cast::<usize>();
let len4 = l3;
_rt::Vec::from_raw_parts(l2.cast(), len4, len4)
}
}
}
}
}
}
#[allow(dead_code)]
#[rustfmt::skip]
#[allow(dead_code, clippy::all)]
pub mod exports {
#[allow(dead_code)]
pub mod component {
#[allow(dead_code)]
pub mod churn_tasks {
#[allow(dead_code, clippy::all)]
pub mod task {
@ -247,6 +343,7 @@ pub mod exports {
}
}
}
#[rustfmt::skip]
mod _rt {
use core::fmt;
use core::marker;
@ -376,19 +473,22 @@ macro_rules! __export_dev_packages_impl {
#[doc(inline)]
pub(crate) use __export_dev_packages_impl as export;
#[cfg(target_arch = "wasm32")]
#[link_section = "component-type:wit-bindgen:0.35.0:component:dev-packages:dev-packages:encoded world"]
#[link_section = "component-type:wit-bindgen:0.36.0:component:dev-packages:dev-packages:encoded world"]
#[doc(hidden)]
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 460] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xc9\x02\x01A\x02\x01\
A\x04\x01B\x0a\x04\0\x07process\x03\x01\x01i\0\x01@\0\0\x01\x04\0\x14[constructo\
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 588] = *b"\
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xc9\x03\x01A\x02\x01\
A\x06\x01B\x0a\x04\0\x07process\x03\x01\x01i\0\x01@\0\0\x01\x04\0\x14[constructo\
r]process\x01\x02\x01h\0\x01ps\x01@\x02\x04self\x03\x06inputs\x04\0s\x04\0\x1b[m\
ethod]process.run-process\x01\x05\x01@\x02\x04self\x03\x03keys\0s\x04\0\x1c[meth\
od]process.get-variable\x01\x06\x03\0#component:churn-tasks/process@0.1.0\x05\0\x01\
B\x06\x01@\0\0s\x04\0\x02id\x01\0\x01@\0\0\x7f\x04\0\x0ashould-run\x01\x01\x01@\0\
\x01\0\x04\0\x07execute\x01\x02\x04\0\x20component:churn-tasks/task@0.1.0\x05\x01\
\x04\0#component:dev-packages/dev-packages\x04\0\x0b\x12\x01\0\x0cdev-packages\x03\
\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-\
bindgen-rust\x060.35.0";
B\x08\x04\0\x06client\x03\x01\x01i\0\x01@\0\0\x01\x04\0\x13[constructor]client\x01\
\x02\x01h\0\x01p}\x01@\x02\x04self\x03\x03urls\0\x04\x04\0\x12[method]client.get\
\x01\x05\x03\0\x20component:churn-tasks/http@0.1.0\x05\x01\x01B\x06\x01@\0\0s\x04\
\0\x02id\x01\0\x01@\0\0\x7f\x04\0\x0ashould-run\x01\x01\x01@\0\x01\0\x04\0\x07ex\
ecute\x01\x02\x04\0\x20component:churn-tasks/task@0.1.0\x05\x02\x04\0#component:\
dev-packages/dev-packages\x04\0\x0b\x12\x01\0\x0cdev-packages\x03\0\0\0G\x09prod\
ucers\x01\x0cprocessed-by\x02\x0dwit-component\x070.220.0\x10wit-bindgen-rust\x06\
0.36.0";
#[inline(never)]
#[doc(hidden)]
pub fn __link_custom_section_describing_imports() {

View File

@ -1,9 +1,17 @@
use std::io::{Read, Write};
use bindings::{
component::churn_tasks::process::Process, exports::component::churn_tasks::task::Guest,
use std::{
fs::{self},
io::{Cursor, Write},
path::PathBuf,
};
use anyhow::Context;
use bindings::{
component::churn_tasks::{http, process::Process},
exports::component::churn_tasks::task::Guest,
};
use flate2::bufread::GzDecoder;
use tar::Archive;
#[allow(warnings)]
mod bindings;
@ -29,6 +37,10 @@ impl Guest for Component {
}
}
if !std::path::PathBuf::from("/usr/local/bin/zellij").exists() {
return true;
};
false
}
fn execute() {
@ -45,11 +57,13 @@ impl Guest for Component {
.collect::<Vec<_>>(),
);
println!("downloaded starship");
if !std::path::PathBuf::from("/root/.bashrc").exists() {
println!("appending to bashrc");
if let Ok(content) = std::fs::read_to_string("/root/.bashrc") {
if !content.contains("starship") {
let mut bashrc = std::fs::File::options()
.append(true)
.write(true)
.open("/root/.bashrc")
.expect("failed to open bash");
@ -59,18 +73,77 @@ impl Guest for Component {
}
}
} else {
let mut bashrc = std::fs::File::options()
.write(true)
.create(true)
.truncate(true)
.open("/root/.bashrc")
.expect("failed to open bash");
let mut bashrc = std::fs::File::create("/root/.bashrc").expect("failed to open bash");
bashrc
.write_all(r#"eval "$(starship init bash)""#.as_bytes())
.expect("failed to write to bashrc file");
}
println!("installing zellij");
if !PathBuf::from("/usr/local/bin/zellij").exists() {
if let Err(err) = install_zellij() {
panic!("failed to install zellij: {}", err);
}
}
}
}
fn install_zellij() -> anyhow::Result<()> {
let url = "https://github.com/zellij-org/zellij/releases/download/v0.41.2/zellij-x86_64-unknown-linux-musl.tar.gz";
// TODO: Until this is merged: https://github.com/bytecodealliance/wasmtime/pull/9582 we just spawn a runtime
println!("getting zellij");
let content = http::Client::new().get(url);
println!("creating tempdir");
let temp_dir = PathBuf::from("/tmp/zellij_install/");
if let Err(e) = std::fs::remove_dir_all(&temp_dir) {
println!("failed to remove tmp dir: {e}");
}
std::fs::create_dir_all(&temp_dir).context("creating tmp dir")?;
let mut zellij_archive = std::fs::File::create(temp_dir.join("zellij.tar.gz"))?;
zellij_archive.write_all(&content)?;
zellij_archive.flush()?;
Process::new().run_process(
&[
"tar",
"-xvf",
&temp_dir.join("zellij.tar.gz").display().to_string(),
"-C",
&temp_dir.display().to_string(),
]
.into_iter()
.map(|i| i.to_string())
.collect::<Vec<_>>(),
);
// Move binary to /usr/local/bin
println!("move binary");
let binary_path = temp_dir.join("zellij");
fs::File::create("/usr/local/bin/zellij")?;
fs::copy(&binary_path, "/usr/local/bin/zellij")?;
Process::new().run_process(
&["chmod", "+x", "/usr/local/bin/zellij"]
.into_iter()
.map(|i| i.to_string())
.collect::<Vec<_>>(),
);
// Set executable permissions using std::fs::Permissions
#[cfg(unix)]
{
//use std::os::unix::fs::PermissionsExt;
//let mut perms = fs::metadata("/usr/local/bin/zellij")?.permissions();
//perms.set_mode(0o755);
//fs::set_permissions("/usr/local/bin/zellij", perms)
// .context("Failed to set executable permissions")?;
}
Ok(())
}
bindings::export!(Component with_types_in bindings);

View File

@ -3,5 +3,6 @@ package component:dev-packages;
/// An example world for the component to target.
world dev-packages {
import component:churn-tasks/process@0.1.0;
import component:churn-tasks/http@0.1.0;
export component:churn-tasks/task@0.1.0;
}