fix: an image is exported named after its appliance, with no 127.0.1.1 line #35

Merged
marcos-mendez merged 2 commits from fix/export-drops-build-hostname into 19.x 2026-10-03 07:19:19 -03:00
marcos-mendez commented 2026-10-02 23:02:24 -03:00 (Migrated from github.com)

A Keel Web image carried 127.0.1.1 web in /etc/hosts from the build-time hostname (conf/turnkey.d/hostname), and the live container created by pct had both that line and pct's 127.0.1.1 keel-web1.pop.coop keel-web1 (2026-10-03).

Change: mk/turnkey/seal-hostname ROOTFS, a sibling of seal-root, run in root.patched/post of mk/turnkey.mk and mk/turnkey-desktop.mk right after bin/keel-version-files and before seal-root:

  • writes the app field of /etc/keel_version (fallback /etc/turnkey_version; prefix and grammar from lib/version-files.sh, so nginx-php-fastcgi stays whole) to /etc/hostname, mode 0644;
  • drops every 127.0.1.1 line of /etc/hosts (any spacing, any names; 127.0.1.10 is not one), keeping every other line and the file's mode; a tree without /etc/hosts is fine;
  • fails the build with its own exit code and message when no identity file names the appliance (1), the string is not an appliance identity (1), the tree is unwritable (2) or the library is missing (3).

The first boot is then the only writer of the machine's name: inithooks' 09hostname renames the files through lib/hostname.sh, and 31fqdn writes the hosts entry through fqdn.py --hosts.

Tests: tests/seal-hostname.bats (17 cases, 100 percent of the script under kcov 43, added to tests/coverage.sh); two new cases in tests/mk-identity.bats run the recipe of both makefiles against the fab stubs and read /etc/hostname and /etc/hosts back. seal-root.bats still asserts seal-root is the recipe's last step. Changelog bullet in the unreleased turnkey-core-19.0 (1) entry of changes/turnkey.changelog.

Decided, for the maintainer: the step runs inside the if [ -f ./changelog ] branch, since it needs the identity file written just before it; a build without a changelog still goes on with upstream's warning and keeps the build hostname, as it did before. Desktop builds get the step too, as they get the identity files.

A Keel Web image carried `127.0.1.1 web` in `/etc/hosts` from the build-time hostname (`conf/turnkey.d/hostname`), and the live container created by pct had both that line and pct's `127.0.1.1 keel-web1.pop.coop keel-web1` (2026-10-03). **Change:** `mk/turnkey/seal-hostname ROOTFS`, a sibling of `seal-root`, run in `root.patched/post` of `mk/turnkey.mk` and `mk/turnkey-desktop.mk` right after `bin/keel-version-files` and before `seal-root`: - writes the app field of `/etc/keel_version` (fallback `/etc/turnkey_version`; prefix and grammar from `lib/version-files.sh`, so `nginx-php-fastcgi` stays whole) to `/etc/hostname`, mode 0644; - drops every `127.0.1.1` line of `/etc/hosts` (any spacing, any names; `127.0.1.10` is not one), keeping every other line and the file's mode; a tree without `/etc/hosts` is fine; - fails the build with its own exit code and message when no identity file names the appliance (1), the string is not an appliance identity (1), the tree is unwritable (2) or the library is missing (3). The first boot is then the only writer of the machine's name: inithooks' `09hostname` renames the files through `lib/hostname.sh`, and `31fqdn` writes the hosts entry through `fqdn.py --hosts`. **Tests:** `tests/seal-hostname.bats` (17 cases, 100 percent of the script under kcov 43, added to `tests/coverage.sh`); two new cases in `tests/mk-identity.bats` run the recipe of both makefiles against the fab stubs and read `/etc/hostname` and `/etc/hosts` back. `seal-root.bats` still asserts `seal-root` is the recipe's last step. Changelog bullet in the unreleased `turnkey-core-19.0 (1)` entry of `changes/turnkey.changelog`. **Decided, for the maintainer:** the step runs inside the `if [ -f ./changelog ]` branch, since it needs the identity file written just before it; a build without a changelog still goes on with upstream's warning and keeps the build hostname, as it did before. Desktop builds get the step too, as they get the identity files.
Sign in to join this conversation.
No description provided.