Skip to content

consolefont: allow passing extra arguments to setfont#1001

Open
Feasuro wants to merge 1 commit intoOpenRC:masterfrom
Feasuro:consolefont-args
Open

consolefont: allow passing extra arguments to setfont#1001
Feasuro wants to merge 1 commit intoOpenRC:masterfrom
Feasuro:consolefont-args

Conversation

@Feasuro
Copy link
Copy Markdown

@Feasuro Feasuro commented Apr 9, 2026

Summary

This change introduces support for an optional customflags variable in /etc/conf.d/consolefont, allowing users to pass additional arguments to the setfont command.

Motivation

Currently, the consolefont OpenRC service does not provide a way to customize the arguments passed to setfont. Users who need non-default behavior (for example, using the -d flag for double-size fonts) must modify /etc/init.d/consolefont directly.

Since this file is owned by the package, such changes are overwritten on upgrade, forcing users to rely on fragile workarounds such as patching via package manager hooks.

Proposed solution

Introduce a new optional variable:

customflags=""

This variable is sourced from /etc/conf.d/consolefont and appended to the setfont invocation:

setfont $customflags $consolefont $param -C $ttydev$x >/dev/null

Benefits

  • Enables customization without modifying init scripts
  • Preserves existing default behavior when unset
  • Aligns with existing OpenRC patterns of exposing command arguments via /etc/conf.d/*
  • Eliminates the need for downstream patching or hooks

Backward compatibility

No changes in behavior for existing users. If customflags is unset or empty, the command behaves exactly as before.

Example usage

To enable double-size console fonts:

consolefont="Lat2-Terminus16"
customflags="-d"

@rapidcow
Copy link
Copy Markdown

By merit of shell splitting I have been able to pass the -d flag by simply specifying the consolefont with it:

$ grep ^consolefont= /etc/conf.d/consolefont
consolefont="-d Tamsyn7x13r"

==> /var/log/rc.log <==
rc boot
 * Setting console font [-d Tamsyn7x13r] ...
 [ ok ]

That already lets me pass arbitrary flags in any way I see fit; but that's just my two cents. ;)

That aside, a few thoughts (despite not being a maintainer):

  • customflags is way too generic (and if not, it as a variable optionally read from the environment is!). Better scope it with a prefix like consolefont_args (I like args because they seem far more common in conf.d than opt[ion]s or flags.)
  • A generic pass-through variable may not be the most consistent with existing variables that deal with one argument at a time (consoletranslation => -m/--consolemap, unicodemap => -u/--unicodemap). I would consider making it a boolean like consolefont_double="YES" unless there is another flag other than -d/--double you need for setfont(8). (Personally, I don't really see any...)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants