@halilertekin/macos-system-cleaner 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +318 -0
- package/README.tr.md +318 -0
- package/install.sh +155 -0
- package/macos-system-cleaner.rb +45 -0
- package/main_cleaner.sh +173 -0
- package/package.json +40 -0
- package/scripts/brew_update_with_cache.sh +12 -0
- package/scripts/cache_cleaner.sh +200 -0
- package/scripts/ide_cleaner.sh +273 -0
- package/scripts/ram_cleaner.sh +146 -0
- package/update_formula_sha.sh +265 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# IDE ve Xcode Önbellek Temizleyici Script
|
|
4
|
+
# macOS sistemlerde IDE ve Xcode önbelleklerini analiz ve temizler
|
|
5
|
+
|
|
6
|
+
set -e # Hatalarda çık
|
|
7
|
+
|
|
8
|
+
# Renkler
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m' # Renksiz
|
|
14
|
+
|
|
15
|
+
# Renkli çıktı fonksiyonları
|
|
16
|
+
print_status() {
|
|
17
|
+
echo -e "${BLUE}[BİLGİ]${NC} $1"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
print_success() {
|
|
21
|
+
echo -e "${GREEN}[BAŞARILI]${NC} $1"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
print_warning() {
|
|
25
|
+
echo -e "${YELLOW}[UYARI]${NC} $1"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
print_error() {
|
|
29
|
+
echo -e "${RED}[HATA]${NC} $1"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# IDE klasörlerini bul
|
|
33
|
+
find_ides() {
|
|
34
|
+
print_status "IDE klasörleri aranıyor..."
|
|
35
|
+
|
|
36
|
+
# Android Studio klasörlerini bul
|
|
37
|
+
android_studio_dirs=($(find ~/Library -name "*AndroidStudio*" -type d 2>/dev/null))
|
|
38
|
+
if [ ${#android_studio_dirs[@]} -gt 0 ]; then
|
|
39
|
+
echo "Bulunan Android Studio klasörleri:"
|
|
40
|
+
for dir in "${android_studio_dirs[@]}"; do
|
|
41
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
42
|
+
echo " - $dir ($size)"
|
|
43
|
+
done
|
|
44
|
+
else
|
|
45
|
+
echo "Android Studio klasörü bulunamadı"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# IntelliJ IDEA klasörlerini bul
|
|
49
|
+
intellij_dirs=($(find ~/Library -name "*IntelliJIdea*" -type d 2>/dev/null))
|
|
50
|
+
if [ ${#intellij_dirs[@]} -gt 0 ]; then
|
|
51
|
+
echo -e "\nBulunan IntelliJ IDEA klasörleri:"
|
|
52
|
+
for dir in "${intellij_dirs[@]}"; do
|
|
53
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
54
|
+
echo " - $dir ($size)"
|
|
55
|
+
done
|
|
56
|
+
else
|
|
57
|
+
echo -e "\nIntelliJ IDEA klasörü bulunamadı"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# PyCharm klasörlerini bul
|
|
61
|
+
pycharm_dirs=($(find ~/Library -name "*PyCharm*" -type d 2>/dev/null))
|
|
62
|
+
if [ ${#pycharm_dirs[@]} -gt 0 ]; then
|
|
63
|
+
echo -e "\nBulunan PyCharm klasörleri:"
|
|
64
|
+
for dir in "${pycharm_dirs[@]}"; do
|
|
65
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
66
|
+
echo " - $dir ($size)"
|
|
67
|
+
done
|
|
68
|
+
else
|
|
69
|
+
echo -e "\nPyCharm klasörü bulunamadı"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# GoLand, WebStorm, CLion, PhpStorm, Rider klasörlerini bul
|
|
73
|
+
jetbrains_dirs=($(find ~/Library -name "*GoLand*" -type d 2>/dev/null; find ~/Library -name "*WebStorm*" -type d 2>/dev/null; find ~/Library -name "*CLion*" -type d 2>/dev/null; find ~/Library -name "*PhpStorm*" -type d 2>/dev/null; find ~/Library -name "*Rider*" -type d 2>/dev/null; find ~/Library -name "*AppCode*" -type d 2>/dev/null; find ~/Library -name "*DataGrip*" -type d 2>/dev/null; find ~/Library -name "*RubyMine*" -type d 2>/dev/null))
|
|
74
|
+
if [ ${#jetbrains_dirs[@]} -gt 0 ]; then
|
|
75
|
+
echo -e "\nBulunan diğer JetBrains IDE'leri:"
|
|
76
|
+
for dir in "${jetbrains_dirs[@]}"; do
|
|
77
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
78
|
+
echo " - $dir ($size)"
|
|
79
|
+
done
|
|
80
|
+
else
|
|
81
|
+
echo -e "\nDiğer JetBrains IDE klasörleri bulunamadı"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# Visual Studio Code klasörlerini bul
|
|
85
|
+
vscode_cache_dirs=()
|
|
86
|
+
if [ -d "~/Library/Application Support/Code" ]; then
|
|
87
|
+
echo -e "\nVS Code klasörleri:"
|
|
88
|
+
size=$(du -sh ~/Library/Application\ Support/Code 2>/dev/null | cut -f1)
|
|
89
|
+
echo " - ~/Library/Application Support/Code ($size)"
|
|
90
|
+
vscode_cache_dirs+=("~/Library/Application Support/Code")
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
# Xcode DerivedData klasörlerini bul
|
|
94
|
+
xcode_derived_data=$(find ~/Library -name "DerivedData" -type d -path "*/Xcode/*" 2>/dev/null | head -1)
|
|
95
|
+
if [ -n "$xcode_derived_data" ]; then
|
|
96
|
+
echo -e "\nXcode DerivedData klasörü:"
|
|
97
|
+
size=$(du -sh "$xcode_derived_data" 2>/dev/null | cut -f1)
|
|
98
|
+
echo " - $xcode_derived_data ($size)"
|
|
99
|
+
else
|
|
100
|
+
print_warning "Xcode DerivedData klasörü bulunamadı"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# Xcode Archive klasörlerini bul
|
|
104
|
+
xcode_archives=$(find ~/Library -name "Archives" -type d -path "*/Xcode/*" 2>/dev/null | head -1)
|
|
105
|
+
if [ -n "$xcode_archives" ]; then
|
|
106
|
+
echo -e "\nXcode Archive klasörü:"
|
|
107
|
+
size=$(du -sh "$xcode_archives" 2>/dev/null | cut -f1)
|
|
108
|
+
echo " - $xcode_archives ($size)"
|
|
109
|
+
else
|
|
110
|
+
print_warning "Xcode Archive klasörü bulunamadı"
|
|
111
|
+
fi
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# IDE önbelleklerini temizle
|
|
115
|
+
clean_ides() {
|
|
116
|
+
print_warning "Bu işlem IDE önbelleklerini silecektir. IDE'lerin yeniden başlatılması gerekebilir."
|
|
117
|
+
read -p "Devam etmek istiyor musunuz? (e/H): " -n 1 -r
|
|
118
|
+
echo
|
|
119
|
+
if [[ $REPLY =~ ^[Ee]$ ]]; then
|
|
120
|
+
print_status "IDE önbellekleri temizleniyor..."
|
|
121
|
+
|
|
122
|
+
# Android Studio klasörlerini temizle
|
|
123
|
+
android_studio_dirs=($(find ~/Library -name "*AndroidStudio*" -type d 2>/dev/null))
|
|
124
|
+
for dir in "${android_studio_dirs[@]}"; do
|
|
125
|
+
if [ -d "$dir" ]; then
|
|
126
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
127
|
+
print_status "Android Studio klasörü temizleniyor: $dir ($size)..."
|
|
128
|
+
rm -rf "$dir"/*
|
|
129
|
+
print_success "Android Studio klasörü temizlendi: $dir"
|
|
130
|
+
fi
|
|
131
|
+
done
|
|
132
|
+
|
|
133
|
+
# IntelliJ IDEA klasörlerini temizle
|
|
134
|
+
intellij_dirs=($(find ~/Library -name "*IntelliJIdea*" -type d 2>/dev/null))
|
|
135
|
+
for dir in "${intellij_dirs[@]}"; do
|
|
136
|
+
if [ -d "$dir" ]; then
|
|
137
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
138
|
+
print_status "IntelliJ IDEA klasörü temizleniyor: $dir ($size)..."
|
|
139
|
+
rm -rf "$dir"/*
|
|
140
|
+
print_success "IntelliJ IDEA klasörü temizlendi: $dir"
|
|
141
|
+
fi
|
|
142
|
+
done
|
|
143
|
+
|
|
144
|
+
# PyCharm klasörlerini temizle
|
|
145
|
+
pycharm_dirs=($(find ~/Library -name "*PyCharm*" -type d 2>/dev/null))
|
|
146
|
+
for dir in "${pycharm_dirs[@]}"; do
|
|
147
|
+
if [ -d "$dir" ]; then
|
|
148
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
149
|
+
print_status "PyCharm klasörü temizleniyor: $dir ($size)..."
|
|
150
|
+
rm -rf "$dir"/*
|
|
151
|
+
print_success "PyCharm klasörü temizlendi: $dir"
|
|
152
|
+
fi
|
|
153
|
+
done
|
|
154
|
+
|
|
155
|
+
# Diğer JetBrains IDE'lerini temizle
|
|
156
|
+
jetbrains_dirs=($(find ~/Library -name "*GoLand*" -type d 2>/dev/null; find ~/Library -name "*WebStorm*" -type d 2>/dev/null; find ~/Library -name "*CLion*" -type d 2>/dev/null; find ~/Library -name "*PhpStorm*" -type d 2>/dev/null; find ~/Library -name "*Rider*" -type d 2>/dev/null; find ~/Library -name "*AppCode*" -type d 2>/dev/null; find ~/Library -name "*DataGrip*" -type d 2>/dev/null; find ~/Library -name "*RubyMine*" -type d 2>/dev/null))
|
|
157
|
+
for dir in "${jetbrains_dirs[@]}"; do
|
|
158
|
+
if [ -d "$dir" ]; then
|
|
159
|
+
size=$(du -sh "$dir" 2>/dev/null | cut -f1)
|
|
160
|
+
print_status "JetBrains IDE klasörü temizleniyor: $dir ($size)..."
|
|
161
|
+
rm -rf "$dir"/*
|
|
162
|
+
print_success "JetBrains IDE klasörü temizlendi: $dir"
|
|
163
|
+
fi
|
|
164
|
+
done
|
|
165
|
+
|
|
166
|
+
# VS Code klasörlerini temizle
|
|
167
|
+
if [ -d "~/Library/Application Support/Code" ]; then
|
|
168
|
+
size=$(du -sh ~/Library/Application\ Support/Code 2>/dev/null | cut -f1)
|
|
169
|
+
print_status "VS Code klasörü temizleniyor: ~/Library/Application Support/Code ($size)..."
|
|
170
|
+
rm -rf ~/Library/Application\ Support/Code/*
|
|
171
|
+
print_success "VS Code klasörü temizlendi"
|
|
172
|
+
fi
|
|
173
|
+
|
|
174
|
+
# Xcode DerivedData klasörünü temizle
|
|
175
|
+
xcode_derived_data=$(find ~/Library -name "DerivedData" -type d -path "*/Xcode/*" 2>/dev/null | head -1)
|
|
176
|
+
if [ -n "$xcode_derived_data" ]; then
|
|
177
|
+
size=$(du -sh "$xcode_derived_data" 2>/dev/null | cut -f1)
|
|
178
|
+
print_status "Xcode DerivedData klasörü temizleniyor: $xcode_derived_data ($size)..."
|
|
179
|
+
rm -rf "$xcode_derived_data"/*
|
|
180
|
+
print_success "Xcode DerivedData klasörü temizlendi"
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# Xcode Archive klasörünü temizle
|
|
184
|
+
xcode_archives=$(find ~/Library -name "Archives" -type d -path "*/Xcode/*" 2>/dev/null | head -1)
|
|
185
|
+
if [ -n "$xcode_archives" ]; then
|
|
186
|
+
size=$(du -sh "$xcode_archives" 2>/dev/null | cut -f1)
|
|
187
|
+
print_status "Xcode Archive klasörü temizleniyor: $xcode_archives ($size)..."
|
|
188
|
+
rm -rf "$xcode_archives"/*
|
|
189
|
+
print_success "Xcode Archive klasörü temizlendi"
|
|
190
|
+
fi
|
|
191
|
+
|
|
192
|
+
print_success "Tüm IDE önbellekleri temizlendi"
|
|
193
|
+
else
|
|
194
|
+
print_warning "İşlem iptal edildi."
|
|
195
|
+
fi
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
# Xcode özel temizlik işlemleri
|
|
199
|
+
clean_xcode_specific() {
|
|
200
|
+
print_status "Xcode'a özel temizlik işlemleri yapılıyor..."
|
|
201
|
+
|
|
202
|
+
# iOS cihaz yedekleri
|
|
203
|
+
if [ -d "~/Library/Application Support/MobileSync/Backup" ]; then
|
|
204
|
+
size=$(du -sh ~/Library/Application\ Support/MobileSync/Backup 2>/dev/null | cut -f1)
|
|
205
|
+
print_warning "iOS cihaz yedekleri: ~/Library/Application Support/MobileSync/Backup ($size)"
|
|
206
|
+
print_warning "Bu klasör önemli veriler içerdiği için elle silinmelidir"
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
# iOS simülatör verileri
|
|
210
|
+
if [ -d "~/Library/Developer/CoreSimulator" ]; then
|
|
211
|
+
size=$(du -sh ~/Library/Developer/CoreSimulator 2>/dev/null | cut -f1)
|
|
212
|
+
print_status "iOS simülatör verileri: ~/Library/Developer/CoreSimulator ($size)"
|
|
213
|
+
read -p "iOS simülatör verilerini temizlemek ister misiniz? (e/H): " -n 1 -r
|
|
214
|
+
echo
|
|
215
|
+
if [[ $REPLY =~ ^[Ee]$ ]]; then
|
|
216
|
+
print_status "iOS simülatör verileri temizleniyor..."
|
|
217
|
+
xcrun simctl erase all
|
|
218
|
+
print_success "Tüm iOS simülatörleri silindi"
|
|
219
|
+
fi
|
|
220
|
+
fi
|
|
221
|
+
|
|
222
|
+
# Xcode cache dosyaları
|
|
223
|
+
if [ -d "~/Library/Caches/com.apple.dt.Xcode" ]; then
|
|
224
|
+
size=$(du -sh ~/Library/Caches/com.apple.dt.Xcode 2>/dev/null | cut -f1)
|
|
225
|
+
print_status "Xcode cache dosyaları: ~/Library/Caches/com.apple.dt.Xcode ($size)"
|
|
226
|
+
read -p "Xcode cache dosyalarını temizlemek ister misiniz? (e/H): " -n 1 -r
|
|
227
|
+
echo
|
|
228
|
+
if [[ $REPLY =~ ^[Ee]$ ]]; then
|
|
229
|
+
print_status "Xcode cache dosyaları temizleniyor..."
|
|
230
|
+
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
|
|
231
|
+
print_success "Xcode cache dosyaları temizlendi"
|
|
232
|
+
fi
|
|
233
|
+
fi
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
# Ana fonksiyon
|
|
237
|
+
main() {
|
|
238
|
+
case "${1:-help}" in
|
|
239
|
+
"find")
|
|
240
|
+
find_ides
|
|
241
|
+
;;
|
|
242
|
+
"clean")
|
|
243
|
+
find_ides
|
|
244
|
+
echo
|
|
245
|
+
clean_ides
|
|
246
|
+
;;
|
|
247
|
+
"xcode")
|
|
248
|
+
find_ides
|
|
249
|
+
echo
|
|
250
|
+
clean_xcode_specific
|
|
251
|
+
;;
|
|
252
|
+
"all")
|
|
253
|
+
find_ides
|
|
254
|
+
echo
|
|
255
|
+
clean_ides
|
|
256
|
+
echo
|
|
257
|
+
clean_xcode_specific
|
|
258
|
+
;;
|
|
259
|
+
"help"|*)
|
|
260
|
+
echo "Kullanım: $0 [komut]"
|
|
261
|
+
echo
|
|
262
|
+
echo "Komutlar:"
|
|
263
|
+
echo " find - IDE klasörlerini bul ve boyutlarını göster"
|
|
264
|
+
echo " clean - IDE önbelleklerini temizle"
|
|
265
|
+
echo " xcode - Xcode'a özel temizlik işlemleri"
|
|
266
|
+
echo " all - Tüm IDE'leri ve Xcode özel temizliklerini yap"
|
|
267
|
+
echo " help - Bu yardım menüsünü göster"
|
|
268
|
+
;;
|
|
269
|
+
esac
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
# Ana fonksiyonu çalıştır
|
|
273
|
+
main "$@"
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# RAM Temizleyici Script
|
|
4
|
+
# macOS sistemlerde RAM temizliği yapar ve sistem performansını artırır
|
|
5
|
+
|
|
6
|
+
set -e # Hatalarda çık
|
|
7
|
+
|
|
8
|
+
# Renkler
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m' # Renksiz
|
|
14
|
+
|
|
15
|
+
# Renkli çıktı fonksiyonları
|
|
16
|
+
print_status() {
|
|
17
|
+
echo -e "${BLUE}[BİLGİ]${NC} $1"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
print_success() {
|
|
21
|
+
echo -e "${GREEN}[BAŞARILI]${NC} $1"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
print_warning() {
|
|
25
|
+
echo -e "${YELLOW}[UYARI]${NC} $1"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
print_error() {
|
|
29
|
+
echo -e "${RED}[HATA]${NC} $1"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# RAM durumunu göster
|
|
33
|
+
show_ram_status() {
|
|
34
|
+
print_status "RAM Durumu:"
|
|
35
|
+
|
|
36
|
+
# Toplam, kullanılabilir ve kullanılan RAM miktarını göster
|
|
37
|
+
echo "$(system_profiler SPHardwareDataType | grep "Memory:" | head -1)"
|
|
38
|
+
|
|
39
|
+
# Aktif bellek kullanımı
|
|
40
|
+
memory_info=$(vm_stat)
|
|
41
|
+
pages_free=$(echo "$memory_info" | grep "free" | awk '{ print $3 }' | sed 's/\.//')
|
|
42
|
+
pages_inactive=$(echo "$memory_info" | grep "inactive" | awk '{ print $3 }' | sed 's/\.//')
|
|
43
|
+
pages_speculative=$(echo "$memory_info" | grep "speculative" | awk '{ print $3 }' | sed 's/\.//')
|
|
44
|
+
pages_active=$(echo "$memory_info" | grep "active" | awk '{ print $3 }' | sed 's/\.//')
|
|
45
|
+
pages_wired=$(echo "$memory_info" | grep "wired" | awk '{ print $3 }' | sed 's/\.//')
|
|
46
|
+
|
|
47
|
+
# Sayfa boyutu genellikle 4KB'dir
|
|
48
|
+
page_size=4096
|
|
49
|
+
free_memory=$((pages_free * page_size / 1024 / 1024))
|
|
50
|
+
inactive_memory=$((pages_inactive * page_size / 1024 / 1024))
|
|
51
|
+
speculative_memory=$((pages_speculative * page_size / 1024 / 1024))
|
|
52
|
+
active_memory=$((pages_active * page_size / 1024 / 1024))
|
|
53
|
+
wired_memory=$((pages_wired * page_size / 1024 / 1024))
|
|
54
|
+
|
|
55
|
+
echo "Boş RAM: ${free_memory}MB"
|
|
56
|
+
echo "Pasif RAM: ${inactive_memory}MB"
|
|
57
|
+
echo "Spekülatif RAM: ${speculative_memory}MB"
|
|
58
|
+
echo "Aktif RAM: ${active_memory}MB"
|
|
59
|
+
echo "Sabitlenmiş RAM: ${wired_memory}MB"
|
|
60
|
+
|
|
61
|
+
# Toplam fiziksel bellek
|
|
62
|
+
total_memory=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2$3}' | sed 's/GB/GB/' | sed 's/MB/MB/')
|
|
63
|
+
echo "Toplam Fiziksel Bellek: $total_memory"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# Disk önbelleğini temizle
|
|
67
|
+
clear_disk_cache() {
|
|
68
|
+
print_status "Disk önbelleği temizleniyor..."
|
|
69
|
+
sudo purge
|
|
70
|
+
print_success "Disk önbelleği temizlendi"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# RAM temizliği yap
|
|
74
|
+
clear_ram() {
|
|
75
|
+
print_status "RAM temizliği yapılıyor..."
|
|
76
|
+
|
|
77
|
+
# 1. Disk önbelleğini temizle
|
|
78
|
+
clear_disk_cache
|
|
79
|
+
|
|
80
|
+
# 2. Artalan süreçleri temizle
|
|
81
|
+
print_status "Artalan süreçleri temizleniyor..."
|
|
82
|
+
sudo periodic daily weekly monthly
|
|
83
|
+
|
|
84
|
+
# 3. Önbelleği temizle
|
|
85
|
+
print_status "Sistem önbelleği temizleniyor..."
|
|
86
|
+
sudo sysctl -w vm.drop_caches=1 2>/dev/null || print_warning "vm.drop_caches komutu bu sistemde desteklenmiyor"
|
|
87
|
+
|
|
88
|
+
print_success "RAM temizliği tamamlandı"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Artalan süreçleri temizle
|
|
92
|
+
kill_background_processes() {
|
|
93
|
+
print_warning "Bu işlem bazı arka plan süreçlerini sonlandırabilir."
|
|
94
|
+
read -p "Devam etmek istiyor musunuz? (e/H): " -n 1 -r
|
|
95
|
+
echo
|
|
96
|
+
if [[ $REPLY =~ ^[Ee]$ ]]; then
|
|
97
|
+
print_status "Arka plan süreçleri temizleniyor..."
|
|
98
|
+
|
|
99
|
+
# Kullanılmayan dosya tanımlayıcılarını kapat
|
|
100
|
+
sudo lsof +L1
|
|
101
|
+
|
|
102
|
+
# Artık kullanılmayan süreçleri sonlandır
|
|
103
|
+
sudo pkill -f "coreduetd" 2>/dev/null || true
|
|
104
|
+
sudo pkill -f "mds_stores" 2>/dev/null || true
|
|
105
|
+
|
|
106
|
+
print_success "Arka plan süreçleri temizlendi"
|
|
107
|
+
else
|
|
108
|
+
print_warning "İşlem iptal edildi."
|
|
109
|
+
fi
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Ana fonksiyon
|
|
113
|
+
main() {
|
|
114
|
+
case "${1:-help}" in
|
|
115
|
+
"status")
|
|
116
|
+
show_ram_status
|
|
117
|
+
;;
|
|
118
|
+
"clear")
|
|
119
|
+
show_ram_status
|
|
120
|
+
echo
|
|
121
|
+
clear_ram
|
|
122
|
+
echo
|
|
123
|
+
show_ram_status
|
|
124
|
+
;;
|
|
125
|
+
"deep")
|
|
126
|
+
show_ram_status
|
|
127
|
+
echo
|
|
128
|
+
clear_ram
|
|
129
|
+
kill_background_processes
|
|
130
|
+
echo
|
|
131
|
+
show_ram_status
|
|
132
|
+
;;
|
|
133
|
+
"help"|*)
|
|
134
|
+
echo "Kullanım: $0 [komut]"
|
|
135
|
+
echo
|
|
136
|
+
echo "Komutlar:"
|
|
137
|
+
echo " status - RAM durumunu göster"
|
|
138
|
+
echo " clear - RAM temizliği yap"
|
|
139
|
+
echo " deep - RAM temizliği + arka plan süreçleri temizliği"
|
|
140
|
+
echo " help - Bu yardım menüsünü göster"
|
|
141
|
+
;;
|
|
142
|
+
esac
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
# Ana fonksiyonu çalıştır
|
|
146
|
+
main "$@"
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Homebrew Formula SHA256 Otomatik Güncelleme Scripti
|
|
4
|
+
# GitHub'da yeni bir tag oluşturulduğunda, ilgili tarball'ın SHA256 hash'ini hesaplar
|
|
5
|
+
# ve Homebrew formula dosyasını otomatik olarak günceller
|
|
6
|
+
|
|
7
|
+
set -e # Hatalarda çık
|
|
8
|
+
|
|
9
|
+
# Renkler
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
BLUE='\033[0;34m'
|
|
14
|
+
NC='\033[0m' # Renksiz
|
|
15
|
+
|
|
16
|
+
# Renkli çıktı fonksiyonları
|
|
17
|
+
print_status() {
|
|
18
|
+
echo -e "${BLUE}[INFO]${NC} $1"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
print_success() {
|
|
22
|
+
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
print_warning() {
|
|
26
|
+
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
print_error() {
|
|
30
|
+
echo -e "${RED}[ERROR]${NC} $1"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Yardım menüsü
|
|
34
|
+
show_help() {
|
|
35
|
+
echo "Homebrew Formula SHA256 Otomatik Güncelleme Scripti"
|
|
36
|
+
echo "GitHub'da yeni tag'e göre SHA256 hash hesaplar ve formula dosyasını günceller"
|
|
37
|
+
echo
|
|
38
|
+
echo "Kullanım: $0 [seçenek] [tag]"
|
|
39
|
+
echo
|
|
40
|
+
echo "Seçenekler:"
|
|
41
|
+
echo " --update <tag> Belirtilen tag için SHA256 hash hesapla ve güncelle"
|
|
42
|
+
echo " --dry-run <tag> Sadece hesapla, güncelleme yapma (test modu)"
|
|
43
|
+
echo " --latest GitHub'dan son tag'ı al ve güncelle"
|
|
44
|
+
echo " --show-current Mevcut formula versiyonunu göster"
|
|
45
|
+
echo " --help Bu yardım menüsünü gösterir"
|
|
46
|
+
echo
|
|
47
|
+
echo "Örnekler:"
|
|
48
|
+
echo " $0 --update v1.1.0"
|
|
49
|
+
echo " $0 --latest"
|
|
50
|
+
echo " $0 --dry-run v1.1.0"
|
|
51
|
+
echo " $0 --show-current"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# SHA256 hash hesapla
|
|
55
|
+
calculate_sha256() {
|
|
56
|
+
local tag=$1
|
|
57
|
+
local repo_url="https://github.com/halilertekin/macOS-System-Cleaner/archive/refs/tags/${tag}.tar.gz"
|
|
58
|
+
|
|
59
|
+
print_status "Tarball indiriliyor: $repo_url"
|
|
60
|
+
|
|
61
|
+
# Geçici dosya oluştur
|
|
62
|
+
local temp_tarball=$(mktemp)
|
|
63
|
+
|
|
64
|
+
# Tarball'ı indir
|
|
65
|
+
if ! curl -L -o "$temp_tarball" "$repo_url"; then
|
|
66
|
+
print_error "Tarball indirilemedi: $repo_url"
|
|
67
|
+
rm -f "$temp_tarball"
|
|
68
|
+
return 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# SHA256 hash hesapla
|
|
72
|
+
local sha256_hash=$(shasum -a 256 "$temp_tarball" | cut -d ' ' -f 1)
|
|
73
|
+
|
|
74
|
+
# Geçici dosyayı sil
|
|
75
|
+
rm -f "$temp_tarball"
|
|
76
|
+
|
|
77
|
+
echo "$sha256_hash"
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# GitHub'dan son tag'ı al
|
|
81
|
+
get_latest_tag() {
|
|
82
|
+
print_status "GitHub'dan son tag alınıyor..."
|
|
83
|
+
|
|
84
|
+
# GitHub API kullanarak son tag'ı al
|
|
85
|
+
local latest_tag=$(curl -s "https://api.github.com/repos/halilertekin/macOS-System-Cleaner/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
|
86
|
+
|
|
87
|
+
if [ -z "$latest_tag" ]; then
|
|
88
|
+
print_warning "GitHub API'den tag alınamadı, yerel repodan tag aranıyor..."
|
|
89
|
+
# Yerel repoda tag varsa onu kullan
|
|
90
|
+
if git rev-parse --verify --quiet "$(git tag --list | tail -n 1)" >/dev/null 2>&1; then
|
|
91
|
+
latest_tag=$(git tag --list | tail -n 1)
|
|
92
|
+
fi
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo "$latest_tag"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Tag formatını kontrol et
|
|
99
|
+
validate_tag() {
|
|
100
|
+
local tag=$1
|
|
101
|
+
|
|
102
|
+
if [[ ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
103
|
+
print_warning "Tag formatı önerilen formatta değil (örn: v1.2.3): $tag"
|
|
104
|
+
read -p "Yine de kullanmak istiyor musunuz? (e/H): " -n 1 -r
|
|
105
|
+
echo
|
|
106
|
+
if [[ ! $REPLY =~ ^[Ee]$ ]]; then
|
|
107
|
+
print_error "İşlem iptal edildi."
|
|
108
|
+
return 1
|
|
109
|
+
fi
|
|
110
|
+
fi
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
# Formula dosyasını yedekle
|
|
114
|
+
backup_formula() {
|
|
115
|
+
local formula_file="macos-system-cleaner.rb"
|
|
116
|
+
local backup_file="${formula_file}.backup.$(date +%Y%m%d_%H%M%S)"
|
|
117
|
+
|
|
118
|
+
if [ -f "$formula_file" ]; then
|
|
119
|
+
cp "$formula_file" "$backup_file"
|
|
120
|
+
print_status "Formula dosyası yedeklendi: $backup_file"
|
|
121
|
+
else
|
|
122
|
+
print_error "Formula dosyası bulunamadı: $formula_file"
|
|
123
|
+
return 1
|
|
124
|
+
fi
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# Formula dosyasını güncelle
|
|
128
|
+
update_formula() {
|
|
129
|
+
local tag=$1
|
|
130
|
+
local new_sha256=$2
|
|
131
|
+
local formula_file="macos-system-cleaner.rb"
|
|
132
|
+
|
|
133
|
+
if [ ! -f "$formula_file" ]; then
|
|
134
|
+
print_error "Formula dosyası bulunamadı: $formula_file"
|
|
135
|
+
return 1
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
print_status "Formula dosyası güncelleniyor: $formula_file"
|
|
139
|
+
print_status "Yeni tag: $tag"
|
|
140
|
+
print_status "Yeni SHA256: $new_sha256"
|
|
141
|
+
|
|
142
|
+
# Formula dosyasını yedekle
|
|
143
|
+
backup_formula
|
|
144
|
+
|
|
145
|
+
# Eski tag ve SHA256 değerlerini bul ve değiştir
|
|
146
|
+
# URL satırını güncelle
|
|
147
|
+
sed -i.bak "s|https://github.com/halilertekin/macOS-System-Cleaner/archive/refs/tags/v[0-9.]*\.tar\.gz|https://github.com/halilertekin/macOS-System-Cleaner/archive/refs/tags/${tag}.tar.gz|g" "$formula_file"
|
|
148
|
+
|
|
149
|
+
# SHA256 satırını güncelle
|
|
150
|
+
sed -i.bak "s|sha256 \"[a-f0-9]*\"|sha256 \"${new_sha256}\"|g" "$formula_file"
|
|
151
|
+
|
|
152
|
+
# Versiyon bilgisini de güncelle (eğer varsa)
|
|
153
|
+
sed -i.bak "s|version \"v[0-9.]*\"|version \"${tag}\"|g" "$formula_file" 2>/dev/null || true
|
|
154
|
+
|
|
155
|
+
# Yedek dosyayı sil
|
|
156
|
+
rm -f "$formula_file.bak"
|
|
157
|
+
|
|
158
|
+
print_success "Formula dosyası başarıyla güncellendi!"
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
# Mevcut versiyonu göster
|
|
162
|
+
show_current_version() {
|
|
163
|
+
local formula_file="macos-system-cleaner.rb"
|
|
164
|
+
|
|
165
|
+
if [ -f "$formula_file" ]; then
|
|
166
|
+
local current_version=$(grep -o 'url "https://github.com/halilertekin/macOS-System-Cleaner/archive/refs/tags/[^"]*"' "$formula_file" | grep -o 'v[0-9.]*' | head -1)
|
|
167
|
+
local current_sha256=$(grep -o 'sha256 "[^"]*"' "$formula_file" | cut -d '"' -f 2)
|
|
168
|
+
|
|
169
|
+
echo "Mevcut versiyon: ${current_version:-Bilinmiyor}"
|
|
170
|
+
echo "Mevcut SHA256: ${current_sha256:-Bilinmiyor}"
|
|
171
|
+
else
|
|
172
|
+
echo "Formula dosyası bulunamadı"
|
|
173
|
+
fi
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
# Ana fonksiyon
|
|
177
|
+
main() {
|
|
178
|
+
case "${1:-help}" in
|
|
179
|
+
"--update")
|
|
180
|
+
if [ -z "$2" ]; then
|
|
181
|
+
print_error "Lütfen bir tag belirtin: $0 --update <tag>"
|
|
182
|
+
exit 1
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
local tag="$2"
|
|
186
|
+
validate_tag "$tag"
|
|
187
|
+
if [ $? -ne 0 ]; then
|
|
188
|
+
exit 1
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
print_status "SHA256 hash hesaplanıyor: $tag"
|
|
192
|
+
|
|
193
|
+
local sha256_hash=$(calculate_sha256 "$tag")
|
|
194
|
+
if [ $? -ne 0 ]; then
|
|
195
|
+
print_error "SHA256 hash hesaplanamadı"
|
|
196
|
+
exit 1
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
print_status "Hesaplanan SHA256: $sha256_hash"
|
|
200
|
+
|
|
201
|
+
update_formula "$tag" "$sha256_hash"
|
|
202
|
+
;;
|
|
203
|
+
"--dry-run")
|
|
204
|
+
if [ -z "$2" ]; then
|
|
205
|
+
print_error "Lütfen bir tag belirtin: $0 --dry-run <tag>"
|
|
206
|
+
exit 1
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
local tag="$2"
|
|
210
|
+
validate_tag "$tag"
|
|
211
|
+
if [ $? -ne 0 ]; then
|
|
212
|
+
exit 1
|
|
213
|
+
fi
|
|
214
|
+
|
|
215
|
+
print_status "SHA256 hash hesaplanıyor (test modu): $tag"
|
|
216
|
+
|
|
217
|
+
local sha256_hash=$(calculate_sha256 "$tag")
|
|
218
|
+
if [ $? -ne 0 ]; then
|
|
219
|
+
print_error "SHA256 hash hesaplanamadı"
|
|
220
|
+
exit 1
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
print_status "Hesaplanan SHA256: $sha256_hash"
|
|
224
|
+
print_warning "Bu sadece test modudur. Formula dosyası güncellenmedi."
|
|
225
|
+
;;
|
|
226
|
+
"--latest")
|
|
227
|
+
print_status "GitHub'dan son tag alınıyor..."
|
|
228
|
+
local latest_tag=$(get_latest_tag)
|
|
229
|
+
if [ -z "$latest_tag" ]; then
|
|
230
|
+
print_error "GitHub'dan tag alınamadı"
|
|
231
|
+
exit 1
|
|
232
|
+
fi
|
|
233
|
+
|
|
234
|
+
print_status "Bulunan son tag: $latest_tag"
|
|
235
|
+
validate_tag "$latest_tag"
|
|
236
|
+
if [ $? -ne 0 ]; then
|
|
237
|
+
exit 1
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
print_status "SHA256 hash hesaplanıyor: $latest_tag"
|
|
241
|
+
|
|
242
|
+
local sha256_hash=$(calculate_sha256 "$latest_tag")
|
|
243
|
+
if [ $? -ne 0 ]; then
|
|
244
|
+
print_error "SHA256 hash hesaplanamadı"
|
|
245
|
+
exit 1
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
print_status "Hesaplanan SHA256: $sha256_hash"
|
|
249
|
+
|
|
250
|
+
update_formula "$latest_tag" "$sha256_hash"
|
|
251
|
+
;;
|
|
252
|
+
"--show-current")
|
|
253
|
+
print_status "Mevcut formula versiyonu:"
|
|
254
|
+
show_current_version
|
|
255
|
+
;;
|
|
256
|
+
"--help"|"-h"|*)
|
|
257
|
+
show_help
|
|
258
|
+
;;
|
|
259
|
+
esac
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
# Ana fonksiyonu çalıştır
|
|
263
|
+
main "$@"
|
|
264
|
+
|
|
265
|
+
# Script sonu
|