diff --git a/backend/src/manager/js_api.rs b/backend/src/manager/js_api.rs index 8f26f2d50..74e030242 100644 --- a/backend/src/manager/js_api.rs +++ b/backend/src/manager/js_api.rs @@ -12,6 +12,7 @@ use sqlx::Acquire; use crate::{ config::hook::ConfigHook, manager::{start_stop::StartStop, Manager}, + net::keys::Key, }; use super::try_get_running_ip; diff --git a/backend/src/net/ssl.rs b/backend/src/net/ssl.rs index fd052f18e..19c1a2c87 100644 --- a/backend/src/net/ssl.rs +++ b/backend/src/net/ssl.rs @@ -20,6 +20,7 @@ use crate::account::AccountInfo; use crate::hostname::Hostname; use crate::net::dhcp::ips; use crate::net::keys::{Key, KeyInfo}; +use crate::s9pk::manifest::PackageId; use crate::{Error, ErrorKind, ResultExt}; static CERTIFICATE_VERSION: i32 = 2; // X509 version 3 is actually encoded as '2' in the cert because fuck you. diff --git a/backend/src/procedure/js_scripts.rs b/backend/src/procedure/js_scripts.rs index 47db70d58..66966073f 100644 --- a/backend/src/procedure/js_scripts.rs +++ b/backend/src/procedure/js_scripts.rs @@ -253,11 +253,13 @@ mod tests { &self, id: PackageId, path: &str, - callback: Callback, - ) -> Result { - println!("Adding callback"); - self.config_callbacks.send_modify(|x| x.push(callback)); - Ok(Value::Null) + callback: Option, + ) -> Result, Report> { + if let Some(callback) = callback { + println!("Adding callback"); + self.config_callbacks.send_modify(|x| x.push(callback)); + } + Ok(vec![Value::Null]) } #[allow(unused_variables)] async fn bind_local( @@ -265,7 +267,7 @@ mod tests { internal_port: u16, address_schema: AddressSchemaLocal, ) -> Result { - todo!() + unimplemented!() } #[allow(unused_variables)] async fn bind_onion( @@ -273,7 +275,27 @@ mod tests { internal_port: u16, address_schema: AddressSchemaOnion, ) -> Result { - todo!() + unimplemented!() + } + #[allow(unused_variables)] + async fn unbind_local(&self, id: InterfaceId, external: u16) -> Result<(), Report> { + unimplemented!() + } + #[allow(unused_variables)] + async fn unbind_onion(&self, id: InterfaceId, external: u16) -> Result<(), Report> { + unimplemented!() + } + fn set_started(&self) -> Result<(), Report> { + unimplemented!() + } + async fn restart(&self) -> Result<(), Report> { + unimplemented!() + } + async fn start(&self) -> Result<(), Report> { + unimplemented!() + } + async fn stop(&self) -> Result<(), Report> { + unimplemented!() } } #[tokio::test] diff --git a/backend/src/version/mod.rs b/backend/src/version/mod.rs index dbaff72ed..68276ef96 100644 --- a/backend/src/version/mod.rs +++ b/backend/src/version/mod.rs @@ -35,15 +35,7 @@ impl Version { #[cfg(test)] fn as_sem_ver(&self) -> emver::Version { match self { - Version::V0_3_0(Wrapper(x)) => x.semver(), - Version::V0_3_0_1(Wrapper(x)) => x.semver(), - Version::V0_3_0_2(Wrapper(x)) => x.semver(), - Version::V0_3_0_3(Wrapper(x)) => x.semver(), - Version::V0_3_1(Wrapper(x)) => x.semver(), - Version::V0_3_1_1(Wrapper(x)) => x.semver(), - Version::V0_3_1_2(Wrapper(x)) => x.semver(), - Version::V0_3_2(Wrapper(x)) => x.semver(), - Version::V0_3_2_1(Wrapper(x)) => x.semver(), + Version::LT0_3_3(LTWrapper(_, x)) => x.clone(), Version::V0_3_3(Wrapper(x)) => x.semver(), Version::V0_3_4(Wrapper(x)) => x.semver(), Version::Other(x) => x.clone(), @@ -195,7 +187,7 @@ where let v = crate::util::Version::deserialize(deserializer)?; let version = T::new(); if *v == version.semver() { - Ok(Wrapper(version)) + Ok(Self(version)) } else { Err(serde::de::Error::custom("Mismatched Version")) } @@ -255,15 +247,14 @@ mod tests { fn versions() -> impl Strategy { prop_oneof![ - Just(Version::V0_3_0(Wrapper(v0_3_0::Version::new()))), - Just(Version::V0_3_0_1(Wrapper(v0_3_0_1::Version::new()))), - Just(Version::V0_3_0_2(Wrapper(v0_3_0_2::Version::new()))), - Just(Version::V0_3_0_3(Wrapper(v0_3_0_3::Version::new()))), - Just(Version::V0_3_1(Wrapper(v0_3_1::Version::new()))), - Just(Version::V0_3_1_1(Wrapper(v0_3_1_1::Version::new()))), - Just(Version::V0_3_1_2(Wrapper(v0_3_1_2::Version::new()))), - Just(Version::V0_3_2(Wrapper(v0_3_2::Version::new()))), - Just(Version::V0_3_2_1(Wrapper(v0_3_2_1::Version::new()))), + em_version().prop_map(|v| if v < v0_3_3::Version::new().semver() { + Version::LT0_3_3(LTWrapper(v0_3_3::Version::new(), v)) + } else { + Version::LT0_3_3(LTWrapper( + v0_3_3::Version::new(), + emver::Version::new(0, 3, 0, 0), + )) + }), Just(Version::V0_3_3(Wrapper(v0_3_3::Version::new()))), Just(Version::V0_3_4(Wrapper(v0_3_4::Version::new()))), em_version().prop_map(Version::Other), diff --git a/build/raspberry-pi/033-upgrade.service b/build/raspberry-pi/033-upgrade.service deleted file mode 100644 index 09affcae4..000000000 --- a/build/raspberry-pi/033-upgrade.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Boot process for system initialization. -After=network-online.target systemd-time-wait-sync.service - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/033-upgrade.sh -RemainAfterExit=true -StandardOutput=append:/var/log/initialization.log - -[Install] -WantedBy=multi-user.target diff --git a/build/raspberry-pi/033-upgrade.sh b/build/raspberry-pi/033-upgrade.sh deleted file mode 100755 index cfe256167..000000000 --- a/build/raspberry-pi/033-upgrade.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -set -e - -( - while true; do - beep -r 2 -l 80 -d 20 - sleep 60 - done -) & - -if grep 'cb15ae4d-03' /boot/cmdline.txt; then - echo Transfer files across - e2fsck -f -y /dev/mmcblk0p4 - while ! resize2fs /dev/mmcblk0p4; do - e2fsck -f -y /dev/mmcblk0p4 - done - mkdir -p /media/origin - mkdir -p /media/dest - mount -r /dev/mmcblk0p3 /media/origin - mount -w /dev/mmcblk0p4 /media/dest - rsync -acvAXUH --info=progress2 --delete --force /media/origin/ /media/dest/ - umount /media/origin - umount /media/dest - rm -rf /media/origin - rm -rf /media/dest - - echo Setting up boot to use other partition - sed -i 's/PARTUUID=cb15ae4d-03/PARTUUID=cb15ae4d-04/g' /boot/cmdline.txt - sync - reboot -fi - -mkdir -p /media/root-rw -mkfs.ext4 /dev/mmcblk0p3 -mount /dev/mmcblk0p3 /media/root-rw - -mkdir -p /embassy-os -mount /dev/mmcblk0p2 /embassy-os - -mkdir -p /media/root-rw/config -mkdir -p /media/root-rw/current -mkdir -p /media/root-rw/next -rsync -acvAXUH --info=progress2 /embassy-os/ /media/root-rw/config/ -rsync -acvAXUH --info=progress2 /update/ /media/root-rw/current/ -rsync -acvAXUH --info=progress2 /media/root-rw/current/boot/ /boot/ -cp /etc/machine-id /media/root-rw/current/etc/machine-id -cp /etc/ssh/ssh_host_rsa_key /media/root-rw/current/etc/ssh/ssh_host_rsa_key -cp /etc/ssh/ssh_host_rsa_key.pub /media/root-rw/current/etc/ssh/ssh_host_rsa_key.pub -cp /etc/ssh/ssh_host_ecdsa_key /media/root-rw/current/etc/ssh/ssh_host_ecdsa_key -cp /etc/ssh/ssh_host_ecdsa_key.pub /media/root-rw/current/etc/ssh/ssh_host_ecdsa_key.pub -cp /etc/ssh/ssh_host_ed25519_key /media/root-rw/current/etc/ssh/ssh_host_ed25519_key -cp /etc/ssh/ssh_host_ed25519_key.pub /media/root-rw/current/etc/ssh/ssh_host_ed25519_key.pub - -sync - -umount /embassy-os -umount /media/root-rw - -fatlabel /dev/mmcblk0p1 boot -e2label /dev/mmcblk0p3 rootfs - -( - echo d - echo 1 - echo d - echo 2 - echo n - echo p - echo 1 - echo - echo - echo d - echo 3 - echo d - echo 4 - echo n - echo p - echo 2 - echo - echo - echo t - echo 1 - echo c - echo w -) | fdisk /dev/mmcblk0 - -reboot \ No newline at end of file diff --git a/build/raspberry-pi/make-upgrade-image.sh b/build/raspberry-pi/make-upgrade-image.sh deleted file mode 100755 index 79943e5be..000000000 --- a/build/raspberry-pi/make-upgrade-image.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -set -e - -function partition_for () { - if [[ "$1" =~ [0-9]+$ ]]; then - echo "$1p$2" - else - echo "$1$2" - fi -} - -TARGET_NAME=lite-upgrade.img -TARGET_SIZE=7000000000 - -LOOPDEV=$(sudo losetup --show -fP raspios.img) -sudo cat `partition_for ${LOOPDEV} 2` > $TARGET_NAME -sudo losetup -d $LOOPDEV -truncate -s $TARGET_SIZE $TARGET_NAME -sudo e2fsck -f -y $TARGET_NAME -sudo resize2fs $TARGET_NAME - -TMPDIR=$(mktemp -d) - -sudo mount $TARGET_NAME $TMPDIR/ - -sudo mkdir -p $TMPDIR/update -sudo unsquashfs -f -d $TMPDIR/update eos.raspberrypi.squashfs -sudo cp ./cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep $TMPDIR/usr/local/bin/beep -sudo cp ./build/raspberry-pi/033-upgrade.sh $TMPDIR/usr/local/bin/033-upgrade.sh -sudo cp ./build/raspberry-pi/033-upgrade.service $TMPDIR/etc/systemd/system/033-upgrade.service -sudo ln -s /etc/systemd/system/033-upgrade.service $TMPDIR/etc/systemd/system/multi-user.target.wants/033-upgrade.service -sudo cp ./cargo-deps/aarch64-unknown-linux-gnu/release/nc-broadcast $TMPDIR/usr/local/bin -sudo cp ./build/raspberry-pi/nc-broadcast.service $TMPDIR/etc/systemd/system/nc-broadcast.service -sudo ln -s /etc/systemd/system/nc-broadcast.service $TMPDIR/etc/systemd/system/multi-user.target.wants/nc-broadcast.service - -sudo umount $TMPDIR/ - -sudo e2fsck -f -y $TARGET_NAME -sudo resize2fs -M $TARGET_NAME -BLOCK_INFO=$(sudo dumpe2fs $TARGET_NAME) -BLOCK_COUNT=$(echo "$BLOCK_INFO" | grep "Block count:" | sed 's/Block count:\s\+//g') -BLOCK_SIZE=$(echo "$BLOCK_INFO" | grep "Block size:" | sed 's/Block size:\s\+//g') -FS_SIZE=$[$BLOCK_COUNT*$BLOCK_SIZE] -truncate -s $FS_SIZE $TARGET_NAME \ No newline at end of file diff --git a/frontend/patchdb-ui-seed.json b/frontend/patchdb-ui-seed.json index e32725588..04cdea674 100644 --- a/frontend/patchdb-ui-seed.json +++ b/frontend/patchdb-ui-seed.json @@ -1,6 +1,6 @@ { "name": null, - "ack-welcome": "0.3.4", + "ack-welcome": "0.4.0", "marketplace": { "selected-url": "https://registry.start9.com/", "known-hosts": { diff --git a/libs/helpers/src/os_api.rs b/libs/helpers/src/os_api.rs index 1ade88a34..47735332f 100644 --- a/libs/helpers/src/os_api.rs +++ b/libs/helpers/src/os_api.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use color_eyre::eyre::eyre; use color_eyre::Report; use models::InterfaceId; use models::PackageId; diff --git a/libs/js_engine/src/artifacts/loadModule.js b/libs/js_engine/src/artifacts/loadModule.js index d50ca9d66..a1193cdad 100644 --- a/libs/js_engine/src/artifacts/loadModule.js +++ b/libs/js_engine/src/artifacts/loadModule.js @@ -297,7 +297,6 @@ const effects = { runCommand, runDaemon, runRsync, - chmod, signalGroup, sleep, start, diff --git a/libs/js_engine/src/lib.rs b/libs/js_engine/src/lib.rs index 22f6c785a..2767a3b7a 100644 --- a/libs/js_engine/src/lib.rs +++ b/libs/js_engine/src/lib.rs @@ -293,7 +293,6 @@ impl JsExecutionEnvironment { fns::chmod::decl(), fns::bind_local::decl(), fns::bind_onion::decl(), - fns::chown::decl(), fns::fetch::decl(), fns::read_file::decl(), fns::metadata::decl(),