Skip to content

Commit

Permalink
Run scripts direct from source repo, without setup manually PREFIX en…
Browse files Browse the repository at this point in the history
…v var #16
  • Loading branch information
hdsdi3g committed Jul 10, 2023
1 parent 0088edd commit efda3e6
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion man-make-springboot-exe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion man-make-springboot-rpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
1 change: 0 additions & 1 deletion run-tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions search-winsw.bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions src/usr/bin/make-springboot-exe
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 11 additions & 0 deletions src/usr/bin/make-springboot-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 11 additions & 1 deletion src/usr/bin/search-winsw.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down
2 changes: 1 addition & 1 deletion src/usr/lib/linux-springboot-packager/include/consts.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit efda3e6

Please sign in to comment.