Compare commits

...

3 Commits

Author SHA1 Message Date
5c928e565a docs(readme): update structure and tables for improved clarity 2025-06-15 16:35:28 +02:00
fd0c2a8f84 docs: add MIT license file
- Introduces the MIT license to define usage permissions and limitations
- Ensures legal clarity for software distribution and contributions
2025-06-15 16:33:38 +02:00
ab763cc1bd docs: add README with usage and troubleshooting details
- Introduces a README file with an overview of the SFX Builder tool
- Includes sections on functionality, prerequisites, quickstart, and examples
- Provides parameter explanations, file structure details, and troubleshooting tips
- Adds licensing information under the MIT License
2025-06-15 16:33:31 +02:00
2 changed files with 148 additions and 0 deletions

18
LICENSE Normal file
View File

@@ -0,0 +1,18 @@
MIT License
Copyright (c) 2025 SimDev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.

130
README.md Normal file
View File

@@ -0,0 +1,130 @@
# Self-Extracting Archive (SFX) Builder
Dieses Projekt packt beliebige Dateien und ein Start-Skript (Entrypoint) zu
einer einzigen, selbst-extrahierenden **`.run`**-Datei zusammen.
Ideal, wenn du eine Anwendung, ein Install- oder Update-Paket ohne
externe Abhängigkeiten verteilen möchtest.
---
## Inhalt
- [Self-Extracting Archive (SFX) Builder](#self-extracting-archive-sfx-builder)
- [Inhalt](#inhalt)
- [Funktionsweise](#funktionsweise)
- [Voraussetzungen](#voraussetzungen)
- [Schnellstart](#schnellstart)
- [Beispiele](#beispiele)
- [Erklärung der Parameter](#erklärung-der-parameter)
- [Dateiaufbau des SFX](#dateiaufbau-des-sfx)
- [Troubleshooting](#troubleshooting)
- [Lizenz](#lizenz)
---
## Funktionsweise
1. **`build_sfx.sh`**
*Erstellt* ein SFX-Archiv:
- komprimiert das Payload-Verzeichnis mit **`tar`** + **`zstd`**
- injiziert den komprimierten Stream und Metadaten in **`sfx_header.sh`**
- liefert eine ausführbare **`*.run`**-Datei
2. **`sfx_header.sh`**
*Läuft* beim Entpacken auf dem Zielsystem:
- extrahiert das Archiv in ein temporäres Verzeichnis
- macht den angegebenen Entrypoint ausführbar
- führt ihn mit sämtlichen an die `.run`-Datei übergebenen Argumenten aus
---
## Voraussetzungen
| Tool | Zweck | Getestete Version |
| ---------------------------------------- | ------------------------- | ----------------- |
| `bash` | Shell-Interpreter | ≥ 4.2 |
| `tar` | Paketierung | _(coreutils)_ |
| `zstd` | Kompression | ≥ 1.5 |
| `numfmt` | Menschliche Größenangaben | _(coreutils)_ |
| GNU `sed`, `grep`, `cut`, `wc`, `mktemp` | Hilfs-Tools | _(coreutils)_ |
> **Tipp:** Unter Debian/Ubuntu genügt:
> `sudo apt install zstd coreutils`
---
## Schnellstart
```bash
# 1) Projekt klonen
git clone https://github.com/<user>/sfx-builder.git
cd sfx-builder
# 2) Payload vorbereiten
mkdir payload && cp -r <deine_dateien> payload/
chmod +x payload/start.sh # dein Entrypoint
# 3) SFX erzeugen
./build_sfx.sh --payload-dir payload --entrypoint start.sh --output cool_tool.run
# 4) Verteilen & ausführen
scp cool_tool.run user@host:/tmp
ssh user@host "chmod +x /tmp/cool_tool.run && /tmp/cool_tool.run --help"
```
---
## Beispiele
```bash
# Minimale Syntax (Standard-Ausgabe: sfx.run)
./build_sfx.sh -p payload -e start.sh
# Eigenen Ausgabepfad wählen
./build_sfx.sh -p payload -e bin/app.sh -o dist/app_installer.run
# Debug-Info des erzeugten Archivs prüfen
bash -x cool_tool.run --version
```
---
## Erklärung der Parameter
| Option | Alias | Pflicht? | Beschreibung |
| --------------------- | ----- | -------- | -------------------------------------------------------- |
| `--payload-dir <DIR>` | `-p` | ✅ | Verzeichnis mit allen zu verteilenden Dateien |
| `--entrypoint <FILE>` | `-e` | ✅ | Ausführbare Datei *innerhalb* von **DIR** |
| `--output <FILE>` | `-o` | ❌ | Zielpfad der erzeugten `.run`-Datei (Default: `sfx.run`) |
---
## Dateiaufbau des SFX
```text
┌─────────────┐ sfx_header.sh (Bootstrap-Logik)
├─────────────┤ __ARCHIVE_BEGIN__ (Marker)
│ ZSTD-Tar │ payload.tar.zst (komprimierter Payload)
└─────────────┘
```
- **`ARCHIVE_LINE`** = Zeilennummer, ab der das komprimierte Archiv beginnt
- **`ENTRYPOINT`** = Dateiname des Start-Skripts im Payload-Archiv
Die Platzhalter werden beim Build automatisch ersetzt.
---
## Troubleshooting
| Problem | Ursache / Lösung |
| ------------------------------------ | ----------------------------------------------- |
| `zstd: command not found` | Installiere das Paket `zstd`. |
| Entrypoint wird nicht ausgeführt | Prüfe Ausführungsrechte (`chmod +x`). |
| „Marker __ARCHIVE_BEGIN__ not found“ | Stelle sicher, dass der Header unverändert ist. |
---
## Lizenz
Veröffentlicht unter der MIT-Lizenz – siehe `LICENSE` für Details.