Przeglądaj źródła

Move global variables to new vars.sh module

Alois Mahdal 7 lat temu
rodzic
commit
4c69c6b59b
2 zmienionych plików z 34 dodań i 30 usunięć
  1. 0
    30
      src/include/vars.sh.skel
  2. 34
    0
      src/make

src/make.skel → src/include/vars.sh.skel Wyświetl plik

@@ -1,19 +1,7 @@
1 1
 #!/bin/bash
2
-#shellcheck disable=SC2034
3 2
 # mkit - simple install helper
4 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 7
 # Bump size (for vbump_? and release_?)
@@ -30,11 +18,6 @@ MKIT_DEBUG=${MKIT_DEBUG:-false}
30 18
 #
31 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 22
 # Dry mode (true|false)
40 23
 #
@@ -75,16 +58,3 @@ MKIT_PROJ_PKGNAME=""
75 58
 # This MKit version
76 59
 #
77 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 Wyświetl plik

@@ -0,0 +1,34 @@
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 "$@"