1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 17:24:45 +00:00
This commit is contained in:
Tw93
2025-12-16 18:03:14 +08:00
parent 470d376f1c
commit bde4e16a43
2 changed files with 13 additions and 1 deletions

View File

@@ -289,6 +289,9 @@ _perform_appstore_update() {
appstore_log=$(mktemp "${TMPDIR:-/tmp}/mole-appstore.XXXXXX" 2> /dev/null || echo "/tmp/mole-appstore.log") appstore_log=$(mktemp "${TMPDIR:-/tmp}/mole-appstore.XXXXXX" 2> /dev/null || echo "/tmp/mole-appstore.log")
if [[ "$appstore_needs_fallback" == "true" ]]; then if [[ "$appstore_needs_fallback" == "true" ]]; then
# Ensure sudo session is active and valid before starting long-running operation
ensure_sudo_session "App Store updates require admin access" || return 1
echo -e " ${GRAY}Installing all available updates${NC}" echo -e " ${GRAY}Installing all available updates${NC}"
echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}" echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}"
if sudo softwareupdate -i -a 2>&1 | tee "$appstore_log" | grep -v "^$"; then if sudo softwareupdate -i -a 2>&1 | tee "$appstore_log" | grep -v "^$"; then
@@ -302,6 +305,9 @@ _perform_appstore_update() {
echo -e "${RED}${NC} Software update failed" echo -e "${RED}${NC} Software update failed"
fi fi
else else
# Ensure sudo session is active and valid before starting long-running operation
ensure_sudo_session "App Store updates require admin access" || return 1
echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}" echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}"
if sudo softwareupdate -i "${appstore_labels[@]}" 2>&1 | tee "$appstore_log" | grep -v "^$"; then if sudo softwareupdate -i "${appstore_labels[@]}" 2>&1 | tee "$appstore_log" | grep -v "^$"; then
echo -e "${GREEN}${NC} App Store apps updated" echo -e "${GREEN}${NC} App Store apps updated"
@@ -324,6 +330,9 @@ _perform_macos_update() {
macos_log=$(mktemp "${TMPDIR:-/tmp}/mole-macos.XXXXXX" 2> /dev/null || echo "/tmp/mole-macos.log") macos_log=$(mktemp "${TMPDIR:-/tmp}/mole-macos.XXXXXX" 2> /dev/null || echo "/tmp/mole-macos.log")
if [[ "$macos_needs_fallback" == "true" ]]; then if [[ "$macos_needs_fallback" == "true" ]]; then
# Ensure sudo session is active and valid before starting long-running operation
ensure_sudo_session "macOS update requires admin access" || return 1
echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}" echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}"
if sudo softwareupdate -i -r 2>&1 | tee "$macos_log" | grep -v "^$"; then if sudo softwareupdate -i -r 2>&1 | tee "$macos_log" | grep -v "^$"; then
echo -e "${GREEN}${NC} macOS updated" echo -e "${GREEN}${NC} macOS updated"
@@ -332,6 +341,9 @@ _perform_macos_update() {
echo -e "${RED}${NC} macOS update failed" echo -e "${RED}${NC} macOS update failed"
fi fi
else else
# Ensure sudo session is active and valid before starting long-running operation
ensure_sudo_session "macOS update requires admin access" || return 1
echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}" echo -e " ${GRAY}Contacting Apple servers (this may take a few minutes)...${NC}"
if sudo softwareupdate -i "${macos_labels[@]}" 2>&1 | tee "$macos_log" | grep -v "^$"; then if sudo softwareupdate -i "${macos_labels[@]}" 2>&1 | tee "$macos_log" | grep -v "^$"; then
echo -e "${GREEN}${NC} macOS updated" echo -e "${GREEN}${NC} macOS updated"

2
mole
View File

@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/core/common.sh" source "$SCRIPT_DIR/lib/core/common.sh"
# Version info # Version info
VERSION="1.13.2" VERSION="1.13.3"
MOLE_TAGLINE="can dig deep to clean your Mac." MOLE_TAGLINE="can dig deep to clean your Mac."
# Check if Touch ID is already configured # Check if Touch ID is already configured