Initial commit: combine nas_tool, nas_webdav, sync-utils

This commit is contained in:
Gan, Jimmy
2026-02-18 22:59:43 +08:00
commit 526c6a5521
77 changed files with 7898 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
#!/bin/bash
# Find ANY Freeable Space - Check everything
set -e
echo "=== Find Any Freeable Space ==="
echo ""
FREE_SPACE=$(df / | tail -1 | awk '{print $4}')
FREE_SPACE_GB=$(echo "scale=2; $FREE_SPACE / 1024 / 1024" | bc)
echo "Current free space: ${FREE_SPACE_GB}GB"
echo ""
echo "🔍 Checking all possible sources of space:"
echo ""
TOTAL_POTENTIAL=0
# 1. Caches
echo "1. Caches:"
CACHE_SIZE=$(du -sh ~/Library/Caches 2>/dev/null | awk '{print $1}' || echo "0")
echo " Library/Caches: $CACHE_SIZE"
if [ "$CACHE_SIZE" != "0" ] && [ -n "$CACHE_SIZE" ]; then
CACHE_GB=$(echo "$CACHE_SIZE" | sed 's/G//' | awk '{if ($1 ~ /[0-9]/) print $1; else print "0"}')
TOTAL_POTENTIAL=$(echo "$TOTAL_POTENTIAL + $CACHE_GB" | bc 2>/dev/null || echo "$TOTAL_POTENTIAL")
fi
USER_CACHE=$(du -sh ~/.cache 2>/dev/null | awk '{print $1}' || echo "0")
echo " .cache: $USER_CACHE"
NPM_CACHE=$(du -sh ~/.npm 2>/dev/null | awk '{print $1}' || echo "0")
echo " .npm: $NPM_CACHE"
echo ""
# 2. Downloads
DOWNLOADS=$(du -sh ~/Downloads 2>/dev/null | awk '{print $1}' || echo "0")
echo "2. Downloads: $DOWNLOADS"
echo ""
# 3. Trash
TRASH=$(du -sh ~/.Trash 2>/dev/null | awk '{print $1}' || echo "0")
echo "3. Trash: $TRASH"
echo ""
# 4. Virtual memory
VM_SIZE=$(sudo du -sh /private/var/vm 2>/dev/null | awk '{print $1}' || echo "0")
echo "4. Virtual Memory (swap): $VM_SIZE"
echo ""
# 5. System temp
TEMP_SIZE=$(sudo du -sh /private/var/folders 2>/dev/null | awk '{print $1}' || echo "0")
echo "5. System Temp: $TEMP_SIZE"
echo ""
# 6. Large directories
echo "6. Large Directories:"
OLLAMA=$(du -sh ~/.ollama 2>/dev/null | awk '{print $1}' || echo "0")
echo " .ollama: $OLLAMA"
LOCAL=$(du -sh ~/.local 2>/dev/null | awk '{print $1}' || echo "0")
echo " .local: $LOCAL"
echo ""
# 7. Documents remaining
DOCS=$(du -sh ~/Documents 2>/dev/null | awk '{print $1}' || echo "0")
echo "7. Documents remaining: $DOCS"
echo ""
echo "=== Analysis ==="
echo ""
echo "The problem: Even if we free space, the OS snapshot will preserve"
echo "deleted files, making System Data grow instead."
echo ""
echo "=== Desperate Measures ==="
echo ""
echo "Since normal methods don't work, try:"
echo ""
echo "1. **Restart your Mac**"
echo " Sometimes releases some purgeable space temporarily"
echo ""
echo "2. **Try downloading update with current space**"
echo " sudo softwareupdate --download --all"
echo " (May work even with less than 17.64GB)"
echo ""
echo "3. **Check if update can install incrementally**"
echo " System Settings → General → Software Update"
echo " Click 'More Info' to see if it can download in parts"
echo ""
echo "4. **Use external drive** (if available)"
echo " - Connect external drive"
echo " - Move large files there (not NAS)"
echo " - Install update"
echo " - Move files back"
echo ""
echo "5. **Contact Apple Support**"
echo " They may have tools to force-clear the snapshot"
echo " Or can help with the update process"
echo ""
echo "=== The Real Issue ==="
echo ""
echo "The OS update snapshot is blocking everything."
echo "You need to update macOS, but need space to update."
echo "This is a system-level catch-22 that may require"
echo "Apple Support intervention or external storage."
echo ""