Only track non-skipped stages in PREV_ variables

Only set `PREV_STAGE`, `PREV_STAGE_DIR` and `PREV_ROOTFS_DIR` when the
stage is actually built.

When building a custom image, I wanted to make the least modifications
to this repo, so I've added `SKIP` files to `stage3` and `stage4`, and
created my own `stage5`, but this confused `copy_previous`, which was
trying to copy the rootfs from a un-built stage. This fixes this issue.
This commit is contained in:
Maciej Małecki 2018-10-26 15:04:49 +02:00
parent c9b658ecd6
commit c9580d17ee

View File

@ -108,11 +108,11 @@ run_stage(){
run_sub_stage
fi
done
PREV_ROOTFS_DIR="${ROOTFS_DIR}"
PREV_STAGE="${STAGE}"
PREV_STAGE_DIR="${STAGE_DIR}"
fi
unmount "${WORK_DIR}/${STAGE}"
PREV_STAGE="${STAGE}"
PREV_STAGE_DIR="${STAGE_DIR}"
PREV_ROOTFS_DIR="${ROOTFS_DIR}"
popd > /dev/null
log "End ${STAGE_DIR}"
}