-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.sh
More file actions
executable file
·420 lines (356 loc) · 12 KB
/
Copy pathinstaller.sh
File metadata and controls
executable file
·420 lines (356 loc) · 12 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
#!/bin/bash
################################################################################
# WindowsBridge – Haupt-Installer
#
# Copyright (c) 2026 Stefan. Licensed under Apache-2.0
# See LICENSE file for full license details.
#
# Beschreibung: Hauptinstaller für WindowsBridge. Orchestriert die Installation
# basierend auf dem ausgewählten Profil (Minimal, Standard, Gaming,
# Full, Custom).
#
# Verwendung: sudo bash installer.sh [--profile <profile>] [--verbose] [--dry-run]
#
# Profile:
# - minimal : Basis Wine + Standard Runtimes
# - standard : Wine + Office-/Business-Tools
# - gaming : Wine + Gaming-Komponenten (DXVK, VKD3D, Proton-GE, Lutris)
# - full : Alles (Minimal + Standard + Gaming)
# - custom : Benutzerauswahl via GUI
#
# Autor: WindowsBridge Team
# Datum: 2026
################################################################################
set -e
set -o pipefail
# Farben für Terminal-Ausgabe
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
# Script-Verzeichnis
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODULES_DIR="$SCRIPT_DIR/modules"
DOCS_DIR="$SCRIPT_DIR/docs"
# Standard-Variablen
PROFILE="custom"
VERBOSE=false
DRY_RUN=false
INSTALL_START_TIME=$(date +%s)
LOG_DIR="${HOME}/.config/windowsbridge"
LOG_FILE="${LOG_DIR}/install_$(date +%Y%m%d_%H%M%S).log"
ERROR_OCCURRED=false
################################################################################
# Hilfsfunktionen
################################################################################
# Stelle sicher, dass Log-Verzeichnis existiert
setup_logging() {
mkdir -p "$LOG_DIR"
touch "$LOG_FILE"
log_info "Logdatei: $LOG_FILE"
}
# Schreibe in Logdatei
log_to_file() {
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$timestamp] $1" >> "$LOG_FILE"
}
log_info() {
echo -e "${BLUE}[INFO]${NC} $1"
log_to_file "[INFO] $1"
}
log_success() {
echo -e "${GREEN}[✓]${NC} $1"
log_to_file "[SUCCESS] $1"
}
log_warning() {
echo -e "${YELLOW}[WARNUNG]${NC} $1"
log_to_file "[WARNING] $1"
}
log_error() {
echo -e "${RED}[FEHLER]${NC} $1" >&2
log_to_file "[ERROR] $1"
ERROR_OCCURRED=true
}
verbose_log() {
if [ "$VERBOSE" = true ]; then
echo -e "${BLUE}[DEBUG]${NC} $1"
log_to_file "[DEBUG] $1"
fi
}
# Trap für Fehler
error_trap() {
local line_number=$1
log_error "Fehler in Zeile $line_number"
cleanup
exit 1
}
# Aufräumen bei Beendigung
cleanup() {
local end_time=$(date +%s)
local duration=$((end_time - INSTALL_START_TIME))
log_info "Installation beendet nach $((duration / 60))m $((duration % 60))s"
if [ "$ERROR_OCCURRED" = true ]; then
log_warning "Installation mit Fehlern abgeschlossen"
fi
}
check_root() {
if [ "$EUID" -ne 0 ]; then
log_error "Dieses Skript muss mit sudo ausgeführt werden!"
exit 1
fi
log_success "Administratorrechte bestätigt"
}
check_system() {
log_info "Überprüfe Systemvorraussetzungen..."
# Prüfe auf Debian-basiertes System
if [ ! -f /etc/debian_version ]; then
log_error "Dieses System ist nicht Debian-basiert!"
log_error "WindowsBridge unterstützt nur Debian, Ubuntu, Linux Mint, etc."
exit 1
fi
log_success "System ist Debian-basiert"
# Prüfe Freiraum
local free_space=$(df /home | awk 'NR==2 {print $4}')
if [ "$free_space" -lt 5242880 ]; then # 5GB in KB
log_warning "Weniger als 5GB Speicherplatz verfügbar!"
else
log_success "Ausreichend Speicherplatz verfügbar"
fi
# Prüfe Internet-Verbindung
if ! ping -q -c 1 -W 2 8.8.8.8 >/dev/null 2>&1; then
log_warning "Keine Internet-Verbindung erkannt!"
log_warning "Installation wird möglicherweise fehlschlagen."
else
log_success "Internet-Verbindung verfügbar"
fi
# Prüfe APT-Lock
if [ -f /var/lib/apt/lists/lock ] || [ -f /var/cache/apt/archives/lock ]; then
log_error "APT ist gerade in Benutzung! Bitte warten Sie und versuchen Sie später erneut."
exit 1
fi
}
print_banner() {
echo
echo -e "${BLUE}"
cat << "EOF"
╔═══════════════════════════════════════════════════════════════╗
║ WindowsBridge ║
║ One-Click Installer für Windows-Software ║
║ auf Debian-basierten Systemen ║
╚═══════════════════════════════════════════════════════════════╝
EOF
echo -e "${NC}"
echo
}
print_help() {
cat << EOF
Verwendung: sudo bash installer.sh [OPTIONS]
OPTIONS:
--profile <profile> Installationsprofil (minimal, standard, gaming, full, custom)
Standard: custom (interaktive GUI)
--verbose Ausführliche Ausgabe (Debug-Modus)
--dry-run Simuliere Installation (keine Änderungen)
--help Diese Hilfe anzeigen
BEISPIELE:
sudo bash installer.sh --profile gaming
sudo bash installer.sh --profile full --verbose
sudo bash installer.sh --dry-run
PROFILE:
minimal - Basis-Installation: Wine + Standard Runtimes
standard - Basis + Office-/Business-Tools
gaming - Basis + Gaming-Komponenten (DXVK, VKD3D, Lutris, etc.)
full - Alles installieren
custom - Interaktive Profilauswahl via GUI (Standard)
EOF
}
parse_arguments() {
while [[ $# -gt 0 ]]; do
case $1 in
--profile)
PROFILE="$2"
shift 2
;;
--verbose)
VERBOSE=true
shift
;;
--dry-run)
DRY_RUN=true
shift
;;
--help)
print_help
exit 0
;;
*)
log_error "Unbekannte Option: $1"
print_help
exit 1
;;
esac
done
}
validate_profile() {
case "$PROFILE" in
minimal|standard|gaming|full|custom)
verbose_log "Profil validiert: $PROFILE"
;;
*)
log_error "Ungültiges Profil: $PROFILE"
log_error "Erlaubte Profile: minimal, standard, gaming, full, custom"
exit 1
;;
esac
}
check_modules() {
log_info "Überprüfe Module..."
local required_modules=(
"system_setup.sh"
"wine_setup.sh"
"gaming_setup.sh"
"updater.sh"
)
for module in "${required_modules[@]}"; do
if [ ! -f "$MODULES_DIR/$module" ]; then
log_error "Modul nicht gefunden: $MODULES_DIR/$module"
exit 1
fi
verbose_log "Modul verfügbar: $module"
done
log_success "Alle Module vorhanden"
}
run_profile_minimal() {
log_info "Installiere Minimal-Profil (Wine + Basis Runtimes)..."
log_to_file "=== PROFIL: MINIMAL START ==="
if [ "$DRY_RUN" = false ]; then
bash "$MODULES_DIR/system_setup.sh" --verbose=$VERBOSE --dry-run=false || {
log_error "system_setup.sh fehlgeschlagen"
return 1
}
bash "$MODULES_DIR/wine_setup.sh" --verbose=$VERBOSE --dry-run=false --minimal || {
log_error "wine_setup.sh fehlgeschlagen"
return 1
}
else
log_info "DRY-RUN: Würde system_setup.sh ausführen"
log_info "DRY-RUN: Würde wine_setup.sh ausführen"
fi
log_success "Minimal-Profil abgeschlossen"
log_to_file "=== PROFIL: MINIMAL END ==="
}
run_profile_standard() {
log_info "Installiere Standard-Profil (Minimal + Office-Tools)..."
log_to_file "=== PROFIL: STANDARD START ==="
run_profile_minimal || return 1
log_info "Standard-Profil: Zusätzliche Konfiguration..."
if [ "$DRY_RUN" = false ]; then
# Office-Tools Installation (via Wine oder native)
log_info "Office-Tools werden über optionale Installation bereitgestellt"
fi
log_success "Standard-Profil abgeschlossen"
log_to_file "=== PROFIL: STANDARD END ==="
}
run_profile_gaming() {
log_info "Installiere Gaming-Profil (Alles für Gaming)..."
log_to_file "=== PROFIL: GAMING START ==="
run_profile_standard || return 1
if [ "$DRY_RUN" = false ]; then
bash "$MODULES_DIR/gaming_setup.sh" --verbose=$VERBOSE --dry-run=false || {
log_error "gaming_setup.sh fehlgeschlagen"
return 1
}
else
log_info "DRY-RUN: Würde gaming_setup.sh ausführen"
fi
log_success "Gaming-Profil abgeschlossen"
log_to_file "=== PROFIL: GAMING END ==="
}
run_profile_full() {
log_info "Installiere Full-Profil (Komplette Installation)..."
log_to_file "=== PROFIL: FULL START ==="
run_profile_gaming || return 1
log_success "Full-Profil abgeschlossen"
log_to_file "=== PROFIL: FULL END ==="
}
run_profile_custom() {
log_info "Starte GUI für Profilauswahl..."
log_to_file "=== PROFIL: CUSTOM START ==="
if command -v python3 &> /dev/null; then
if [ -f "$MODULES_DIR/gui_launcher.py" ]; then
if [ "$DRY_RUN" = false ]; then
python3 "$MODULES_DIR/gui_launcher.py" "$MODULES_DIR" "$VERBOSE" "$LOG_FILE" || {
log_warning "GUI-Launcher beendet mit Fehler, verwende Standard-Profil"
run_profile_minimal
}
else
log_info "DRY-RUN: Würde GUI starten"
run_profile_minimal
fi
else
log_warning "GUI-Launcher nicht gefunden, verwende Minimal-Profil"
run_profile_minimal
fi
else
log_warning "Python3 nicht verfügbar, verwende Minimal-Profil"
run_profile_minimal
fi
log_to_file "=== PROFIL: CUSTOM END ==="
}
main() {
# Setup Trap für Fehler
trap 'error_trap $LINENO' ERR
trap cleanup EXIT
print_banner
parse_arguments "$@"
validate_profile
# Setup Logging
setup_logging
check_root
check_system
check_modules
if [ "$DRY_RUN" = true ]; then
log_warning "DRY-RUN MODUS: Keine Änderungen werden vorgenommen"
echo
fi
log_info "=== INSTALLATION STARTET ==="
log_info "Profil: $PROFILE"
log_info "Verbose: $VERBOSE"
log_info "Dry-Run: $DRY_RUN"
echo
case "$PROFILE" in
minimal)
run_profile_minimal || exit 1
;;
standard)
run_profile_standard || exit 1
;;
gaming)
run_profile_gaming || exit 1
;;
full)
run_profile_full || exit 1
;;
custom)
run_profile_custom || exit 1
;;
esac
log_success "Installation erfolgreich abgeschlossen!"
log_info "Neue Einstellungen könnten einen Neustart erfordern."
# Zeige Zusammenfassung
echo
echo -e "${PURPLE}╔════════════════════════════════════════╗${NC}"
echo -e "${PURPLE}║ Installation abgeschlossen ║${NC}"
echo -e "${PURPLE}╚════════════════════════════════════════╝${NC}"
echo
log_info "Logdatei: $LOG_FILE"
if command -v yad &> /dev/null && [ "$DRY_RUN" = false ]; then
yad --title="Installation abgeschlossen" \
--text="WindowsBridge Installation erfolgreich abgeschlossen!\n\nDein System ist jetzt bereit, Windows-Software auszuführen.\n\nLogdatei: $LOG_FILE" \
--button="Schließen:0" \
2>/dev/null || true
fi
}
# Starte Hauptprogramm
main "$@"