Skip to content
Snippets Groups Projects
Commit 6ed94828 authored by inso's avatar inso
Browse files

Add bootstrap.sh

parent 045c4826
Branches
Tags
No related merge requests found
Pipeline #
#!/bin/bash
# Test environment
if [[ ! -d /builds ]]; then
echo "In order to use this image, you must mount the working directory to /builds"
exit 1
fi
REFERENCE=$(ls -d /builds/* | head -1)
if [[ -z "${REFERENCE}" ]]; then
echo "Aborting because of empty working directory"
exit 1
fi
# Prepare environment
_builder_prepare() {
touch /builder/reference || exit 1
chown --reference "${REFERENCE}" /builder/reference || exit 1
chown -R builder:builder /builds/* || exit 1
}
# Terminate
_builder_terminate() {
chown -R --reference /builder/reference /builds/* || exit 1
rm -f /builder/reference
exit ${1}
}
# Prepare and execute building
_builder_prepare
su - builder
_builder_terminate $?
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment