-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_complete.sh
More file actions
95 lines (74 loc) · 2.75 KB
/
Copy pathupdate_complete.sh
File metadata and controls
95 lines (74 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Complete update script - Terminate processes, download and apply updates
echo "🔄 Starting complete update process..."
# 1. Terminate related processes
echo "🛑 Terminating related processes..."
pkill -f "python3.*arc_gui.py" || true
pkill -f "Converter.app" || true
pkill -f "python.*Converter" || true
# Wait for processes to end
echo "⏳ Waiting for processes to end..."
sleep 3
# Force terminate still running processes
echo "🔨 Force terminating still running processes..."
pkill -9 -f "python3.*arc_gui.py" || true
pkill -9 -f "Converter.app" || true
pkill -9 -f "python.*Converter" || true
# Wait again
echo "⏳ Waiting again..."
sleep 2
# 2. Execute Python update script
echo "🚀 Starting to download and apply updates..."
cd /Users/li/Documents/GitHub/Converter
python3 -c "
import sys
import os
sys.path.insert(0, '.')
try:
from update.update_manager import UpdateManager
from update.download_update import download_and_apply_update
print('🔄 Starting to check for updates...')
# Get current version
current_version = '2.0.0RC1'
print(f'📍 Current version: {current_version}')
# Create update manager
update_manager = UpdateManager(current_version)
# Check for updates
update_info = update_manager.check_for_updates(include_prerelease=True)
if not update_info:
print('❌ Unable to get update information')
sys.exit(1)
if update_info.get('status') != 'update_available':
print(f'✅ Already up to date: {update_info.get(\"message\", \"Unknown\")}')
sys.exit(0)
print(f'📦 New version found: {update_info.get(\"latest_version\", \"Unknown\")}')
# Define progress callback function
def progress_callback(progress, downloaded, total):
if total > 0:
percent = progress
print(f'⏳ Download progress: {percent}% ({downloaded}/{total} bytes)')
else:
print(f'⏳ Downloaded: {downloaded} bytes')
print('🚀 Starting to download update...')
result = download_and_apply_update(update_info, progress_callback)
if result['status'] == 'success':
print('✅ Update downloaded successfully, preparing to apply...')
print('🔄 Application will exit and apply update')
sys.exit(0)
else:
print(f'❌ Update failed: {result.get(\"message\", \"Unknown error\")}')
sys.exit(1)
except Exception as e:
print(f'❌ Update process failed: {e}')
import traceback
traceback.print_exc()
sys.exit(1)
"
# Check Python script execution result
if [ $? -eq 0 ]; then
echo "✅ Update process completed successfully"
else
echo "❌ Update process failed"
exit 1
fi
echo "🎉 All update operations completed!"