8.3 KiB
8.3 KiB
Installation Module
Übersicht
Das Installation Module bietet eine vollautomatische Master-Installation für das USB-SSD Management System. Es konfiguriert alle Abhängigkeiten, erstellt System-Services und richtet die komplette Infrastruktur für den produktiven Einsatz ein.
Hauptkomponenten
install.sh
Zweck: Master-Installation mit vollständiger System-Konfiguration
Installationsschritte:
- System-Abhängigkeiten installieren
- Scripts in System-Pfade kopieren
- Systemd-Services konfigurieren
- Udev-Rules einrichten
- Benutzer-Berechtigungen setzen
- Logging-Infrastruktur aufbauen
Installation
Schnell-Installation
# Repository klonen
git clone https://git.gitcover.de/KMU/usb-ssd.git
cd usb-ssd
# Master-Installation ausführen
sudo ./scripts/installation/install.sh
Erweiterte Installation
# Installation mit Custom-Konfiguration
sudo ./scripts/installation/install.sh --config /path/to/config.conf
# Installation ohne Systemd-Services
sudo ./scripts/installation/install.sh --no-systemd
# Installation mit Debug-Modus
sudo ./scripts/installation/install.sh --debug --verbose
Interaktive Installation
# Schritt-für-Schritt Installation mit Benutzer-Eingaben
sudo ./scripts/installation/install.sh --interactive
# Nur bestimmte Komponenten installieren
sudo ./scripts/installation/install.sh --components "detection,management"
Installationsoptionen
Standard-Installation
# Vollständige Installation (empfohlen)
sudo ./install.sh
# Installiert:
# - Alle System-Abhängigkeiten
# - Scripts nach /usr/local/bin/
# - Systemd-Services
# - Udev-Rules
# - Log-Rotation
# - Bash-Completion
Custom-Installation
# Spezifische Installationspfade
sudo ./install.sh --prefix /opt/ssd-tools
# Custom-Konfiguration
sudo ./install.sh --config-dir /etc/ssd-management
# Benutzer-spezifische Installation
./install.sh --user-install
Komponenten-basierte Installation
# Nur Detection-Module
sudo ./install.sh --component detection
# Nur Management-Module
sudo ./install.sh --component management
# Nur Testing-Module
sudo ./install.sh --component testing
# Mehrere Komponenten
sudo ./install.sh --components "detection,management,testing"
System-Abhängigkeiten
Automatisch installierte Packages
Ubuntu/Debian
# Core-Packages
ntfs-3g # NTFS-Dateisystem Support
util-linux # Mount/Unmount Utilities
parted # Partitionstabellen-Management
bc # Berechnungen in Scripts
eject # Hardware-Eject Funktionalität
# Optional-Packages
smartmontools # SSD-Health Monitoring
hdparm # Hardware-Parameter Tuning
fio # Performance-Testing
samba-common # SMB-Integration
CentOS/RHEL
# Core-Packages
ntfs-3g
util-linux
parted
bc
eject
# EPEL-Repository für zusätzliche Tools
sudo yum install epel-release
Manuelle Abhängigkeits-Installation
# Ubuntu/Debian
sudo apt update
sudo apt install ntfs-3g util-linux parted bc eject smartmontools hdparm fio
# CentOS/RHEL
sudo yum install ntfs-3g util-linux parted bc eject smartmontools hdparm fio
# Arch Linux
sudo pacman -S ntfs-3g util-linux parted bc eject smartmontools hdparm fio
Systemd-Integration
Installierte Services
ssd-detection.service
[Unit]
Description=USB-C SSD Detection Service
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/ssd-detect.sh --monitor
Restart=on-failure
[Install]
WantedBy=multi-user.target
ssd-automount.service
[Unit]
Description=Automatic SSD Mounting
After=ssd-detection.service
[Service]
Type=forking
ExecStart=/usr/local/bin/ssd-mount-manager.sh --auto-mount
ExecStop=/usr/local/bin/ssd-safe-eject.sh --all
[Install]
WantedBy=multi-user.target
Service-Management
# Services aktivieren
sudo systemctl enable ssd-detection.service
sudo systemctl enable ssd-automount.service
# Services starten
sudo systemctl start ssd-detection.service
sudo systemctl start ssd-automount.service
# Status prüfen
sudo systemctl status ssd-detection.service
Udev-Rules
Automatische USB-Erkennung
# /etc/udev/rules.d/99-ssd-automount.rules
SUBSYSTEM=="block", ATTRS{removable}=="1", ACTION=="add", RUN+="/usr/local/bin/ssd-detect.sh --device %k"
SUBSYSTEM=="block", ATTRS{removable}=="1", ACTION=="remove", RUN+="/usr/local/bin/ssd-safe-eject.sh --device %k"
Udev-Rules aktivieren
# Rules neu laden
sudo udevadm control --reload-rules
sudo udevadm trigger
# Test der Rules
sudo udevadm test /sys/block/sdb
Benutzer-Berechtigungen
Gruppe-Konfiguration
# SSD-Management Gruppe erstellen
sudo groupadd ssd-users
# Benutzer zur Gruppe hinzufügen
sudo usermod -a -G ssd-users $USER
# Disk-Gruppe für Hardware-Zugriff
sudo usermod -a -G disk $USER
Sudo-Konfiguration
# /etc/sudoers.d/ssd-management
%ssd-users ALL=(ALL) NOPASSWD: /usr/local/bin/ssd-mount-manager.sh
%ssd-users ALL=(ALL) NOPASSWD: /usr/local/bin/ssd-safe-eject.sh
%ssd-users ALL=(ALL) NOPASSWD: /usr/local/bin/ssd-detect.sh
Logging-Konfiguration
Log-Rotation
# /etc/logrotate.d/ssd-management
/var/log/ssd-*.log {
daily
rotate 30
compress
delaycompress
missingok
notifempty
create 644 root root
}
Syslog-Integration
# /etc/rsyslog.d/50-ssd-management.conf
:programname, isequal, "ssd-detect" /var/log/ssd-detection.log
:programname, isequal, "ssd-mount" /var/log/ssd-management.log
:programname, isequal, "ssd-test" /var/log/ssd-testing.log
& stop
Bash-Completion
Auto-Completion aktivieren
# /etc/bash_completion.d/ssd-tools
_ssd_detect() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--verbose --ntfs-only --device --output --monitor --debug"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _ssd_detect ssd-detect.sh
Deinstallation
Vollständige Deinstallation
# Deinstallations-Script ausführen
sudo ./scripts/installation/uninstall.sh
# Manuelle Deinstallation
sudo systemctl stop ssd-detection.service ssd-automount.service
sudo systemctl disable ssd-detection.service ssd-automount.service
sudo rm /etc/systemd/system/ssd-*.service
sudo rm /usr/local/bin/ssd-*
sudo rm /etc/udev/rules.d/99-ssd-automount.rules
Konfiguration beibehalten
# Nur Scripts entfernen, Konfiguration behalten
sudo ./scripts/installation/uninstall.sh --keep-config
Upgrade-Prozess
In-Place Upgrade
# Repository aktualisieren
git pull origin main
# Upgrade ausführen
sudo ./scripts/installation/install.sh --upgrade
# Services neu starten
sudo systemctl restart ssd-detection.service
Backup vor Upgrade
# Konfiguration sichern
sudo cp -r /etc/ssd-management /etc/ssd-management.backup
# Scripts sichern
sudo cp /usr/local/bin/ssd-* /tmp/ssd-backup/
Troubleshooting
Installations-Probleme
# Installation mit Debug-Output
sudo ./install.sh --debug --verbose
# Abhängigkeits-Probleme prüfen
./install.sh --check-dependencies
# Berechtigungs-Probleme
sudo ./install.sh --fix-permissions
Häufige Probleme
- Permission denied: Installation mit
sudo
ausführen - Package not found: Repository-Updates durchführen
- Service failed: Systemd-Logs prüfen (
journalctl -u ssd-detection.service
)
Diagnose-Tools
# System-Diagnose
./install.sh --diagnose
# Installations-Status prüfen
./install.sh --status
# Konfiguration validieren
./install.sh --validate
Best Practices
Produktionsumgebung
- Vollständige Installation mit allen Komponenten
- Systemd-Services aktivieren für automatisches Management
- Log-Rotation konfigurieren für Langzeit-Betrieb
- Monitoring einrichten für Service-Überwachung
- Backup-Strategie für Konfigurationsdateien
Entwicklungsumgebung
- Komponenten-basierte Installation für spezifische Tests
- Debug-Modus aktivieren für Entwicklung
- User-Installation für isolierte Tests
- Häufige Upgrades für aktuelle Features
Changelog
Version 0.1.0
- Master-Installation Script
- Systemd-Service Integration
- Udev-Rules Konfiguration
- Benutzer-Berechtigungen Setup
- Logging-Infrastruktur
- Bash-Completion Support