build: Reuse firecracker directory on builds.
kata-deploy buider now reuses the build directory, this
makes faster rebuilds. Update firecracker builder to
not fail if is called twice.
@@ -15,6 +15,7 @@ source "${script_dir}/../../scripts/lib.sh"
config_dir="${script_dir}/../../scripts/"
firecracker_repo="${firecracker_repo:-}"
+firecracker_dir="firecracker"
firecracker_version="${firecracker_version:-}"
kata_version="${kata_version:-}"
@@ -31,10 +32,11 @@ fi
info "Build ${firecracker_repo} version: ${firecracker_version}"
-git clone ${firecracker_repo}
-cd firecracker
+[ -d "${firecracker_dir}" ] || git clone ${firecracker_repo}
+cd "${firecracker_dir}"
+git fetch
git checkout ${firecracker_version}
-./tools/devtool --unattended build --release
+sudo ./tools/devtool --unattended build --release
-ln -s ./build/cargo_target/x86_64-unknown-linux-musl/release/firecracker ./firecracker-static
-ln -s ./build/cargo_target/x86_64-unknown-linux-musl/release/jailer ./jailer-static
+ln -sf ./build/cargo_target/x86_64-unknown-linux-musl/release/firecracker ./firecracker-static
+ln -sf ./build/cargo_target/x86_64-unknown-linux-musl/release/jailer ./jailer-static
