Follow-ups from testing bin/updatefog.sh (#1005 / #1011):
1. Custom httpd/nginx vhost (with custom cert config) gets clobbered on update
createSSLCA() (lib/common/functions.sh) unconditionally regenerates the web
server vhost ($etcconf) from scratch on every install/update run unless
-F/--no-vhost is passed. Apache at least saves a .timestamp copy first;
nginx has no backup at all. bin/updatefog.sh doesn't pass -F when
re-invoking installfog.sh, so any hand-edited vhost (custom SSL directives,
extra server blocks, etc.) is silently overwritten on every update.
Fix: updatefog.sh should default to -F on its re-install (an update always
has a pre-existing vhost), with an opt-in flag to force regeneration. Separately,
the normal (non-updatefog.sh) install/upgrade path should snapshot the
existing vhost before overwriting it and warn when the new content differs,
so a bare ./installfog.sh upgrade doesn't lose customizations silently either.
2. Same class of bug: /etc/default/tftpd-hpa (Debian TFTP config)
configureTFTPandPXE() unconditionally echo ... >-overwrites
/etc/default/tftpd-hpa every run, no backup, no warning. Same fix as above.
3. PHP/MariaDB config -- checked, not affected
php.ini and my.cnf/mariadb config edits are targeted sed -i patches against
FOG's own known default lines, not full-file overwrites -- other admin
customizations in those files are left alone. No fix needed; documenting so
it doesn't get re-flagged.
4. updatefog.sh should support arbitrary branches, not just channels
Only stable/dev/beta are checkoutable today (channelToBranch). Add
--branch <name> to check out an arbitrary branch directly -- makes testing
PR/feature branches much easier. Does not persist as the tracked channel.
5. --channel doesn't actually stick
updatefog.sh --channel X only overrides fog_update_channel in the parent
process's memory; the child installfog.sh re-sources the OLD value from
.fogsettings and persists that back. Fix: have updatefog.sh call the
existing writeUpdateFile() to persist the new channel before invoking the
child, so it actually sticks for future unattended runs.
6. Self-modifying script location -- investigated, not a bug
Checked whether updatefog.sh running from inside the git checkout it
git checkout/reset --hards is unsafe (a script rewriting itself mid-run).
Reproduced with a 2MB self-checkout test script: bash safely finishes
executing the original file content to completion regardless of the checkout
swapping in different content underneath it (POSIX unlink-while-open
semantics / git's replace-via-rename). No fix needed; documenting in code so
it isn't re-litigated.
Part of the Update Workflow epic alongside #1006-#1010.
Follow-ups from testing bin/updatefog.sh (#1005 / #1011):
1. Custom httpd/nginx vhost (with custom cert config) gets clobbered on update
createSSLCA()(lib/common/functions.sh) unconditionally regenerates the webserver vhost (
$etcconf) from scratch on every install/update run unless-F/--no-vhostis passed. Apache at least saves a.timestampcopy first;nginx has no backup at all.
bin/updatefog.shdoesn't pass-Fwhenre-invoking
installfog.sh, so any hand-edited vhost (custom SSL directives,extra server blocks, etc.) is silently overwritten on every update.
Fix: updatefog.sh should default to
-Fon its re-install (an update alwayshas a pre-existing vhost), with an opt-in flag to force regeneration. Separately,
the normal (non-updatefog.sh) install/upgrade path should snapshot the
existing vhost before overwriting it and warn when the new content differs,
so a bare
./installfog.shupgrade doesn't lose customizations silently either.2. Same class of bug: /etc/default/tftpd-hpa (Debian TFTP config)
configureTFTPandPXE()unconditionallyecho ... >-overwrites/etc/default/tftpd-hpaevery run, no backup, no warning. Same fix as above.3. PHP/MariaDB config -- checked, not affected
php.ini and my.cnf/mariadb config edits are targeted
sed -ipatches againstFOG's own known default lines, not full-file overwrites -- other admin
customizations in those files are left alone. No fix needed; documenting so
it doesn't get re-flagged.
4. updatefog.sh should support arbitrary branches, not just channels
Only
stable/dev/betaare checkoutable today (channelToBranch). Add--branch <name>to check out an arbitrary branch directly -- makes testingPR/feature branches much easier. Does not persist as the tracked channel.
5.
--channeldoesn't actually stickupdatefog.sh --channel Xonly overridesfog_update_channelin the parentprocess's memory; the child
installfog.shre-sources the OLD value from.fogsettingsand persists that back. Fix: have updatefog.sh call theexisting
writeUpdateFile()to persist the new channel before invoking thechild, so it actually sticks for future unattended runs.
6. Self-modifying script location -- investigated, not a bug
Checked whether updatefog.sh running from inside the git checkout it
git checkout/reset --hards is unsafe (a script rewriting itself mid-run).Reproduced with a 2MB self-checkout test script: bash safely finishes
executing the original file content to completion regardless of the checkout
swapping in different content underneath it (POSIX unlink-while-open
semantics / git's replace-via-rename). No fix needed; documenting in code so
it isn't re-litigated.
Part of the Update Workflow epic alongside #1006-#1010.