diff --git a/man-make-springboot-exe.md b/man-make-springboot-exe.md index 23bf1dd..1ada480 100644 --- a/man-make-springboot-exe.md +++ b/man-make-springboot-exe.md @@ -97,7 +97,7 @@ All used file which can be included and/or adapted in the creation of the packag | EXIT_CODE_MISSING_POM | 4 | | EXIT_CODE_MISSING_POM_ENTRY | 5 | | EXIT_CODE_CANT_FOUND_JAR_FILE_OUTPUT | 6 | -| UNUSED | 7 | +| EXIT_CODE_CANT_FOUND_SCRIPT_FILES | 7 | | EXIT_CODE_CANT_FOUND_DEFAULT_CONF | 8 | | EXIT_CODE_CANT_FOUND_LOG_CONF | 9 | | EXIT_CODE_CANT_FOUND_RPM_FILE_OUTPUT | 10 | diff --git a/man-make-springboot-rpm.md b/man-make-springboot-rpm.md index ba79445..fb3ad44 100644 --- a/man-make-springboot-rpm.md +++ b/man-make-springboot-rpm.md @@ -100,7 +100,7 @@ All used file which can be included and/or adapted in the creation of the packag | EXIT_CODE_MISSING_POM | 4 | | EXIT_CODE_MISSING_POM_ENTRY | 5 | | EXIT_CODE_CANT_FOUND_JAR_FILE_OUTPUT | 6 | -| UNUSED | 7 | +| EXIT_CODE_CANT_FOUND_SCRIPT_FILES | 7 | | EXIT_CODE_CANT_FOUND_DEFAULT_CONF | 8 | | EXIT_CODE_CANT_FOUND_LOG_CONF | 9 | | EXIT_CODE_CANT_FOUND_RPM_FILE_OUTPUT | 10 | diff --git a/run-tests.bash b/run-tests.bash index faa5505..39ab6af 100755 --- a/run-tests.bash +++ b/run-tests.bash @@ -31,7 +31,6 @@ if [ -d "$TEST_TEMP_DIR" ]; then fi mkdir -p "$TEST_TEMP_DIR"; -export PREFIX; "$PREFIX/usr/bin/make-springboot-rpm" "$TESTROOT/demospringboot" "$TEST_TEMP_DIR" EXPECTED_TEST_PACKAGE="$TEST_TEMP_DIR/demospringboot-0.0.1-SNAPSHOT.rpm"; diff --git a/search-winsw.bash.md b/search-winsw.bash.md index 5cbe33a..13cd0ee 100644 --- a/search-winsw.bash.md +++ b/search-winsw.bash.md @@ -40,6 +40,7 @@ As environment variable: | Error name | Exit code | | ------------------------------------------ | --------- | | EXIT_CODE_MISSING_DEPENDENCY_COMMAND | 1 | +| EXIT_CODE_CANT_FOUND_SCRIPT_FILES | 7 | # BUGS Free feel to send issues to https://github.com/hdsdi3g/linux-springboot-packager/issues. diff --git a/src/usr/bin/make-springboot-exe b/src/usr/bin/make-springboot-exe index ab50e6d..1df8abc 100755 --- a/src/usr/bin/make-springboot-exe +++ b/src/usr/bin/make-springboot-exe @@ -32,6 +32,17 @@ set -eu PREFIX="${PREFIX:-"/"}"; INCLUDE_DIR="$PREFIX/usr/lib/linux-springboot-packager/include"; +# SEARCH SCRIPT FILES +if [ ! -d "$INCLUDE_DIR" ]; then + # /xxx/src/usr/bin/make-springboot-exe > /xxx/src + PREFIX="$(realpath "$0" | xargs dirname | xargs dirname | xargs dirname)"; + INCLUDE_DIR="$PREFIX/usr/lib/linux-springboot-packager/include"; + if [ ! -d "$INCLUDE_DIR" ]; then + echo "Can't found script files. Please setup PREFIX env var." >&2; + exit 7; + fi +fi + # LOAD BUILD DEPS . "$INCLUDE_DIR/consts.bash" . "$INCLUDE_DIR/checktools.bash" diff --git a/src/usr/bin/make-springboot-rpm b/src/usr/bin/make-springboot-rpm index 32928dd..f99ce46 100755 --- a/src/usr/bin/make-springboot-rpm +++ b/src/usr/bin/make-springboot-rpm @@ -32,6 +32,17 @@ set -eu PREFIX="${PREFIX:-"/"}"; INCLUDE_DIR="$PREFIX/usr/lib/linux-springboot-packager/include"; +# SEARCH SCRIPT FILES +if [ ! -d "$INCLUDE_DIR" ]; then + # /xxx/src/usr/bin/make-springboot-rpm > /xxx/src + PREFIX="$(realpath "$0" | xargs dirname | xargs dirname | xargs dirname)"; + INCLUDE_DIR="$PREFIX/usr/lib/linux-springboot-packager/include"; + if [ ! -d "$INCLUDE_DIR" ]; then + echo "Can't found script files. Please setup PREFIX env var." >&2; + exit 7; + fi +fi + # LOAD BUILD DEPS . "$INCLUDE_DIR/consts.bash" . "$INCLUDE_DIR/checktools.bash" diff --git a/src/usr/bin/search-winsw.bash b/src/usr/bin/search-winsw.bash index 66dba02..bcf7ff6 100755 --- a/src/usr/bin/search-winsw.bash +++ b/src/usr/bin/search-winsw.bash @@ -25,7 +25,17 @@ set -eu PREFIX="${PREFIX:-"/"}"; -. "$PREFIX/usr/lib/linux-springboot-packager/include/consts.bash" +CONST_FILE="$PREFIX/usr/lib/linux-springboot-packager/include/consts.bash"; + +# SEARCH SCRIPT FILES +if [ ! -f "$CONST_FILE" ]; then + PREFIX="$(realpath "$0" | xargs dirname | xargs dirname | xargs dirname)"; + CONST_FILE="$PREFIX/usr/lib/linux-springboot-packager/include/consts.bash"; + if [ ! -f "$CONST_FILE" ]; then + echo "Please setup PREFIX env var." >&2; + exit 7; + fi +fi declare -a POSSIBLE_PATHS=( "$HOME/.config/linux-springboot-packager" "$HOME/.bin" "$HOME/.local/bin" "$PREFIX/usr/bin" "$PREFIX/usr/lib/linux-springboot-packager/include" "$PREFIX/usr/lib/linux-springboot-packager/templates" ) declare -a POSSIBLE_NAMES=("WinSW.NET461.exe" "WinSW.NET4.exe" "WinSW.NET2.exe" "WinSW-x64.exe" "WinSW-x86.exe" ) diff --git a/src/usr/lib/linux-springboot-packager/include/consts.bash b/src/usr/lib/linux-springboot-packager/include/consts.bash index 4490d96..c4a6640 100644 --- a/src/usr/lib/linux-springboot-packager/include/consts.bash +++ b/src/usr/lib/linux-springboot-packager/include/consts.bash @@ -41,7 +41,7 @@ EXIT_CODE_MISSING_PROJECT_DIR="3"; EXIT_CODE_MISSING_POM="4"; EXIT_CODE_MISSING_POM_ENTRY="5"; EXIT_CODE_CANT_FOUND_JAR_FILE_OUTPUT="6"; -# UNUSED="7"; +# EXIT_CODE_CANT_FOUND_SCRIPT_FILES 7 EXIT_CODE_CANT_FOUND_DEFAULT_CONF="8"; EXIT_CODE_CANT_FOUND_LOG_CONF="9"; EXIT_CODE_CANT_FOUND_RPM_FILE_OUTPUT="10";