Browse Source

Move global variables to new vars.sh module

Alois Mahdal 7 years ago
parent
commit
4c69c6b59b
2 changed files with 34 additions and 30 deletions
  1. 0
    30
      src/include/vars.sh.skel
  2. 34
    0
      src/make

src/make.skel → src/include/vars.sh.skel View File

1
 #!/bin/bash
1
 #!/bin/bash
2
-#shellcheck disable=SC2034
3
 # mkit - simple install helper
2
 # mkit - simple install helper
4
 # See LICENSE file for copyright and license details.
3
 # See LICENSE file for copyright and license details.
5
 
4
 
6
-init_core() {
7
-    #
8
-    # Load core module (or die)
9
-    #
10
-    #shellcheck disable=SC1090
11
-    . "$MKIT_DIR/include/mkit.sh" \
12
-     && return 0
13
-    echo "failed to load core; check if MKIT_DIR is set properly: $MKIT_DIR" >&2
14
-    exit 9
15
-}
16
-
17
 
5
 
18
 #
6
 #
19
 # Bump size (for vbump_? and release_?)
7
 # Bump size (for vbump_? and release_?)
30
 #
18
 #
31
 MKIT_DEFAULT_MODE="644"
19
 MKIT_DEFAULT_MODE="644"
32
 
20
 
33
-#
34
-# Path to MKit dir (where 'include' is)
35
-#
36
-MKIT_DIR=${MKIT_DIR:-$(dirname "$0")}
37
-
38
 #
21
 #
39
 # Dry mode (true|false)
22
 # Dry mode (true|false)
40
 #
23
 #
75
 # This MKit version
58
 # This MKit version
76
 #
59
 #
77
 MKIT_VERSION=__MKIT_PROJ_VERSION__
60
 MKIT_VERSION=__MKIT_PROJ_VERSION__
78
-
79
-
80
-init_core
81
-
82
-case "$1" in
83
-    --version-semver) echo "$MKIT_VERSION"; exit 0 ;;
84
-    --version)        echo "Mkit (Simple Makefile target helper) $MKIT_VERSION"
85
-                      exit 0 ;;
86
-esac
87
-
88
-mkit_init
89
-
90
-route "$@"

+ 34
- 0
src/make View File

1
+#!/bin/bash
2
+#shellcheck disable=SC2034
3
+# mkit - simple install helper
4
+# See LICENSE file for copyright and license details.
5
+
6
+init_core() {
7
+    #
8
+    # Load core module (or die)
9
+    #
10
+    #shellcheck disable=SC1090
11
+    . "$MKIT_DIR/include/mkit.sh" \
12
+     && . "$MKIT_DIR/include/vars.sh" \
13
+     && return 0
14
+    echo "failed to load core; check if MKIT_DIR is set properly: $MKIT_DIR" >&2
15
+    exit 9
16
+}
17
+
18
+#
19
+# Path to MKit dir (where 'include' is)
20
+#
21
+MKIT_DIR=${MKIT_DIR:-$(dirname "$0")}
22
+
23
+
24
+init_core
25
+
26
+case "$1" in
27
+    --version-semver) echo "$MKIT_VERSION"; exit 0 ;;
28
+    --version)        echo "Mkit (Simple Makefile target helper) $MKIT_VERSION"
29
+                      exit 0 ;;
30
+esac
31
+
32
+mkit_init
33
+
34
+route "$@"