Browse Source

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

Alois Mahdal 7 years ago
parent
commit
853dde7823
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      src/make.skel

+ 9
- 5
src/make.skel View File

1
 #!/bin/bash
1
 #!/bin/bash
2
-#shellcheck disable=SC2034,SC1090
2
+#shellcheck disable=SC2034
3
 # mkit - simple install helper
3
 # mkit - simple install helper
4
 # See LICENSE file for copyright and license details.
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
 MKIT_VERSION=__MKIT_PROJ_VERSION__
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
 case "$1" in
82
 case "$1" in
79
     --version-semver) echo "$MKIT_VERSION"; exit 0 ;;
83
     --version-semver) echo "$MKIT_VERSION"; exit 0 ;;