mirror of
				https://github.com/edera-dev/krata.git
				synced 2025-11-04 07:39:39 +00:00 
			
		
		
		
	krata: rewrite all repo infrastructure
This commit is contained in:
		
							
								
								
									
										31
									
								
								scripts/debug/common.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								scripts/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
 | 
			
		||||
    ./scripts/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}"
 | 
			
		||||
  exec sudo RUST_LOG="${RUST_LOG}" "target/${RUST_TARGET}/debug/${EXE_TARGET}" "${@}"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								scripts/debug/kratactl.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								scripts/debug/kratactl.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
REAL_SCRIPT="$(realpath "${0}")"
 | 
			
		||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
 | 
			
		||||
# shellcheck source=common.sh
 | 
			
		||||
. "${DEBUG_DIR}/common.sh"
 | 
			
		||||
 | 
			
		||||
build_and_run kratactl "${@}"
 | 
			
		||||
							
								
								
									
										9
									
								
								scripts/debug/kratad.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								scripts/debug/kratad.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
REAL_SCRIPT="$(realpath "${0}")"
 | 
			
		||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
 | 
			
		||||
# shellcheck source=common.sh
 | 
			
		||||
. "${DEBUG_DIR}/common.sh"
 | 
			
		||||
 | 
			
		||||
KRATA_BUILD_INITRD=1 build_and_run kratad "${@}"
 | 
			
		||||
							
								
								
									
										9
									
								
								scripts/debug/kratanet.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								scripts/debug/kratanet.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
REAL_SCRIPT="$(realpath "${0}")"
 | 
			
		||||
DEBUG_DIR="$(dirname "${REAL_SCRIPT}")"
 | 
			
		||||
# shellcheck source=common.sh
 | 
			
		||||
. "${DEBUG_DIR}/common.sh"
 | 
			
		||||
 | 
			
		||||
build_and_run kratanet "${@}"
 | 
			
		||||
							
								
								
									
										14
									
								
								scripts/debug/session.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								scripts/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
									
								
								scripts/debug/session.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								scripts/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: ./scripts/debug/kratad.sh
 | 
			
		||||
  - shell_command: ./scripts/debug/kratanet.sh
 | 
			
		||||
  - focus: true
 | 
			
		||||
    shell_command: "alias kratactl=./scripts/debug/kratactl.sh"
 | 
			
		||||
		Reference in New Issue
	
	Block a user