Commit 5734c5bf authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Make use of the 'mkdir' and 'tee' builtins if available

If the additional builtins 'mkdir' and 'tee' are available (often
requires separate installation and manual activation) and in the
expected place, the 'docker' and 'systemctl' commands will be the only
process spawning commands in register.sh.
parent 0082431a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -9,12 +9,18 @@ declare -r DEFAULT_NAME=${FQDN}/%02i
declare -r SYSTEMD_NAME=gitlab-runner
declare -r IMAGE=gitlab/gitlab-runner:latest

# Use mkdir & tee builtins if available
test -r /usr/lib/bash/mkdir &&
	enable -f /usr/lib/bash/mkdir mkdir
test -r /usr/lib/bash/tee &&
	enable -f /usr/lib/bash/tee tee

test -e ${CONFIG_FILE} &&
	source ${CONFIG_FILE}


usage() {
	cat <<-END
	tee <<-END
	Usage:
	  $0 [-h] [register] [-d DESCRIPTION] [-u COORDINATOR] TOKEN [NAME]
	  $0 [-h] unregister RUNNER_NAME
@@ -36,7 +42,7 @@ usage() {
}

config_help() {
	cat <<-'END'
	tee <<-'END'
	The configuration file is a sourced Bash script at
	/etc/gitlab-runner/registration.conf