Skip to content

[Update Workflow] Phase 4: /etc/profile.d alias script #1008

Description

@darksidemilk

Summary

Part of a 6-phase roadmap (see #1005 for Phase 1 and the full roadmap list).
Ships a generalized, distro-agnostic /etc/profile.d/fog.sh with shortcuts
for common admin tasks (updating, tailing logs), generalized from a personal
RHEL/site-specific alias file, so less-experienced Linux admins have an easy
on-ramp when asked for details/logs.

Design

  • New function installProfileAliases(), called near the end of the main
    install flow (alongside installUtilities), rendering
    /etc/profile.d/fog.sh via a heredoc using the install's own resolved
    paths ($fogprogramdir, $fog_git_path from Phase 1, $webdirdest,
    $servicelogs) -- no hardcoded distro-specific or site-specific paths.
  • Always regenerate the file fresh on install/update (it's fully derived, not
    meant to be hand-edited) -- safe and idempotent, same spirit as
    linkIfAbsent()'s re-run guarantee elsewhere in this codebase.
  • Alias set, generalized from a personal fog.profile.sh down to what FOG
    itself manages:
    • fogupdate -> bash $fog_git_path/bin/updatefog.sh (Phase 1)
    • cdfog -> cd $fog_git_path
    • cdfogweb -> cd $webdirdest
    • fogupdatelog -> tail -n 200 -f $servicelogs/fogupdate.log (Phase 1's log)
    • fogerrorlog -> tail -n 200 -f $apacheerrlog (FOG's own
      per-distro-resolved web error log path, not a hardcoded php-fpm path)
    • Dropped, not generalized: the Arrowhead-specific PowerShell
      image-branch-promotion aliases, and the raw mysql -u root fog shortcut
      (assumes passwordless root -- not a safe default to ship broadly).
  • No further wiring needed -- /etc/profile.d/*.sh is sourced automatically
    by login shells.

Files touched

  • lib/common/functions.sh (new installProfileAliases() + call site)

Verification

  • Fresh install, open a new login shell, confirm all aliases are present and
    each resolves to a correct path for that install.
  • Test on at least one apt-based and one dnf-based distro to confirm the web
    error log path resolves correctly per distro.
  • Re-run install/update and confirm the file is cleanly regenerated with no
    duplicated or stale entries from a prior install path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions