17 lines
458 B
Bash
Executable File
17 lines
458 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
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 |