mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 15:39:42 +00:00
Fix update output version parsing
This commit is contained in:
5
mole
5
mole
@@ -13,7 +13,7 @@ source "$SCRIPT_DIR/lib/core/commands.sh"
|
|||||||
trap cleanup_temp_files EXIT INT TERM
|
trap cleanup_temp_files EXIT INT TERM
|
||||||
|
|
||||||
# Version and update helpers
|
# Version and update helpers
|
||||||
VERSION="1.23.1"
|
VERSION="1.23.2"
|
||||||
MOLE_TAGLINE="Deep clean and optimize your Mac."
|
MOLE_TAGLINE="Deep clean and optimize your Mac."
|
||||||
|
|
||||||
is_touchid_configured() {
|
is_touchid_configured() {
|
||||||
@@ -347,7 +347,10 @@ update_mole() {
|
|||||||
|
|
||||||
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
||||||
local new_version
|
local new_version
|
||||||
|
new_version=$(printf '%s\n' "$output" | sed -n 's/.*(version \([^)]*\)).*/\1/p' | head -1)
|
||||||
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version=$("$mole_path" --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
new_version=$("$mole_path" --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||||
|
fi
|
||||||
if [[ -z "$new_version" ]]; then
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version="$fallback_version"
|
new_version="$fallback_version"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -253,7 +253,10 @@ process_install_output() {
|
|||||||
|
|
||||||
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
||||||
local new_version
|
local new_version
|
||||||
|
new_version=$(printf '%s\n' "$output" | sed -n 's/.*(version \([^)]*\)).*/\1/p' | head -1)
|
||||||
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||||
|
fi
|
||||||
if [[ -z "$new_version" ]]; then
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version="$fallback_version"
|
new_version="$fallback_version"
|
||||||
fi
|
fi
|
||||||
@@ -262,7 +265,7 @@ process_install_output() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output="Installing Mole...
|
output="Installing Mole...
|
||||||
✓ Updated to latest version (1.23.1)"
|
◎ Mole installed successfully (version 1.23.1)"
|
||||||
process_install_output "$output" "1.23.0"
|
process_install_output "$output" "1.23.0"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@@ -290,7 +293,10 @@ process_install_output() {
|
|||||||
|
|
||||||
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
||||||
local new_version
|
local new_version
|
||||||
|
new_version=$(printf '%s\n' "$output" | sed -n 's/.*(version \([^)]*\)).*/\1/p' | head -1)
|
||||||
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||||
|
fi
|
||||||
if [[ -z "$new_version" ]]; then
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version="$fallback_version"
|
new_version="$fallback_version"
|
||||||
fi
|
fi
|
||||||
@@ -327,7 +333,10 @@ process_install_output() {
|
|||||||
|
|
||||||
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
||||||
local new_version
|
local new_version
|
||||||
|
new_version=$(printf '%s\n' "$output" | sed -n 's/.*(version \([^)]*\)).*/\1/p' | head -1)
|
||||||
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||||
|
fi
|
||||||
if [[ -z "$new_version" ]]; then
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version="$fallback_version"
|
new_version="$fallback_version"
|
||||||
fi
|
fi
|
||||||
@@ -362,7 +371,10 @@ process_install_output() {
|
|||||||
|
|
||||||
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
if ! printf '%s\n' "$output" | grep -Eq "Updated to latest version|Already on latest version"; then
|
||||||
local new_version
|
local new_version
|
||||||
|
new_version=$(printf '%s\n' "$output" | sed -n 's/.*(version \([^)]*\)).*/\1/p' | head -1)
|
||||||
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
new_version=$(command -v mo > /dev/null 2>&1 && mo --version 2> /dev/null | awk 'NR==1 && NF {print $NF}' || echo "")
|
||||||
|
fi
|
||||||
if [[ -z "$new_version" ]]; then
|
if [[ -z "$new_version" ]]; then
|
||||||
new_version="$fallback_version"
|
new_version="$fallback_version"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user