File: warn-outside-container

package info (click to toggle)
docker.io 26.1.5%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,576 kB
  • sloc: sh: 5,748; makefile: 912; ansic: 664; asm: 228; python: 162
file content (27 lines) | stat: -rwxr-xr-x 740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env sh
set -eu

target="${1:-}"

if [ -z "${DISABLE_WARN_OUTSIDE_CONTAINER:-}" ]; then
		case $target in
			clean|dev|help|shell)
				# no warning needed for these targets
				;;
			*)
				(
						echo
						echo "\033[1mWARNING\033[0m: you are not in a container."
						echo
						echo 'Use "\033[1mmake dev\033[0m" to start an interactive development container,'
						echo "use \"\033[1mmake -f docker.Makefile $target\033[0m\" to execute this target"
						echo "in a container, or set \033[1mDISABLE_WARN_OUTSIDE_CONTAINER=1\033[0m to"
						echo "disable this warning."
						echo
						echo "Press \033[1mCtrl+C\033[0m now to abort, or wait for the script to continue.."
						echo
				) >&2
				sleep 5
				;;
		esac
fi