|
@@ -1551,7 +1551,7 @@ update() {
|
|
debug "Running: ${FUNCNAME[0]} $*"
|
|
debug "Running: ${FUNCNAME[0]} $*"
|
|
debug "Checking for installJRMC update"
|
|
debug "Checking for installJRMC update"
|
|
|
|
|
|
- # Function to extract and normalize version from a script
|
|
|
|
|
|
+ # Extract and normalize version from a script
|
|
extract_version() {
|
|
extract_version() {
|
|
local version_line
|
|
local version_line
|
|
version_line=$(grep -m 1 'SCRIPT_VERSION=' "$1")
|
|
version_line=$(grep -m 1 'SCRIPT_VERSION=' "$1")
|
|
@@ -1562,7 +1562,7 @@ update() {
|
|
echo "$version_line"
|
|
echo "$version_line"
|
|
}
|
|
}
|
|
|
|
|
|
- # Helper function for version comparison
|
|
|
|
|
|
+ # Compare semantic version strings
|
|
version_greater() {
|
|
version_greater() {
|
|
# Returns true if version $1 is greater than version $2
|
|
# Returns true if version $1 is greater than version $2
|
|
[[ "$(echo -e "$1\n$2" | sort -V | head -n 1)" != "$1" ]]
|
|
[[ "$(echo -e "$1\n$2" | sort -V | head -n 1)" != "$1" ]]
|
|
@@ -1576,6 +1576,8 @@ update() {
|
|
# Get the current commit hash
|
|
# Get the current commit hash
|
|
local before_pull_hash after_pull_hash
|
|
local before_pull_hash after_pull_hash
|
|
before_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
|
before_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
|
|
|
+ # Run a git stash in case there are local changes
|
|
|
|
+ execute git stash --quiet
|
|
if git -C "$SCRIPT_DIR" pull | grep -qv "Already up to date"; then
|
|
if git -C "$SCRIPT_DIR" pull | grep -qv "Already up to date"; then
|
|
return 0
|
|
return 0
|
|
fi
|
|
fi
|