mirror of
https://github.com/tw93/Mole.git
synced 2026-02-14 20:32:28 +00:00
Fix the problems of remove and reinstall
This commit is contained in:
36
install.sh
36
install.sh
@@ -236,17 +236,35 @@ check_requirements() {
|
|||||||
|
|
||||||
# Check if already installed via Homebrew
|
# Check if already installed via Homebrew
|
||||||
if command -v brew > /dev/null 2>&1 && brew list mole > /dev/null 2>&1; then
|
if command -v brew > /dev/null 2>&1 && brew list mole > /dev/null 2>&1; then
|
||||||
if [[ "$ACTION" == "update" ]]; then
|
# Verify that mole executable actually exists and is from Homebrew
|
||||||
return 0
|
local mole_path
|
||||||
|
mole_path=$(command -v mole 2> /dev/null || true)
|
||||||
|
local is_homebrew_binary=false
|
||||||
|
|
||||||
|
if [[ -n "$mole_path" && -L "$mole_path" ]]; then
|
||||||
|
if readlink "$mole_path" | grep -q "Cellar/mole"; then
|
||||||
|
is_homebrew_binary=true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${YELLOW}Mole is installed via Homebrew${NC}"
|
# Only block installation if Homebrew binary actually exists
|
||||||
echo ""
|
if [[ "$is_homebrew_binary" == "true" ]]; then
|
||||||
echo "Choose one:"
|
if [[ "$ACTION" == "update" ]]; then
|
||||||
echo -e " 1. Update via Homebrew: ${GREEN}brew upgrade mole${NC}"
|
return 0
|
||||||
echo -e " 2. Switch to manual: ${GREEN}brew uninstall mole${NC} then re-run this"
|
fi
|
||||||
echo ""
|
|
||||||
exit 1
|
echo -e "${YELLOW}Mole is installed via Homebrew${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "Choose one:"
|
||||||
|
echo -e " 1. Update via Homebrew: ${GREEN}brew upgrade mole${NC}"
|
||||||
|
echo -e " 2. Switch to manual: ${GREEN}brew uninstall --force mole${NC} then re-run this"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
# Brew has mole in database but binary doesn't exist - clean up
|
||||||
|
log_warning "Cleaning up stale Homebrew installation..."
|
||||||
|
brew uninstall --force mole > /dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if install directory exists and is writable
|
# Check if install directory exists and is writable
|
||||||
|
|||||||
4
mole
4
mole
@@ -25,7 +25,7 @@ source "$SCRIPT_DIR/lib/core/common.sh"
|
|||||||
trap cleanup_temp_files EXIT INT TERM
|
trap cleanup_temp_files EXIT INT TERM
|
||||||
|
|
||||||
# Version info
|
# Version info
|
||||||
VERSION="1.15.7"
|
VERSION="1.15.8"
|
||||||
MOLE_TAGLINE="Deep clean and optimize your Mac."
|
MOLE_TAGLINE="Deep clean and optimize your Mac."
|
||||||
|
|
||||||
# Check TouchID configuration
|
# Check TouchID configuration
|
||||||
@@ -557,7 +557,7 @@ remove_mole() {
|
|||||||
# Remove Homebrew installation (silent)
|
# Remove Homebrew installation (silent)
|
||||||
local has_error=false
|
local has_error=false
|
||||||
if [[ "$is_homebrew" == "true" ]]; then
|
if [[ "$is_homebrew" == "true" ]]; then
|
||||||
if ! brew uninstall mole > /dev/null 2>&1; then
|
if ! brew uninstall --force mole > /dev/null 2>&1; then
|
||||||
has_error=true
|
has_error=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user