mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
hack: rename scripts to hack
This commit is contained in:
31
hack/debug/common.sh
Normal file
31
hack/debug/common.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
cd "$(dirname "${REAL_SCRIPT}")/../.."
|
||||
|
||||
if [ -z "${RUST_LOG}" ]
|
||||
then
|
||||
RUST_LOG="INFO"
|
||||
fi
|
||||
|
||||
CARGO_BUILD_FLAGS=""
|
||||
|
||||
if [ "${KRATA_BUILD_QUIET}" = "1" ]
|
||||
then
|
||||
CARGO_BUILD_FLAGS="-q"
|
||||
fi
|
||||
|
||||
build_and_run() {
|
||||
EXE_TARGET="${1}"
|
||||
shift
|
||||
sudo mkdir -p /var/lib/krata/guest
|
||||
if [ "${KRATA_BUILD_INITRD}" = "1" ]
|
||||
then
|
||||
./hack/initrd/build.sh -q
|
||||
sudo cp "target/initrd/initrd" "/var/lib/krata/guest/initrd"
|
||||
fi
|
||||
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}" "${@}"
|
||||
}
|
9
hack/debug/kratactl.sh
Executable file
9
hack/debug/kratactl.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "${DEBUG_DIR}/common.sh"
|
||||
|
||||
build_and_run kratactl "${@}"
|
9
hack/debug/kratad.sh
Executable file
9
hack/debug/kratad.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "${DEBUG_DIR}/common.sh"
|
||||
|
||||
KRATA_BUILD_INITRD=1 build_and_run kratad "${@}"
|
9
hack/debug/kratanet.sh
Executable file
9
hack/debug/kratanet.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REAL_SCRIPT="$(realpath "${0}")"
|
||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
|
||||
# shellcheck source-path=SCRIPTDIR source=common.sh
|
||||
. "${DEBUG_DIR}/common.sh"
|
||||
|
||||
build_and_run kratanet "${@}"
|
14
hack/debug/session.sh
Executable file
14
hack/debug/session.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
stop_service_if_running() {
|
||||
if sudo systemctl is-active "${1}" > /dev/null 2>&1
|
||||
then
|
||||
sudo systemctl stop "${1}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
stop_service_if_running "kratad.service"
|
||||
stop_service_if_running "kratanet.service"
|
||||
tmuxp load "$(dirname "${0}")/session.yml"
|
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"
|
Reference in New Issue
Block a user