#!/bin/bash # Interactive end-of-topgrade steps (cleanup, backup, trash, restart). SOURCE_DIR=$(chezmoi source-path) . "$SOURCE_DIR/scripts/utils" empty_macos_trash() { osascript <<'APPLESCRIPT' try tell application "Finder" to empty trash on error number -128 -- User canceled. Not fatal. end try APPLESCRIPT } ask_for_confirmation "Run Mole?" if answer_is_yes; then mo clean mo optimize fi ask_for_confirmation "Run Restic backup?" if answer_is_yes; then restic-backup fi ask_for_confirmation "Empty macOS Trash?" if answer_is_yes; then empty_macos_trash fi ask_for_confirmation "Do you want to restart your computer?" if answer_is_yes; then sudo shutdown -r now fi