92b5e9c4a6
Free-space start alignment
parted reports free space starting at 0,02 MiB (before the GPT
alignment boundary). The collect_free_space awk now rounds the start
up to the next whole MiB (ceiling) and enforces a minimum of 1 MiB,
then recomputes the usable size from the adjusted start. This prevents
parted from being asked to create a partition at 0 MiB, which it
cannot do.
Locale-independent partition creation
The previous `printf 'Yes\n' | parted mkpart` relied on parted
accepting an English answer to its alignment-confirmation prompt.
On a German-locale system parted asks "Ist dies noch akzeptabel?"
and ignores "Yes", causing mkpart to fail. Replaced with `parted -s`
(script/non-interactive mode), consistent with every other parted
call in the script.
Correct new-partition detection on disks with gaps
The old heuristic took the highest partition number after partprobe.
On a disk where existing partitions are numbered 2/3/4, a new
partition in the gap before them receives number 1 — making the
old heuristic point at partition 4 (the existing btrfs volume) and
subsequently run mkfs.btrfs on it. The new awk matches by start
position (OEMDRV_START ± 1 MiB) instead, which is unambiguous
regardless of how numbers are assigned.
Infinite loop on EOF stdin
When the selection while-loop's `read` hits EOF (e.g. stdin exhausted
after sudo consumed a piped password), it returns exit code 1 with an
empty INPUT, which falls through to "Invalid input." and spins
forever. Added `|| { echo; echo "Aborted."; exit 0; }` to all three
read calls in the loop.
install.md: drop stale install_from_repo.sh reference from title;
clarify that REPO_URL/REPO_BRANCH overrides are optional.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
2.4 KiB
Markdown
66 lines
2.4 KiB
Markdown
# OEMDRV Bootstrap — install.sh
|
|
|
|
the script `./system_setup/install.sh` prepares a target machine for automated Fedora deployment. It shrinks an existing partition to carve out a dedicated **OEMDRV** partition, which Anaconda/Kickstart will detect automatically during installation.
|
|
|
|
## What it does
|
|
|
|
1. Lists all ext4 and btrfs partitions that have enough free space to be shrunk.
|
|
2. Asks you to select one and shrinks it by **4 GiB**.
|
|
3. Creates a new 4 GiB BTRFS partition labeled `OEMDRV` in the freed space.
|
|
4. Mounts it to `/opt/sys_config` with `compress=zstd:6`.
|
|
5. Clones this repository (depth 1) into `/opt/sys_config`.
|
|
|
|
## Prerequisites
|
|
|
|
- Run as **root** on the target machine (live system or installed OS).
|
|
- The following tools must be present: `parted`, `e2fsck`, `resize2fs` or `btrfs-progs`, `mkfs.btrfs`, `git`, `curl`.
|
|
- The partition you want to shrink must **not** be the root filesystem (`/`) and must have at least **4.5 GiB free**.
|
|
- Network access to `gitea.dtext.online`.
|
|
|
|
## Run directly from the repository
|
|
|
|
Download the script first, then run it as root:
|
|
|
|
```bash
|
|
curl -fsSL https://gitea.dtext.online/obel1x/fedora-OEMDRV/raw/branch/main/system_setup/install.sh -o /tmp/install.sh
|
|
sudo bash /tmp/install.sh
|
|
```
|
|
|
|
## Run directly from another repository
|
|
|
|
If you are on another fork or branch and you want to test your changes, do:
|
|
|
|
```bash
|
|
export REPO_URL="https://yourgitserver.tld/.../fedora-OEMDRV.git"
|
|
export REPO_BRANCH="anotherbranch"
|
|
curl -fsSL ${REPO_URL%.git}/raw/branch/${REPO_BRANCH:-main}/system_setup/install.sh -o /tmp/install.sh
|
|
sudo -E bash /tmp/install.sh
|
|
```
|
|
|
|
Both are optional. That way, install.sh should know what to pull.
|
|
|
|
## After the script completes
|
|
|
|
Configure your environment before running any installation:
|
|
|
|
```sh
|
|
cp /opt/sys_config/config/setup_system.conf.dist /opt/sys_config/config/setup_system.conf
|
|
# Edit setup_system.conf — set TLDOMAIN, SERVERFQDN_IPA, SERVERFQDN_NC, and paths.
|
|
```
|
|
|
|
Optionally add local per-machine overrides in `config.d/`:
|
|
|
|
```sh
|
|
# Example: use the devel branch on this machine
|
|
echo 'export UPGRADEBRANCH="devel"' > /opt/sys_config/config.d/system_defines.conf
|
|
```
|
|
|
|
Once configured, boot the Fedora installer from USB — Anaconda will detect the `OEMDRV` partition and run the Kickstart automatically.
|
|
|
|
## Supported filesystems for shrinking
|
|
|
|
| Filesystem | Method |
|
|
|---|---|
|
|
| ext4 | `e2fsck` + `resize2fs` (offline) |
|
|
| btrfs | `btrfs filesystem resize` (temporary mount) |
|