-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-windowsbridge.sh
More file actions
executable file
·151 lines (122 loc) · 6.08 KB
/
Copy pathstart-windowsbridge.sh
File metadata and controls
executable file
·151 lines (122 loc) · 6.08 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
#!/bin/bash
# Copyright (c) 2026 Stefan. Licensed under Apache-2.0
# See LICENSE file for full license details.
#
# WindowsBridge Starter-Datei
# Startet die grafische Benutzeroberfläche (GUI) für die Installation
# Setze error handling aber erlaube fehler in einzelnen commands
set +e
# ═══════════════════════════════════════════════════════════════════════════
# WindowsBridge One-Click Starter
# ═══════════════════════════════════════════════════════════════════════════
# Farben für Ausgabe
readonly RED='\033[0;31m'
readonly GREEN='\033[0;32m'
readonly YELLOW='\033[0;33m'
readonly BLUE='\033[0;34m'
readonly NC='\033[0m' # No Color
# Projektverzeichnis automatisch ermitteln
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly GUI_LAUNCHER="${SCRIPT_DIR}/modules/gui_launcher.py"
readonly INSTALLER_SCRIPT="${SCRIPT_DIR}/installer.sh"
readonly LOG_DIR="${HOME}/.config/windowsbridge"
readonly LOG_FILE="${LOG_DIR}/starter.log"
# ═══════════════════════════════════════════════════════════════════════════
# Funktionen
# ═══════════════════════════════════════════════════════════════════════════
log() {
local level="$1"
shift
local message="$*"
local timestamp="$(date '+%Y-%m-%d %H:%M:%S')"
echo -e "[${timestamp}] [${level}] ${message}" | tee -a "${LOG_FILE}"
}
print_header() {
echo ""
echo -e "${BLUE}════════════════════════════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE} 🚀 WindowsBridge v1.0.0 🚀${NC}"
echo -e "${BLUE} Ein-Klick Installer${NC}"
echo -e "${BLUE}════════════════════════════════════════════════════════════════════════════════${NC}"
echo ""
}
print_success() {
echo -e "${GREEN}✅ $*${NC}"
}
print_error() {
echo -e "${RED}❌ $*${NC}"
}
print_info() {
echo -e "${YELLOW}ℹ️ $*${NC}"
}
# Fehlerbehandlung
handle_error() {
local line_num=$1
print_error "Ein Fehler ist in Zeile ${line_num} aufgetreten"
log "ERROR" "Script abgebrochen in Zeile ${line_num}"
exit 1
}
trap 'handle_error ${LINENO}' ERR
# ═══════════════════════════════════════════════════════════════════════════
# Graphische Benutzeroberfläche starten
# ═══════════════════════════════════════════════════════════════════════════
start_gui() {
print_header
# Log-Verzeichnis erstellen falls nicht vorhanden
if [[ ! -d "${LOG_DIR}" ]]; then
mkdir -p "${LOG_DIR}"
print_info "Log-Verzeichnis erstellt: ${LOG_DIR}"
fi
log "INFO" "Starte WindowsBridge GUI"
# Überprüfe ob Python verfügbar ist
if ! command -v python3 &>/dev/null; then
print_error "Python3 nicht gefunden. Bitte installieren Sie Python 3.6+"
log "ERROR" "Python3 not found"
exit 1
fi
# Überprüfe ob GUI-Launcher vorhanden ist
if [[ ! -f "${GUI_LAUNCHER}" ]]; then
print_error "gui_launcher.py nicht gefunden in: ${GUI_LAUNCHER}"
log "ERROR" "GUI launcher not found at ${GUI_LAUNCHER}"
exit 1
fi
print_info "Starte grafische Benutzeroberfläche..."
print_info "GUI-Launcher: ${GUI_LAUNCHER}"
# Starte GUI
cd "${SCRIPT_DIR}"
if python3 "${GUI_LAUNCHER}"; then
echo ""
print_success "WindowsBridge GUI beendet"
log "INFO" "GUI launcher completed successfully"
exit 0
else
local exit_code=$?
print_error "GUI-Launcher fehlgeschlagen mit Exit-Code: ${exit_code}"
log "ERROR" "GUI launcher failed with exit code ${exit_code}"
# Fallback zu Terminal-Installer wenn GUI fehlschlägt
echo ""
print_info "Fallback: Starte Terminal-basierter Installer..."
if bash "${INSTALLER_SCRIPT}"; then
print_success "Installation erfolgreich abgeschlossen!"
log "INFO" "Fallback installer completed successfully"
exit 0
else
print_error "Installation fehlgeschlagen!"
log "ERROR" "Fallback installer failed"
exit 1
fi
fi
}
# ═══════════════════════════════════════════════════════════════════════════
# Hauptprogramm
# ═══════════════════════════════════════════════════════════════════════════
main() {
# Überprüfe ob GUI-Launcher existiert
if [[ ! -f "${GUI_LAUNCHER}" ]]; then
print_error "Kritischer Fehler: gui_launcher.py nicht gefunden"
print_error "Erwartet: ${GUI_LAUNCHER}"
exit 1
fi
start_gui
}
# Script ausführen
main "$@"