Export des fichiers avec les droits de l'utilisteur du HOST
This commit is contained in:
parent
fc862e1369
commit
0d5e391e97
|
@ -1,3 +1,3 @@
|
||||||
dist
|
packages
|
||||||
*.log
|
*.log
|
||||||
*~
|
*~
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "RUN apt-get install --yes --no-install-recommends git-core" >> Dockerfile
|
echo "RUN apt-get install --yes --no-install-recommends git-core git-buildpackage" >> Dockerfile
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "${TAMARIN_UTIL}"
|
||||||
|
|
||||||
|
function move_output_to_dist {
|
||||||
|
find '../' -maxdepth 1 -name "$1" -type f -print0 | xargs -0r mv -t /dist/
|
||||||
|
}
|
||||||
|
|
||||||
# Create new directory
|
# Create new directory
|
||||||
mkdir -p /dist
|
mkdir -p /dist
|
||||||
|
|
||||||
# Move generated files
|
# Move generated files
|
||||||
mv ../*.deb /dist
|
move_output_to_dist "*.deb"
|
||||||
mv ../*.changes /dist
|
move_output_to_dist "*.changes"
|
||||||
mv ../*.dsc /dist
|
move_output_to_dist "*.dsc"
|
||||||
mv ../*.tar.xz /dist
|
move_output_to_dist "*.tar.{bz2,gz,lzma,xz}"
|
||||||
|
|
||||||
|
chown -R ${HOST_UID}:${HOST_GID} /dist
|
||||||
|
|
|
@ -33,7 +33,8 @@ function build_project()
|
||||||
exec_hooks "prebuild" "${workspace}"
|
exec_hooks "prebuild" "${workspace}"
|
||||||
|
|
||||||
cd "${workspace}"
|
cd "${workspace}"
|
||||||
dpkg-buildpackage -us -uc 2> >(error) 1> >(info)
|
|
||||||
|
dpkg-buildpackage -b 2> >(error) 1> >(info)
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
fatal "The build process has not completed successfuly !"
|
fatal "The build process has not completed successfuly !"
|
||||||
|
|
19
package.sh
19
package.sh
|
@ -47,7 +47,7 @@ function create_container {
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
RUN apt-get update &&\
|
RUN apt-get update &&\
|
||||||
apt-get install --yes build-essential devscripts equivs git-buildpackage
|
apt-get install --yes --no-install-recommends build-essential devscripts equivs
|
||||||
|
|
||||||
RUN mkdir /root/.tamarin
|
RUN mkdir /root/.tamarin
|
||||||
RUN mkdir /project
|
RUN mkdir /project
|
||||||
|
@ -90,22 +90,25 @@ function main {
|
||||||
|
|
||||||
local docker_opt="run -e \"DISTRIB=$BASE_IMAGE\" -e \"PROJECT_NAME=$project_name\""
|
local docker_opt="run -e \"DISTRIB=$BASE_IMAGE\" -e \"PROJECT_NAME=$project_name\""
|
||||||
|
|
||||||
if [[ ${PERSIST_CONTAINER} -eq 0 ]]
|
# Expose host uid & gid
|
||||||
|
docker_opt="${docker_opt} -e HOST_UID=$(id -u) -e HOST_GID=$(id -g)"
|
||||||
|
|
||||||
|
if [[ ${PERSIST_CONTAINER} -eq 0 ]]
|
||||||
then
|
then
|
||||||
docker_opt="${docker_opt} --rm "
|
docker_opt="${docker_opt} --rm "
|
||||||
else
|
else
|
||||||
docker_opt="${docker_opt}"
|
docker_opt="${docker_opt}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${BUILD_DIR} ]]
|
if [[ -z ${BUILD_DIR} ]]
|
||||||
then
|
then
|
||||||
docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src\" -v=\"$PROJECT_DEST:/dist\" $container_tag"
|
docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src:ro\" -v=\"$PROJECT_DEST:/dist:rw\" $container_tag"
|
||||||
else
|
else
|
||||||
docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src\" -v=\"$PROJECT_DEST:/dist\" -v=\"${BUILD_DIR}:/build\" $container_tag"
|
docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src:ro\" -v=\"$PROJECT_DEST:/dist:rw\" -v=\"${BUILD_DIR}:/build\" $container_tag"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Switching to container..."
|
info "Switching to container..."
|
||||||
echo "docker ${docker_opt}"
|
debug "docker ${docker_opt}"
|
||||||
docker ${docker_opt}
|
docker ${docker_opt}
|
||||||
res=${?}
|
res=${?}
|
||||||
|
|
||||||
|
@ -114,8 +117,8 @@ function main {
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Parsing options
|
# Parsing options
|
||||||
#
|
#
|
||||||
while getopts "kp:d:i:b:B:t:" option
|
while getopts "kp:d:i:b:B:t:" option
|
||||||
do
|
do
|
||||||
case $option in
|
case $option in
|
||||||
|
|
Loading…
Reference in New Issue