File: common_code.sh

package info (click to toggle)
modules 5.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,996 kB
  • sloc: exp: 79,667; sh: 6,142; tcl: 5,895; makefile: 1,478; ansic: 474; python: 272; csh: 202; perl: 47; ruby: 44; lisp: 13
file content (67 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# shellcheck shell=sh
#
# This should be sourced from the other scripts

# Make sure TMP_MODVERSION and TMP_STRATEGY are set
if [ -z "$TMP_MODVERSION" ]; then
	echo >&2 "ERROR: TMP_MODVERSION not set"
	exit
fi

if [ -z "$TMP_STRATEGY" ]; then
	echo >&2 "ERROR: TMP_STRATEGY not set"
	exit
fi

# Set prompt
TMP_PROMPT="mod${TMP_MODVERSION}"
case $TMP_STRATEGY in
   flavours)
	#This really means MODVERSION is flavours version
	TMP_PROMPT="${TMP_PROMPT}-flavours"
	;;
   homebrewed|modulerc|modulepath)
	TMP_PROMPT="${TMP_PROMPT} ($TMP_STRATEGY)"
	;;
   *)
	echo >&2 "ERROR: unrecognized value '$TMP_STRATEGY' for TMP_STRATEGY"
	exit 1
	;;
esac

#Define do_cmd function
do_cmd()
{	cmd="$*"
	echo "[$TMP_PROMPT]$ $cmd"
	$cmd
}

#Define variables GCCGNU to be gcc or gnu
case $TMP_STRATEGY in
   flavours)
	GCCGNU=gnu
	;;
   *)
    # shellcheck disable=SC2034
	GCCGNU=gcc
	;;
esac

#Define AUTOFLAG to be "" or --auto
case $TMP_MODVERSION in
   3)
	AUTOFLAG=
	;;
   4)
	case $TMP_STRATEGY in
	   flavours)
		AUTOFLAG=
		;;
	   *)
        # shellcheck disable=SC2034
		AUTOFLAG="--auto"
		;;
	esac
	;;
esac