-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
314 lines (277 loc) · 10.7 KB
/
install.bat
File metadata and controls
314 lines (277 loc) · 10.7 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
@echo off
SETLOCAL EnableDelayedExpansion
TITLE Anonymify - Installation
REM ============================================================================
REM AUTOMATISCHES INSTALLATIONS-SCRIPT
REM ============================================================================
REM
REM Dieses Script:
REM - Überprüft Python-Installation
REM - Installiert alle Dependencies (inkl. Presidio)
REM - Richtet optional Auto-Start ein
REM - Startet die Anwendung
REM
REM ============================================================================
echo.
echo ====================================================================
echo ANONYMIFY - INSTALLATION
echo ====================================================================
echo.
echo Automatische Installation fuer Windows
echo (c) 2024 - DSGVO-konforme Text-Anonymisierung
echo.
echo ====================================================================
echo.
REM ============================================================================
REM SCHRITT 1: PYTHON PRUEFEN
REM ============================================================================
echo [1/5] Pruefe Python-Installation...
echo.
python --version >nul 2>&1
if errorlevel 1 (
echo [FEHLER] Python ist nicht installiert!
echo.
echo Bitte installiere Python von: https://www.python.org/downloads/
echo.
echo WICHTIG: Bei der Installation "Add Python to PATH" ankreuzen!
echo.
pause
exit /b 1
)
echo [OK] Python gefunden:
python --version
echo.
REM ============================================================================
REM SCHRITT 2: VIRTUELLE UMGEBUNG ERSTELLEN
REM ============================================================================
echo [2/5] Erstelle virtuelle Umgebung...
echo.
if exist venv (
echo [INFO] Virtuelle Umgebung existiert bereits
) else (
python -m venv venv
if errorlevel 1 (
echo.
echo ====================================================================
echo [FEHLER] Konnte virtuelle Umgebung nicht erstellen!
echo ====================================================================
echo.
echo HAEUFIGE URSACHEN:
echo - Python vom Windows Store installiert
echo - pip fehlt in Python-Installation
echo - Alte Python-Version
echo - Berechtigungsprobleme
echo.
echo LOESUNG 1 - Python neu installieren ^(EMPFOHLEN^):
echo 1. Python deinstallieren ^(Windows Einstellungen -^> Apps^)
echo 2. Von python.org neu installieren: https://www.python.org/downloads/
echo 3. Version 3.10 oder 3.11 waehlen ^(NICHT Windows Store!^)
echo 4. Bei Installation "Add Python to PATH" anhaken
echo 5. install.bat erneut ausfuehren
echo.
echo LOESUNG 2 - Ohne virtuelle Umgebung installieren:
echo 1. Schliesse dieses Fenster
echo 2. Fuehre install_global.bat aus
echo 3. Dependencies werden global installiert
echo.
echo LOESUNG 3 - pip manuell installieren:
echo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
echo python get-pip.py
echo Dann install.bat erneut ausfuehren
echo.
echo ====================================================================
echo.
pause
exit /b 1
)
echo [OK] Virtuelle Umgebung erstellt
)
echo.
REM ============================================================================
REM SCHRITT 3: DEPENDENCIES INSTALLIEREN
REM ============================================================================
echo [3/5] Installiere Dependencies...
echo (Dies kann einige Minuten dauern...)
echo.
REM Aktiviere virtuelle Umgebung
call venv\Scripts\activate.bat
REM Upgrade pip
echo - Aktualisiere pip...
python -m pip install --upgrade pip -q
REM Installiere Standard-Dependencies
echo - Installiere pyperclip (Zwischenablage)...
pip install pyperclip -q
echo - Installiere keyboard (Hotkey)...
pip install keyboard -q
echo - Installiere pystray (System Tray Icon)...
pip install pystray -q
echo - Installiere Pillow (Bilder)...
pip install Pillow -q
REM Installiere Presidio (Microsoft PII-Erkennung)
echo - Installiere Presidio Analyzer...
pip install presidio-analyzer -q
echo - Installiere Presidio Anonymizer...
pip install presidio-anonymizer -q
echo.
echo [OK] Alle Dependencies installiert!
echo.
REM ============================================================================
REM SCHRITT 4: AUTO-START EINRICHTEN (OPTIONAL)
REM ============================================================================
echo [4/5] Auto-Start einrichten...
echo.
echo Soll die App automatisch mit Windows starten?
echo.
echo WICHTIG: Der globale Hotkey braucht Administrator-Rechte!
echo.
echo OPTION 1: Startup-Ordner (OHNE Admin-Rechte)
echo + Einfach einzurichten
echo - Hotkey funktioniert evtl. NICHT ohne Admin
echo.
echo OPTION 2: Task Scheduler (MIT Admin-Rechten)
echo + Hotkey funktioniert zuverlaessig
echo - Benoetigt Admin-Rechte bei der Einrichtung
echo - Fuer Fortgeschrittene Benutzer
echo.
echo OPTION 3: Manuell starten
echo - Keine Auto-Start, einfach 'start.bat' ausfuehren
echo.
set /p AUTOSTART_CHOICE="Waehle Option (1/2/3): "
if "%AUTOSTART_CHOICE%"=="1" (
echo.
echo - Richte Auto-Start via Startup-Ordner ein...
REM Erstelle Verknuepfung im Autostart-Ordner
set STARTUP_FOLDER=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
set SCRIPT_PATH=%CD%\start.bat
REM Verwende PowerShell um Verknuepfung zu erstellen
powershell -Command "$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('!STARTUP_FOLDER!\Anonymify.lnk'); $Shortcut.TargetPath = '!SCRIPT_PATH!'; $Shortcut.WorkingDirectory = '%CD%'; $Shortcut.WindowStyle = 7; $Shortcut.Save()"
if errorlevel 1 (
echo [WARNUNG] Konnte Auto-Start nicht einrichten
echo Bitte manuell eine Verknuepfung erstellen
) else (
echo [OK] Auto-Start eingerichtet (Startup-Ordner)!
echo.
echo WICHTIG: Die App laeuft OHNE Admin-Rechte!
echo Rechtsklick auf start.bat -^> "Als Administrator ausfuehren"
echo um den Hotkey zum Laufen zu bringen.
)
) else if "%AUTOSTART_CHOICE%"=="2" (
echo.
echo - Starte setup_admin_autostart.bat fuer Task Scheduler...
echo.
echo WICHTIG: Du musst setup_admin_autostart.bat ALS ADMINISTRATOR ausfuehren!
echo Rechtsklick -^> "Als Administrator ausfuehren"
echo.
call setup_admin_autostart.bat
) else (
echo [INFO] Auto-Start uebersprungen
echo Du kannst die App manuell mit 'start.bat' starten
echo TIPP: Rechtsklick -^> "Als Administrator ausfuehren"
)
echo.
REM ============================================================================
REM SCHRITT 5: ERKENNUNGS-MODUS WAEHLEN
REM ============================================================================
echo [5/6] Erkennungs-Modus waehlen...
echo.
echo Wie genau soll die Namen-Erkennung sein?
echo.
echo OPTION 1: SCHNELL (empfohlen fuer Echtzeit)
echo + Sehr schnell (~0.1 Sekunden)
echo - Etwas weniger genau
echo - Keine zusaetzlichen Downloads
echo.
echo OPTION 2: GENAU (empfohlen bei vielen Fehlern)
echo + Sehr genau (Machine Learning)
echo - Etwas langsamer (~1 Sekunde)
echo + Laedt automatisch ML-Modell (50 MB)
echo.
echo OPTION 3: MAXIMUM (beste Genauigkeit)
echo + Maximale Genauigkeit
echo - Langsamer (~2-5 Sekunden)
echo + Laedt großes ML-Modell (100 MB)
echo.
set /p MODE_CHOICE="Waehle Modus (1/2/3): "
if "%MODE_CHOICE%"=="1" (
echo.
echo - Setze Modus auf: SCHNELL
powershell -Command "(Get-Content config.toml) -replace 'recognition_mode = \".*\"', 'recognition_mode = \"fast\"' | Set-Content config.toml"
echo [OK] Modus 'fast' gewaehlt
) else if "%MODE_CHOICE%"=="2" (
echo.
echo - Setze Modus auf: GENAU
echo - Installiere spaCy...
call venv\Scripts\activate.bat
pip install spacy -q
echo - Lade deutsches ML-Modell (50 MB, kann 2-3 Min dauern)...
python -m spacy download de_core_news_sm
powershell -Command "(Get-Content config.toml) -replace 'recognition_mode = \".*\"', 'recognition_mode = \"balanced\"' | Set-Content config.toml"
echo [OK] Modus 'balanced' gewaehlt + ML-Modell installiert!
) else if "%MODE_CHOICE%"=="3" (
echo.
echo - Setze Modus auf: MAXIMUM
echo - Installiere spaCy...
call venv\Scripts\activate.bat
pip install spacy -q
echo - Lade großes deutsches ML-Modell (100 MB, kann 5-10 Min dauern)...
python -m spacy download de_core_news_lg
powershell -Command "(Get-Content config.toml) -replace 'recognition_mode = \".*\"', 'recognition_mode = \"accurate\"' | Set-Content config.toml"
echo [OK] Modus 'accurate' gewaehlt + großes ML-Modell installiert!
) else (
echo [INFO] Keine Auswahl, nutze Standard (SCHNELL)
powershell -Command "(Get-Content config.toml) -replace 'recognition_mode = \".*\"', 'recognition_mode = \"fast\"' | Set-Content config.toml"
)
echo.
REM ============================================================================
REM SCHRITT 6: ABSCHLUSS
REM ============================================================================
echo [6/6] Installation abgeschlossen!
echo.
echo ====================================================================
echo INSTALLATION ERFOLGREICH!
echo ====================================================================
echo.
echo Die App ist jetzt installiert und einsatzbereit.
echo.
echo VERWENDUNG:
echo 1. Starte die App: Rechtsklick start.bat -^> "Als Administrator"
echo 2. Das "A"-Icon erscheint in der Taskleiste
echo 3. Markiere Text in beliebiger App
echo 4. Druecke Strg+Alt+A (automatisch kopiert + anonymisiert!)
echo 5. Fuege anonymisierten Text ein (Strg+V)
echo.
echo ICON-FARBEN:
echo GRUEN = Bereit
echo GELB = Anonymisiert gerade...
echo ROT = Fehler
echo.
echo KONFIGURATION:
echo - Hotkey aendern: config.toml bearbeiten
echo - Whitelist: Namen in config.toml hinzufuegen
echo.
echo TIPPS:
echo - Die App laeuft im Hintergrund
echo - Klick auf Icon zeigt aktuellen Hotkey
echo - Zum Beenden: Rechtsklick Icon -^> Beenden
echo.
echo ====================================================================
echo.
set /p START_NOW="App jetzt starten? (j/n): "
if /i "%START_NOW%"=="j" (
echo.
echo Starte Anonymify...
echo.
REM Starte in neuem Fenster
start "Anonymify" /MIN cmd /c "cd /d %CD% && call start.bat"
echo.
echo [OK] App gestartet!
echo Schaue in die Taskleiste fuer das Icon.
echo.
) else (
echo.
echo Starte die App spaeter mit: start.bat
echo.
)
echo Druecke eine Taste zum Beenden...
pause >nul
ENDLOCAL