mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 05:10:55 +00:00
hack: rename scripts to hack
This commit is contained in:
parent
182401371b
commit
e3a70e5595
20
.github/workflows/check.yml
vendored
20
.github/workflows/check.yml
vendored
@ -7,16 +7,16 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/build/cargo.sh build
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/build/cargo.sh build
|
||||
test:
|
||||
name: cargo test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/build/cargo.sh test
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/build/cargo.sh test
|
||||
clippy:
|
||||
name: cargo clippy
|
||||
runs-on: ubuntu-latest
|
||||
@ -25,8 +25,8 @@ jobs:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: clippy
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/build/cargo.sh clippy
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/build/cargo.sh clippy
|
||||
fmt:
|
||||
name: cargo fmt
|
||||
runs-on: ubuntu-latest
|
||||
@ -35,8 +35,8 @@ jobs:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/build/cargo.sh fmt --all -- --check
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/build/cargo.sh fmt --all -- --check
|
||||
initrd:
|
||||
name: initrd
|
||||
runs-on: ubuntu-latest
|
||||
@ -45,5 +45,5 @@ jobs:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: "x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl"
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/initrd/build.sh
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/initrd/build.sh
|
||||
|
4
.github/workflows/kernel.yml
vendored
4
.github/workflows/kernel.yml
vendored
@ -12,5 +12,5 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/kernel/build.sh -j5
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/kernel/build.sh -j5
|
||||
|
6
.github/workflows/nightly.yml
vendored
6
.github/workflows/nightly.yml
vendored
@ -12,11 +12,11 @@ jobs:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: "x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl"
|
||||
- run: ./scripts/ci/install-deps.sh
|
||||
- run: ./scripts/dist/bundle.sh
|
||||
- run: ./hack/ci/install-deps.sh
|
||||
- run: ./hack/dist/bundle.sh
|
||||
env:
|
||||
KRATA_KERNEL_BUILD_JOBS: "5"
|
||||
- run: ./scripts/dist/deb.sh
|
||||
- run: ./hack/dist/deb.sh
|
||||
env:
|
||||
KRATA_BUNDLE_SKIP_KERNEL_BUILD: "1"
|
||||
- uses: actions/upload-artifact@v4
|
||||
|
24
README.md
24
README.md
@ -42,12 +42,12 @@ Edera is building a company to compete in the hypervisor space with open-source
|
||||
|
||||
krata is composed of three major executables:
|
||||
|
||||
| Executable | Runs On | User Interaction | Dev Runner | Code Path |
|
||||
| ---------- | ------- | ---------------- | --------------------------- | ----------- |
|
||||
| kratad | host | backend daemon | ./scripts/debug/kratad.sh | daemon |
|
||||
| kratanet | host | backend daemon | ./scripts/debug/kratanet.sh | network |
|
||||
| kratactl | host | CLI tool | ./scripts/debug/kratactl.sh | controller |
|
||||
| krataguest | guest | none, guest init | N/A | guest |
|
||||
| Executable | Runs On | User Interaction | Dev Runner | Code Path |
|
||||
| ---------- | ------- | ---------------- | ------------------------ | ----------- |
|
||||
| kratad | host | backend daemon | ./hack/debug/kratad.sh | daemon |
|
||||
| kratanet | host | backend daemon | ./hack/debug/kratanet.sh | network |
|
||||
| kratactl | host | CLI tool | ./hack/debug/kratactl.sh | controller |
|
||||
| krataguest | guest | none, guest init | N/A | guest |
|
||||
|
||||
You will find the code to each executable available in the bin/ and src/ directories inside
|
||||
it's corresponding code path from the above table.
|
||||
@ -92,26 +92,26 @@ $ cd krata
|
||||
6. Build a guest kernel image:
|
||||
|
||||
```sh
|
||||
$ ./scripts/kernel/build.sh -j4
|
||||
$ ./hack/kernel/build.sh -j4
|
||||
```
|
||||
|
||||
7. Copy the guest kernel image at `target/kernel/kernel` to `/var/lib/krata/guest/kernel` to have it automatically detected by kratad.
|
||||
8. Launch `./scripts/debug/kratanet.sh` and keep it running in the foreground.
|
||||
9. Launch `./scripts/debug/kratad.sh` and keep it running in the foreground.
|
||||
8. Launch `./hack/debug/kratanet.sh` and keep it running in the foreground.
|
||||
9. Launch `./hack/debug/kratad.sh` and keep it running in the foreground.
|
||||
10. Run kratactl to launch a guest:
|
||||
|
||||
```sh
|
||||
$ ./scripts/debug/kratactl.sh launch --attach alpine:latest
|
||||
$ ./hack/debug/kratactl.sh launch --attach alpine:latest
|
||||
```
|
||||
|
||||
To detach from the guest console, use `Ctrl + ]` on your keyboard.
|
||||
|
||||
To list the running guests, run:
|
||||
```sh
|
||||
$ ./scripts/debug/kratactl.sh list
|
||||
$ ./hack/debug/kratactl.sh list
|
||||
```
|
||||
|
||||
To destroy a running guest, copy it's UUID from either the launch command or the guest list and run:
|
||||
```sh
|
||||
$ ./scripts/debug/kratactl.sh destroy GUEST_UUID
|
||||
$ ./hack/debug/kratactl.sh destroy GUEST_UUID
|
||||
```
|
||||
|
8
hack/code/autofix.sh
Executable file
8
hack/code/autofix.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
cd "$(dirname "${REAL_SCRIPT}")/../.."
|
||||
|
||||
./hack/build/cargo.sh clippy --fix --allow-dirty --allow-staged
|
||||
cargo fmt --all
|
7
hack/code/shellcheck.sh
Executable file
7
hack/code/shellcheck.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
cd "$(dirname "${REAL_SCRIPT}")/../.."
|
||||
|
||||
find hack -type f -name '*.sh' -print0 | xargs -0 shellcheck -x
|
@ -22,10 +22,10 @@ build_and_run() {
|
||||
sudo mkdir -p /var/lib/krata/guest
|
||||
if [ "${KRATA_BUILD_INITRD}" = "1" ]
|
||||
then
|
||||
./scripts/initrd/build.sh -q
|
||||
./hack/initrd/build.sh -q
|
||||
sudo cp "target/initrd/initrd" "/var/lib/krata/guest/initrd"
|
||||
fi
|
||||
RUST_TARGET="$(./scripts/build/target.sh)"
|
||||
./scripts/build/cargo.sh build ${CARGO_BUILD_FLAGS} --bin "${EXE_TARGET}"
|
||||
RUST_TARGET="$(./hack/build/target.sh)"
|
||||
./hack/build/cargo.sh build ${CARGO_BUILD_FLAGS} --bin "${EXE_TARGET}"
|
||||
exec sudo RUST_LOG="${RUST_LOG}" "target/${RUST_TARGET}/debug/${EXE_TARGET}" "${@}"
|
||||
}
|
@ -3,7 +3,7 @@ set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "${DEBUG_DIR}/common.sh"
|
||||
|
||||
build_and_run kratactl "${@}"
|
@ -3,7 +3,7 @@ set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "${DEBUG_DIR}/common.sh"
|
||||
|
||||
KRATA_BUILD_INITRD=1 build_and_run kratad "${@}"
|
@ -3,7 +3,7 @@ set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "${DEBUG_DIR}/common.sh"
|
||||
|
||||
build_and_run kratanet "${@}"
|
11
hack/debug/session.yml
Normal file
11
hack/debug/session.yml
Normal file
@ -0,0 +1,11 @@
|
||||
session_name: krata-dev
|
||||
start_directory: ../..
|
||||
sleep_after: 3
|
||||
windows:
|
||||
- window_name: live
|
||||
layout: tiled
|
||||
panes:
|
||||
- shell_command: ./hack/debug/kratad.sh
|
||||
- shell_command: ./hack/debug/kratanet.sh
|
||||
- focus: true
|
||||
shell_command: "alias kratactl=./hack/debug/kratactl.sh"
|
10
scripts/dist/bundle.sh → hack/dist/bundle.sh
vendored
10
scripts/dist/bundle.sh → hack/dist/bundle.sh
vendored
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "$(dirname "${0}")/common.sh"
|
||||
|
||||
if [ -z "${KRATA_KERNEL_BUILD_JOBS}" ]
|
||||
@ -16,14 +16,14 @@ BUNDLE_DIR="${BUNDLE_DIR}/krata"
|
||||
mkdir -p "${BUNDLE_DIR}"
|
||||
for X in kratad kratanet kratactl
|
||||
do
|
||||
./scripts/build/cargo.sh build --release --bin "${X}"
|
||||
RUST_TARGET="$(./scripts/build/target.sh)"
|
||||
./hack/build/cargo.sh build --release --bin "${X}"
|
||||
RUST_TARGET="$(./hack/build/target.sh)"
|
||||
cp "${KRATA_DIR}/target/${RUST_TARGET}/release/${X}" "${BUNDLE_DIR}/${X}"
|
||||
done
|
||||
./scripts/initrd/build.sh
|
||||
./hack/initrd/build.sh
|
||||
if [ "${KRATA_BUNDLE_SKIP_KERNEL_BUILD}" != "1" ]
|
||||
then
|
||||
./scripts/kernel/build.sh "-j${KRATA_KERNEL_BUILD_JOBS}"
|
||||
./hack/kernel/build.sh "-j${KRATA_KERNEL_BUILD_JOBS}"
|
||||
fi
|
||||
|
||||
cd "${BUNDLE_DIR}"
|
8
scripts/dist/deb.sh → hack/dist/deb.sh
vendored
8
scripts/dist/deb.sh → hack/dist/deb.sh
vendored
@ -1,13 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "$(dirname "${0}")/common.sh"
|
||||
|
||||
"${KRATA_DIR}/scripts/dist/systar.sh"
|
||||
"${KRATA_DIR}/hack/dist/systar.sh"
|
||||
|
||||
KRATA_VERSION="$("${KRATA_DIR}/scripts/dist/version.sh")"
|
||||
TARGET_ARCH="$(KRATA_ARCH_ALT_NAME=1 "${KRATA_DIR}/scripts/build/arch.sh")"
|
||||
KRATA_VERSION="$("${KRATA_DIR}/hack/dist/version.sh")"
|
||||
TARGET_ARCH="$(KRATA_ARCH_ALT_NAME=1 "${KRATA_DIR}/hack/build/arch.sh")"
|
||||
|
||||
cd "${OUTPUT_DIR}"
|
||||
|
4
scripts/dist/systar.sh → hack/dist/systar.sh
vendored
4
scripts/dist/systar.sh → hack/dist/systar.sh
vendored
@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "$(dirname "${0}")/common.sh"
|
||||
|
||||
"${KRATA_DIR}/scripts/dist/bundle.sh"
|
||||
"${KRATA_DIR}/hack/dist/bundle.sh"
|
||||
|
||||
SYSTAR="${OUTPUT_DIR}/system.tgz"
|
||||
rm -f "${SYSTAR}"
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# shellcheck source=common.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "$(dirname "${0}")/common.sh"
|
||||
cd "${KRATA_DIR}"
|
||||
|
@ -7,10 +7,10 @@ KRATA_DIR="${PWD}"
|
||||
cd "${KRATA_DIR}"
|
||||
|
||||
export RUST_LIBC="musl"
|
||||
RUST_TARGET="$(./scripts/build/target.sh)"
|
||||
RUST_TARGET="$(./hack/build/target.sh)"
|
||||
export RUSTFLAGS="-Ctarget-feature=+crt-static"
|
||||
|
||||
./scripts/build/cargo.sh build "${@}" --release --bin krataguest
|
||||
./hack/build/cargo.sh build "${@}" --release --bin krataguest
|
||||
INITRD_DIR="$(mktemp -d /tmp/krata-initrd.XXXXXXXXXXXXX)"
|
||||
cp "target/${RUST_TARGET}/release/krataguest" "${INITRD_DIR}/init"
|
||||
chmod +x "${INITRD_DIR}/init"
|
@ -8,7 +8,7 @@ KERNEL_DIR="${KRATA_DIR}/kernel"
|
||||
|
||||
cd "${KRATA_DIR}"
|
||||
|
||||
# shellcheck source=../../kernel/config.sh
|
||||
# shellcheck source-path=SCRIPTDIR source=../../kernel/config.sh
|
||||
. "${KERNEL_DIR}/config.sh"
|
||||
KERNEL_SRC="${KERNEL_DIR}/linux-${KERNEL_VERSION}"
|
||||
|
||||
@ -23,7 +23,7 @@ fi
|
||||
OUTPUT_DIR="${KRATA_DIR}/target/kernel"
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
|
||||
TARGET_ARCH="$(KRATA_ARCH_KERNEL_NAME=1 ./scripts/build/arch.sh)"
|
||||
TARGET_ARCH="$(KRATA_ARCH_KERNEL_NAME=1 ./hack/build/arch.sh)"
|
||||
|
||||
KERNEL_CONFIG_FILE="${KERNEL_DIR}/krata-${TARGET_ARCH}.config"
|
||||
|
@ -2,13 +2,13 @@
|
||||
parallel = true
|
||||
|
||||
[pre-commit.commands.build]
|
||||
run = "./scripts/build/cargo.sh build"
|
||||
run = "./hack/build/cargo.sh build"
|
||||
|
||||
[pre-commit.commands.test]
|
||||
run = "./scripts/build/cargo.sh test"
|
||||
run = "./hack/build/cargo.sh test"
|
||||
|
||||
[pre-commit.commands.fmt]
|
||||
run = "./scripts/build/cargo.sh fmt --all -- --check"
|
||||
run = "./hack/build/cargo.sh fmt --all -- --check"
|
||||
|
||||
[pre-commit.commands.clippy]
|
||||
run = "./scripts/build/cargo.sh clippy"
|
||||
run = "./hack/build/cargo.sh clippy"
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd "$(dirname "${0}")/../.."
|
||||
./scripts/build/cargo.sh clippy --fix --allow-dirty --allow-staged
|
||||
cargo fmt --all
|
@ -1,11 +0,0 @@
|
||||
session_name: krata-dev
|
||||
start_directory: ../..
|
||||
sleep_after: 3
|
||||
windows:
|
||||
- window_name: live
|
||||
layout: tiled
|
||||
panes:
|
||||
- shell_command: ./scripts/debug/kratad.sh
|
||||
- shell_command: ./scripts/debug/kratanet.sh
|
||||
- focus: true
|
||||
shell_command: "alias kratactl=./scripts/debug/kratactl.sh"
|
Loading…
Reference in New Issue
Block a user