2024-03-10 00:22:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#!/bin/sh
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-23 00:37:27 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set -e
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-07 09:04:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								REAL_SCRIPT="$(realpath "${0}")"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cd "$(dirname "${REAL_SCRIPT}")/../.."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								KRATA_DIR="${PWD}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cd "${KRATA_DIR}"
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-01 11:50:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-21 21:31:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								TARGET_ARCH="$(./hack/build/arch.sh)"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export TARGET_LIBC="musl"
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-07 16:40:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUST_TARGET="$(./hack/build/target.sh)"
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-23 00:37:27 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export RUSTFLAGS="-Ctarget-feature=+crt-static"
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-07 09:04:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-18 20:47:18 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								./hack/build/cargo.sh build "${@}" --release --bin krata-zone
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-21 20:57:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								INITRD_DIR="$(mktemp -d /tmp/krata-initrd.XXXXXXXXXXXXX)"
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-18 20:47:18 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cp "target/${RUST_TARGET}/release/krata-zone" "${INITRD_DIR}/init"
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-31 01:40:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								chmod +x "${INITRD_DIR}/init"
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-23 00:37:27 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cd "${INITRD_DIR}"
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-07 09:04:05 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								mkdir -p "${KRATA_DIR}/target/initrd"
							 | 
						
					
						
							
								
									
										
										
										
											2024-03-21 21:31:10 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								find . | cpio -R 0:0 --ignore-devno --renumber-inodes -o -H newc --quiet > "${KRATA_DIR}/target/initrd/initrd-${TARGET_ARCH}"
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-30 18:13:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								rm -rf "${INITRD_DIR}"
							 |