Преглед на файлове

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

Alois Mahdal преди 7 години
родител
ревизия
853dde7823
променени са 1 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. 9
    5
      src/make.skel

+ 9
- 5
src/make.skel Целия файл

@@ -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 ;;