File: docker-entrypoint.sh

package info (click to toggle)
golang-mvdan-sh 3.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,252 kB
  • sloc: javascript: 213; sh: 63; makefile: 10
file content (22 lines) | stat: -rwxr-xr-x 556 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2019 Olliver Schinagl <oliver@schinagl.nl>
#
# A beginning user should be able to docker run image bash (or sh) without
# needing to learn about --entrypoint
# https://github.com/docker-library/official-images#consistency

set -eu

# run command if it is not starting with a "-" and is an executable in PATH
if [ "${#}" -gt 0 ] &&
	[ "${1#-}" = "${1}" ] &&
	command -v "${1}" >"/dev/null" 2>&1; then
	exec "${@}"
else
	# else default to run the command
	exec /bin/shfmt "${@}"
fi

exit 0