mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-02 12:50:54 +00:00
hypha: add script for quick debugging and set log levels ot warn by default
This commit is contained in:
parent
bd56de235f
commit
e7cea3d7ed
@ -1,9 +1,11 @@
|
|||||||
|
use env_logger::Env;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use hypha::container::init::ContainerInit;
|
use hypha::container::init::ContainerInit;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
env::set_var("RUST_BACKTRACE", "1");
|
env::set_var("RUST_BACKTRACE", "1");
|
||||||
|
env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
|
||||||
if env::var("HYPHA_UNSAFE_ALWAYS_ALLOW_INIT").unwrap_or("0".to_string()) != "1" {
|
if env::var("HYPHA_UNSAFE_ALWAYS_ALLOW_INIT").unwrap_or("0".to_string()) != "1" {
|
||||||
let pid = std::process::id();
|
let pid = std::process::id();
|
||||||
if pid > 3 {
|
if pid > 3 {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use env_logger::Env;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use hypha::ctl::Controller;
|
use hypha::ctl::Controller;
|
||||||
@ -46,7 +47,7 @@ enum Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
env_logger::init();
|
env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
|
||||||
|
|
||||||
let args = ControllerArgs::parse();
|
let args = ControllerArgs::parse();
|
||||||
let store_path = if args.store == "auto" {
|
let store_path = if args.store == "auto" {
|
||||||
|
@ -4,7 +4,7 @@ set -e
|
|||||||
export RUSTFLAGS="-Ctarget-feature=+crt-static"
|
export RUSTFLAGS="-Ctarget-feature=+crt-static"
|
||||||
cd "$(dirname "${0}")/.."
|
cd "$(dirname "${0}")/.."
|
||||||
HYPHA_DIR="${PWD}"
|
HYPHA_DIR="${PWD}"
|
||||||
cargo build --release --target x86_64-unknown-linux-gnu
|
cargo build --bin hyphactr --release --target x86_64-unknown-linux-gnu
|
||||||
INITRD_DIR="$(mktemp -d /tmp/hypha-initrd.XXXXXXXXXXXXX)"
|
INITRD_DIR="$(mktemp -d /tmp/hypha-initrd.XXXXXXXXXXXXX)"
|
||||||
cp target/x86_64-unknown-linux-gnu/release/hyphactr "${INITRD_DIR}/init"
|
cp target/x86_64-unknown-linux-gnu/release/hyphactr "${INITRD_DIR}/init"
|
||||||
chmod +x "${INITRD_DIR}/init"
|
chmod +x "${INITRD_DIR}/init"
|
||||||
|
13
scripts/hyphactl-debug.sh
Executable file
13
scripts/hyphactl-debug.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "${RUST_LOG}" ]
|
||||||
|
then
|
||||||
|
RUST_LOG="INFO"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$(dirname "${0}")/.."
|
||||||
|
./initrd/build.sh
|
||||||
|
sudo cp "target/initrd/initrd" "/var/lib/hypha/default/initrd"
|
||||||
|
cargo build --target x86_64-unknown-linux-gnu --bin hyphactl
|
||||||
|
exec sudo RUST_LOG="${RUST_LOG}" target/x86_64-unknown-linux-gnu/debug/hyphactl "${@}"
|
Loading…
Reference in New Issue
Block a user