Ver código fonte

Move init failure code to die_init() (formerly die())

Alois Mahdal 7 anos atrás
pai
commit
853dde7823
1 arquivos alterados com 9 adições e 5 exclusões
  1. 9
    5
      src/make.skel

+ 9
- 5
src/make.skel Ver arquivo

@@ -1,13 +1,17 @@
1 1
 #!/bin/bash
2
-#shellcheck disable=SC2034,SC1090
2
+#shellcheck disable=SC2034
3 3
 # mkit - simple install helper
4 4
 # See LICENSE file for copyright and license details.
5 5
 
6
-die() {
6
+init_core() {
7 7
     #
8
-    # Poor man's die() (mkit.sh has better)
8
+    # Load core module (or die)
9 9
     #
10
-    echo "$@" >&2 && exit 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
11 15
 }
12 16
 
13 17
 
@@ -73,7 +77,7 @@ MKIT_PROJ_PKGNAME=""
73 77
 MKIT_VERSION=__MKIT_PROJ_VERSION__
74 78
 
75 79
 
76
-. "$MKIT_DIR/include/mkit.sh" || die "failed to init; check if MKIT_DIR is set properly: $MKIT_DIR"
80
+init_core
77 81
 
78 82
 case "$1" in
79 83
     --version-semver) echo "$MKIT_VERSION"; exit 0 ;;