From 018846ad2037483fa037edfdf0d6a92729bad60a Mon Sep 17 00:00:00 2001 From: "Foad S. Farimani" Date: Fri, 9 Jan 2026 16:13:43 +0100 Subject: [PATCH] Add fdbox-git package --- fdbox-git/README.md | 108 ++++++++++++++++++++++++++++++++++++++++++++ fdbox-git/lure.sh | 55 ++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 fdbox-git/README.md create mode 100644 fdbox-git/lure.sh diff --git a/fdbox-git/README.md b/fdbox-git/README.md new file mode 100644 index 0000000..ecbba4c --- /dev/null +++ b/fdbox-git/README.md @@ -0,0 +1,108 @@ +# fdbox-git LURE Package + +## What is fdbox? + +[fdbox](https://github.com/diegoiast/fdbox) is a FreeDOS-like shell and utilities for Linux. It provides a command-line environment that mimics the classic DOS experience, implementing familiar commands like `dir`, `cd`, `type`, `copy`, `del`, and more. + +Think of it as a nostalgic bridge for those who grew up with DOS, or an educational tool for understanding how command-line interfaces evolved. + +### Features + +- FreeDOS-compatible command syntax +- Built-in commands: `dir`, `cd`, `cls`, `copy`, `del`, `echo`, `exit`, `md`, `rd`, `type`, `ver`, etc. +- Some Unix utilities: `cal`, `head`, `tail`, `hexdump` +- Lightweight C implementation +- Cross-platform (Linux, Windows) + +## Building Manually + +```bash +sudo apt install build-essential cmake git +git clone https://github.com/diegoiast/fdbox.git +cd fdbox +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE=Release +make +./fdbox +``` + +## Lessons Learned: LURE Packaging Pitfalls + +### 1. Debian Version Numbers Must Start with a Digit + +**Problem:** +``` +'Version' field value 'r282.6acbada-1': version number does not start with digit +``` + +**Cause:** The `version()` function generated `r282.6acbada` (commit count + short hash), but Debian policy requires version strings to begin with a digit. + +**Wrong:** +```bash +version() { + cd "$srcdir/fdbox" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} +``` + +**Correct:** +```bash +version() { + cd "$srcdir/fdbox" + # Prefix with 0.0.0 to satisfy Debian's digit-first requirement + printf "0.0.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} +``` + +**Result:** `0.0.0.r282.6acbada` — starts with a digit, Debian-compliant. + +### 2. Fallback Installation When No `make install` Target Exists + +**Problem:** Many small projects don't define an `install` target in their CMakeLists.txt. + +**Solution:** Use `||` to fall back to manual installation: +```bash +package() { + cd "$srcdir/fdbox/build" + make DESTDIR="$pkgdir" install || install -Dm755 fdbox "$pkgdir/usr/bin/fdbox" +} +``` + +This tries `make install` first, and if it fails, manually installs the binary with correct permissions (755) to `/usr/bin/`. + +### 3. CMake in `prepare()` vs `build()` + +**Why CMake runs in `prepare()`:** The CMake configure step downloads dependencies via CPM (CMake Package Manager) and requires internet access. LURE's `prepare()` phase is designed for tasks requiring network access, while `build()` should work offline. + +### 4. Git Source Syntax + +For git repositories in LURE, use the `git+` prefix: +```bash +sources=("git+https://github.com/diegoiast/fdbox.git") +checksums=("SKIP") # Git sources use SKIP for checksum +``` + +## Quick Reference: Debian Version Formats + +| Format | Valid? | Example | +|--------|--------|---------| +| `r123.abc1234` | ❌ No | Starts with letter | +| `0.0.0.r123.abc1234` | ✅ Yes | Starts with digit | +| `1.0.0` | ✅ Yes | Standard semver | +| `2024.01.15` | ✅ Yes | Date-based | +| `0~git20260109` | ✅ Yes | Pre-release with tilde | + +## File Structure + +``` +fdbox-git/ +├── lure.sh # LURE build script +├── README.md # This file +└── *.deb # Generated package (after build) +``` + +## References + +- [fdbox GitHub Repository](https://github.com/diegoiast/fdbox) +- [LURE Documentation](https://lure.sh/) +- [Debian Policy: Version Format](https://www.debian.org/doc/debian-policy/ch-controlfields.html#version) diff --git a/fdbox-git/lure.sh b/fdbox-git/lure.sh new file mode 100644 index 0000000..556ed8c --- /dev/null +++ b/fdbox-git/lure.sh @@ -0,0 +1,55 @@ +name="fdbox-git" +version="0.0.0" +release="1" +desc="FreeDOS-like shell and utilities for Linux" +homepage="https://github.com/diegoiast/fdbox" +maintainer="Foad " +architectures=("amd64") +license=("GPL-3.0-only") +provides=("fdbox") +conflicts=("fdbox") + +# Build Dependencies +# - cmake & git: required for build configuration and CPM downloads +# - python3: detected/used during configuration +# - build-essential: for gcc/make +build_deps=("git" "cmake" "build-essential" "python3") + +# Runtime Dependencies +deps=("libc6") + +sources=("git+https://github.com/diegoiast/fdbox.git") +checksums=("SKIP") + +version() { + cd "$srcdir/fdbox" + # Generates a version string like r123.abc1234 + printf "0.0.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + # 1. Create build directory + mkdir -p "$srcdir/fdbox/build" + cd "$srcdir/fdbox/build" + + # 2. Run CMake + # We run this in prepare() because it downloads dependencies (CPM) + # and requires internet access. + cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release +} + +build() { + cd "$srcdir/fdbox/build" + # 3. Compile + make +} + +package() { + cd "$srcdir/fdbox/build" + + # 4. Install + # Try using the standard make install. + # The '||' operator ensures that if 'make install' fails (e.g., no target defined), + # we fall back to installing the binary manually. + make DESTDIR="$pkgdir" install || install -Dm755 fdbox "$pkgdir/usr/bin/fdbox" +}