diff --git a/README.md b/README.md
index 162875f..de16278 100644
--- a/README.md
+++ b/README.md
@@ -213,10 +213,18 @@ docker-build options to be append to the building image.
Format is the same as (and passed to) docker-build’s options.
See 'docker build --help'.
-``CQFD_NO_SSH_CONFIG``: Set to ``true`` to disable forwarding
-the user's ``~/.ssh`` and global ``/etc/ssh`` configurations to the
-container. This may be required if the host's ``ssh`` configuration
-is not compatible with the ``ssh`` version within the container.
+``CQFD_NO_SSH_CONFIG``: Set to ``true`` to disable forwarding the global
+``/etc/ssh`` configurations to the container. This may be required if
+the host's ``ssh`` configuration is not compatible with the ``ssh``
+version within the container.
+
+``CQFD_NO_USER_SSH_CONFIG``: Set to ``true`` to disable forwarding
+the user's ``~/.ssh`` configuration to the container.
+
+``CQFD_NO_USER_GIT_CONFIG``: Set to ``true`` to disable forwarding
+the user's ``~/.gitconfig`` configuration to the container.
+
+``CQFD_SHELL``: The shell to be launched, by default ``/bin/sh``.
### Appending to the build command ###
diff --git a/bash-completion b/bash-completion
index 574fb45..6d64549 100644
--- a/bash-completion
+++ b/bash-completion
@@ -15,6 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+if [ -z "$BASH_VERSION" ]; then
+ _init_completion() {
+ }
+ _get_first_arg() {
+ }
+fi
+
_cqfd() {
local cur prev words cword
_init_completion || return
diff --git a/cqfd b/cqfd
index 501d5da..54488aa 100755
--- a/cqfd
+++ b/cqfd
@@ -26,6 +26,7 @@ cqfdrc=".cqfdrc"
cqfd_user='builder'
cqfd_user_home='/home/builder'
cqfd_user_cwd="$cqfd_user_home/src"
+cqfd_shell=${CQFD_SHELL:-/bin/bash}
## usage() - print usage on stdout
usage() {
@@ -39,6 +40,7 @@ Options:
-b Target a specific build flavor.
-q Turn on quiet mode.
-v or --version Show version.
+ --verbose Increase the script's verbosity.
-h or --help Show this help text.
Commands:
@@ -112,11 +114,18 @@ die() {
exit 1
}
+## debug() - print verbose messages
+debug() {
+ test -n "$CQFD_DEBUG" && echo "cqfd: debug: $*" || true
+}
+
# docker_build() - Initialize build container
docker_build() {
if [ -z "$project_build_context" ]; then
+ debug executing: docker build ${quiet:+-q} $CQFD_EXTRA_BUILD_ARGS -t "$docker_img_name" "$(dirname "$dockerfile")"
docker build ${quiet:+-q} $CQFD_EXTRA_BUILD_ARGS -t "$docker_img_name" "$(dirname "$dockerfile")"
else
+ debug executing: docker build ${quiet:+-q} $CQFD_EXTRA_BUILD_ARGS -t "$docker_img_name" "${project_build_context}" -f "$dockerfile"
docker build ${quiet:+-q} $CQFD_EXTRA_BUILD_ARGS -t "$docker_img_name" "${project_build_context}" -f "$dockerfile"
fi
}
@@ -237,8 +246,11 @@ docker_run() {
args+=(-e "$home_env_var")
fi
- if [ "$CQFD_NO_SSH_CONFIG" != true ]; then
+ if [ "$CQFD_NO_USER_SSH_CONFIG" != true ]; then
args+=(-v "$cqfd_user_home/.ssh:$cqfd_user_home/.ssh")
+ fi
+
+ if [ "$CQFD_NO_SSH_CONFIG" != true ]; then
args+=(-v /etc/ssh:/etc/ssh)
fi
@@ -247,6 +259,10 @@ docker_run() {
args+=(-e "SSH_AUTH_SOCK=$cqfd_user_home/.sockets/ssh")
fi
+ if [ "$CQFD_NO_USER_GIT_CONFIG" != true ]; then
+ args+=(-v "$cqfd_user_home/.gitconfig:$cqfd_user_home/.gitconfig")
+ fi
+
args+=(-v "$cqfd_project_dir:$cqfd_project_dir")
tmp_launcher=$(make_launcher)
@@ -256,6 +272,7 @@ docker_run() {
args+=("$docker_img_name" cqfd_launch "$1")
+ debug executing: docker run "${args[@]}"
docker run "${args[@]}"
}
@@ -369,7 +386,7 @@ test_su_session_command && has_su_session_command=1
# Add the host's user and group to the container, and adjust ownership.
groupadd -og $GROUPS -f builders || die "groupadd command failed."
-useradd -s /bin/sh -oN -u $UID -g $GROUPS -d "$cqfd_user_home" $cqfd_user \
+useradd -s $cqfd_shell -oN -u $UID -g $GROUPS -d "$cqfd_user_home" $cqfd_user \
|| die "useradd command failed."
mkdir -p "$cqfd_user_home" || die "mkdir command failed."
chown $UID:$GROUPS "$cqfd_user_home" || die "chown command failed."
@@ -512,6 +529,9 @@ while [ $# -gt 0 ]; do
echo $VERSION
exit 0
;;
+ verbose|"--verbose")
+ export CQFD_DEBUG=true
+ ;;
init)
config_load $flavor
docker_build
@@ -569,7 +589,7 @@ while [ $# -gt 0 ]; do
shell)
shift
config_load "$flavor"
- command_string="${CQFD_SHELL:-/bin/sh}"
+ command_string="$cqfd_shell"
if [ "$#" -gt 0 ]; then
command_string+=" ${@@Q}"
fi