2022-05-10 10:50:10 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-05-10 20:50:49 +00:00
|
|
|
set -e
|
2022-05-10 10:50:10 +00:00
|
|
|
alias cp="cp --reflink=auto"
|
|
|
|
export STAGE_INPUT="$1"
|
|
|
|
export STAGE_OUTPUT="$2"
|
|
|
|
if [ -f "$STAGE_INPUT/bin/login" ]; then
|
|
|
|
if [ -f "$STAGE_OUTPUT/bin/login.bak" ]; then
|
|
|
|
rm "$STAGE_OUTPUT/bin/login"
|
|
|
|
else
|
|
|
|
mv "$STAGE_OUTPUT/bin/login" "$STAGE_OUTPUT/bin/login.bak"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cp -rf "$STAGE_INPUT/." "$STAGE_OUTPUT"
|
|
|
|
if [ -f "$STAGE_OUTPUT/setup" ]; then
|
|
|
|
fchroot "$STAGE_OUTPUT" "/setup"
|
|
|
|
find "$STAGE_OUTPUT/var/log" -type f -delete
|
|
|
|
fi
|