Fix Linux Mint codename
This commit is contained in:
43
installJRMC
43
installJRMC
@@ -1606,6 +1606,17 @@ update_self() {
|
|||||||
|
|
||||||
echo "Checking for installJRMC update"
|
echo "Checking for installJRMC update"
|
||||||
|
|
||||||
|
# Function to extract and normalize version from a script
|
||||||
|
extract_version() {
|
||||||
|
local version_line
|
||||||
|
version_line=$(grep -m 1 'SCRIPT_VERSION=' "$1")
|
||||||
|
version_line=${version_line#*=}
|
||||||
|
version_line=${version_line#\"}
|
||||||
|
version_line=${version_line%-dev\"}
|
||||||
|
version_line=${version_line%\"}
|
||||||
|
echo "$version_line"
|
||||||
|
}
|
||||||
|
|
||||||
# Check if we're in a git directory and if it's the installJRMC repository
|
# Check if we're in a git directory and if it's the installJRMC repository
|
||||||
if git -C "$SCRIPT_DIR" rev-parse --is-inside-work-tree &>/dev/null \
|
if git -C "$SCRIPT_DIR" rev-parse --is-inside-work-tree &>/dev/null \
|
||||||
&& [[ "$(git -C "$SCRIPT_DIR" config --get remote.origin.url)" == *"bryan/installJRMC"* ]]; then
|
&& [[ "$(git -C "$SCRIPT_DIR" config --get remote.origin.url)" == *"bryan/installJRMC"* ]]; then
|
||||||
@@ -1627,8 +1638,6 @@ update_self() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo HERE2
|
|
||||||
|
|
||||||
# Download the latest version of the script
|
# Download the latest version of the script
|
||||||
install_package --silent wget
|
install_package --silent wget
|
||||||
if command -v wget &>/dev/null; then
|
if command -v wget &>/dev/null; then
|
||||||
@@ -1639,36 +1648,16 @@ update_self() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo HERE3
|
# Compare versions and update if necessary
|
||||||
|
|
||||||
declare -p
|
|
||||||
|
|
||||||
# Extract and normalize versions using grep
|
|
||||||
local local_version
|
local local_version
|
||||||
grep -m 1 'SCRIPT_VERSION=' "$SCRIPT_PATH"
|
local_version=$(extract_version "$SCRIPT_PATH")
|
||||||
local_version=$(grep -m 1 'SCRIPT_VERSION=' "$SCRIPT_PATH")
|
|
||||||
local_version=${local_version#*=}
|
|
||||||
local_version=${local_version#\"}
|
|
||||||
local_version=${local_version%\"}
|
|
||||||
local_version=${local_version%-dev}
|
|
||||||
|
|
||||||
local remote_version
|
local remote_version
|
||||||
cat $tmp
|
remote_version=$(extract_version "$tmp")
|
||||||
grep -m 1 'SCRIPT_VERSION=' "$tmp"
|
|
||||||
remote_version=$(grep -m 1 'SCRIPT_VERSION=' "$tmp")
|
|
||||||
remote_version=${remote_version#*=}
|
|
||||||
remote_version=${remote_version#\"}
|
|
||||||
remote_version=${remote_version%\"}
|
|
||||||
remote_version=${remote_version%-dev}
|
|
||||||
|
|
||||||
echo "$remote_version, $local_version"
|
|
||||||
|
|
||||||
|
debug HERE
|
||||||
|
|
||||||
[[ -z $remote_version ]] && { rm -f "$tmp"; return 1; }
|
[[ -z $remote_version ]] && { rm -f "$tmp"; return 1; }
|
||||||
|
|
||||||
|
|
||||||
echo HERE5
|
|
||||||
|
|
||||||
if [[ $local_version < $remote_version ]]; then
|
if [[ $local_version < $remote_version ]]; then
|
||||||
echo "Newer version of installJRMC found. Updating..."
|
echo "Newer version of installJRMC found. Updating..."
|
||||||
execute mv "$tmp" "$SCRIPT_PATH"
|
execute mv "$tmp" "$SCRIPT_PATH"
|
||||||
@@ -1680,8 +1669,6 @@ update_self() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
debug "Running: ${FUNCNAME[0]} $*"
|
debug "Running: ${FUNCNAME[0]} $*"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user