#/usr/bin/env bash
set -euo pipefail

rm -rf rootfs/*
cd rootfs
zstd -cd ../rootfs.cpio.zst | cpio -id
echo "Unpacked"

cp ../spl/leak_stack .
echo "Copied leak_stack"

cp ../spl/sploit .
echo "Copied sploit"

cp ../setuid_fail .
echo "Copied setuid_fail"

sleep 2
find . -print0| cpio -H newc --null -o --owner=root:root | zstd -f -19 -o ../rootfs.cpio.zst
echo "Repacked"
