From b4a582af341c3a4e001be3017208f1cb8adca53c Mon Sep 17 00:00:00 2001 From: Michael Wegener Date: Wed, 1 Apr 2026 17:16:48 +0200 Subject: [PATCH] feat(automation): add optimization scripts and update docs for EOD Co-authored-by: Junie --- CHANGELOG.md | 2 ++ NEXT_STEPS.md | 1 + scripts/auth-restart.sh | 49 ++++++++++++++++++++++++++ scripts/delete-users.sh | 29 +++++++++++++++ scripts/uninstall-apps.sh | 32 +++++++++++++++++ scripts/uninstall-requested.sh | 64 ++++++++++++++++++++++++++++++++++ 6 files changed, 177 insertions(+) create mode 100755 scripts/auth-restart.sh create mode 100755 scripts/delete-users.sh create mode 100755 scripts/uninstall-apps.sh create mode 100755 scripts/uninstall-requested.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 37ba7aa..cbf6742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this repository are documented in this file. ## [Unreleased] +- **Automation Optimization**: Cleaned up the MacBook by uninstalling UI-heavy software (Adobe Suite, CapCut, Microsoft Teams, etc.) and deleting unused user profiles (`awsatwareag`, `EEsatwareAG`, `firebird`) using scripted automation hooks (`scripts/uninstall-apps.sh` and `scripts/delete-users.sh`). +- **FileVault Auto-login Script**: Created `scripts/auth-restart.sh` leveraging `fdesetup authrestart` to bypass FileVault screen for headless reboots. - Updated references of OpenClaw version from `2026.3.13` to `2026.3.28` across the local documentation and gateway plugins list. - Clarified maintenance protocols in remote `luca` project documentation (`MAINTENANCE.md`), directing operators back to the `mw-macbook-pro` repository for all macOS node-specific configuration and tunnel updates. diff --git a/NEXT_STEPS.md b/NEXT_STEPS.md index 3a617cb..d738bdc 100644 --- a/NEXT_STEPS.md +++ b/NEXT_STEPS.md @@ -1,6 +1,7 @@ # Next Steps - OpenClaw MacBook Pro Node ## Immediate Tasks +- [x] **Machine Optimization**: Uninstall UI-heavy applications and delete unused user accounts to dedicate the mac specifically to automation. - [ ] **Monitor Connection Stability**: Ensure the `ai.openclaw.node` LaunchAgent maintains the SSH tunnel and node connectivity over long periods. - [ ] **TCC Permission Audit**: Periodically verify that "Screen Recording" and "Accessibility" permissions for the `node` binary remain intact after system updates. - [ ] **Log Rotation**: Implement log rotation for `~/.openclaw/logs/*.log` to prevent disk space issues on the MacBook Pro. diff --git a/scripts/auth-restart.sh b/scripts/auth-restart.sh new file mode 100755 index 0000000..393e99c --- /dev/null +++ b/scripts/auth-restart.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# scripts/auth-restart.sh +# Performs an authenticated reboot using fdesetup + +echo "Enter your Mac password to perform an authenticated restart for FileVault:" +echo "(Typing will be hidden. The Mac will reboot immediately upon success.)" +read -s -p "Password: " PASS +echo "" + +if [ -z "$PASS" ]; then + echo "Operation cancelled or no password provided." + exit 1 +fi + +echo "Verifying password..." +# Verify and cache sudo credentials so we don't have to expect the sudo prompt +echo "$PASS" | sudo -S -v 2>/dev/null + +if [ $? -ne 0 ]; then + echo "Incorrect password or sudo authorization failed." + PASS="" + exit 1 +fi + +echo "Authorization successful. Initiating FileVault authenticated restart..." + +# Run fdesetup and feed the password using expect using env variables for safety +export PASS +expect -c ' +set timeout 30 +spawn sudo fdesetup authrestart + +expect { + -re "(?i)(password|recovery key)" { + send "$env(PASS)\r" + exp_continue + } + timeout { + puts "\nError: Timeout waiting for fdesetup prompt." + exit 1 + } + eof { + puts "\nAuthenticated restart initiated." + exit 0 + } +} +' + +PASS="" \ No newline at end of file diff --git a/scripts/delete-users.sh b/scripts/delete-users.sh new file mode 100755 index 0000000..63aa2a4 --- /dev/null +++ b/scripts/delete-users.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# macOS script to delete unused user accounts +# Removes specified users to optimize machine for dedicated automation tasks + +USERS_TO_DELETE=("awsatwareag" "EEsatwareAG" "firebird") + +echo "Starting user account deletion..." + +for user in "${USERS_TO_DELETE[@]}"; do + # Check if the user exists in Directory Services + if dscl . -read "/Users/$user" > /dev/null 2>&1; then + echo "Deleting user: $user" + sudo sysadminctl -deleteUser "$user" + fi + + # Ensure home directory is completely removed + if [ -d "/Users/$user" ]; then + echo "Removing residual home directory: /Users/$user" + sudo rm -rf "/Users/$user" + fi + + # Check if neither existed + if ! dscl . -read "/Users/$user" > /dev/null 2>&1 && [ ! -d "/Users/$user" ]; then + echo "Not found or completely removed: $user" + fi +done + +echo "User account deletion script complete." \ No newline at end of file diff --git a/scripts/uninstall-apps.sh b/scripts/uninstall-apps.sh new file mode 100755 index 0000000..ea59418 --- /dev/null +++ b/scripts/uninstall-apps.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# macOS uninstallation script for UI-heavy applications +# Generated to optimize the machine for automation tasks + +APPS=( + "/Applications/Adobe Acrobat DC" + "/Applications/Adobe Creative Cloud" + "/Applications/Adobe Media Encoder 2025" + "/Applications/CapCut.app" + "/Applications/Mattermost.app" + "/Applications/Microsoft Teams.app" + "/Applications/WhatsApp.app" + "/Applications/eM Client.app" + "/Applications/Prime Video.app" + "/Applications/wand.app" + "/Applications/UP Studio3.app" + "/Applications/Numbers.app" +) + +echo "Starting uninstallation of UI-heavy applications..." + +for app in "${APPS[@]}"; do + if [ -e "$app" ]; then + echo "Removing: $app" + sudo rm -rf "$app" + else + echo "Not found (already removed): $app" + fi +done + +echo "Uninstallation script complete." \ No newline at end of file diff --git a/scripts/uninstall-requested.sh b/scripts/uninstall-requested.sh new file mode 100755 index 0000000..bb57e91 --- /dev/null +++ b/scripts/uninstall-requested.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +echo "Uninstalling Adobe Services, GOG, TeamViewer, Firebird, and Tunnelblick..." + +# 1. Kill processes +echo "Killing related processes..." +sudo killall -9 TeamViewer "GOG Galaxy" Tunnelblick "Adobe Desktop Service" CCXProcess CoreSync "Adobe CCXProcess" "Creative Cloud" AdobeIPCBroker "Adobe CEF Helper" fbserver gds_drop 2>/dev/null || true + +# 2. Unload Launch Daemons +echo "Unloading System Daemons..." +for daemon in /Library/LaunchDaemons/com.teamviewer.* /Library/LaunchDaemons/com.gog.* /Library/LaunchDaemons/net.tunnelblick.* /Library/LaunchDaemons/org.firebird.* /Library/LaunchDaemons/com.adobe.*; do + if [ -f "$daemon" ]; then + sudo launchctl unload "$daemon" 2>/dev/null || true + sudo rm -f "$daemon" + fi +done + +# 3. Unload Launch Agents +echo "Unloading System Agents..." +for agent in /Library/LaunchAgents/com.teamviewer.* /Library/LaunchAgents/com.gog.* /Library/LaunchAgents/com.adobe.*; do + if [ -f "$agent" ]; then + # Try both older unload and newer bootout just in case + sudo launchctl unload "$agent" 2>/dev/null || true + for uid in $(dscl . -list /Users UniqueID | awk '$2 >= 500 {print $2}'); do + sudo launchctl bootout gui/$uid "$agent" 2>/dev/null || true + done + sudo rm -f "$agent" + fi +done + +echo "Unloading User Agents..." +for user_agent in ~/Library/LaunchAgents/com.adobe.*; do + if [ -f "$user_agent" ]; then + launchctl unload "$user_agent" 2>/dev/null || true + rm -f "$user_agent" + fi +done + +# 4. Remove App Directories +echo "Removing Application Files..." +sudo rm -rf "/Applications/TeamViewer.app" +sudo rm -rf "/Applications/GOG Galaxy.app" +sudo rm -rf "/Applications/Tunnelblick.app" + +# Firebird standard manual installation locations +sudo rm -rf "/Library/Frameworks/Firebird.framework" +sudo rm -rf "/opt/firebird" + +# Common Adobe paths +sudo rm -rf "/Applications/Adobe"* +sudo rm -rf "/Applications/Utilities/Adobe"* + +# Application Support +sudo rm -rf "/Library/Application Support/Adobe" +sudo rm -rf "/Library/Application Support/TeamViewer" +sudo rm -rf "/Library/Application Support/GOG.com" +sudo rm -rf "/Library/Application Support/Tunnelblick" + +# Try homebrew just in case some were installed via brew casks +echo "Checking Homebrew casks..." +brew uninstall --cask tunnelblick teamviewer gog-galaxy 2>/dev/null || true +brew uninstall firebird 2>/dev/null || true + +echo "Uninstallation finished successfully."