[Grml] A scheme to manage several ZSH config file collections?

Richard Hartmann richih.mailinglist at gmail.com
Thu Jul 24 16:31:34 CEST 2008


On Thu, Jul 24, 2008 at 14:58, Frank Terbeck <ft at grml.org> wrote:


>>  1. Don't touch the current zshrc at all. It works fine and should be
>>     left intact unmodified.
>
> We'll need to stop the normal zshrc from sourcing, so something like:

If there _is_ no normal zshrc, zsh-newuser-install will run. As we can
easily replace this function, ZSH does the handling of this for free.
The default zsh could be loaded the second a user presses enter on
the little welcome screen menu grml displays on tty1 and everything
set up to use this config, as well. Said menu would run from
zsh-newuser-install then, btw.


>>  3. Put *every* function file, that does not collide with the ones
>>     that are already in grml's configuration into
>>     /etc/zsh/functions.d; There's no reason from keeping non-colliding
>>     function to not be in the standard config.
>
> Unless, the function does only have value in connection with the
> configuration in question.

As I autoload every one of my functions in my zshrc via globbing, I
would want to keep softlinks for the functions moved into main,
but yes, that is a good idea.


>>  4. add /etc/zsh/rcs/richih.d/ at the *beginning* be $fpath so that
>>     colliding functions are not taken from the default dir, but from
>>     the dir that is part of the config, that is in action.

[[ -n $ZSHRC_ALT ]] && . /etc/zsh/rcs/$ZSHRC_ALT.d

in all zshrcs would mean you can fork and otherwise mangle them
without needing to touch anything in the actual file.


>>     Do NOT source /etc/zsh/zshrc in that case.

This should exist and overwrite the normal zsh-newuser-install.


>>     Do NOT source ~/.zshrc in that case (set $ZDOTDIR to
>>     ~/.zshrc.$ZSHRC_ALT - that would make ~/.zshrc.$ZSHRC_ALT/.zshrc
>>     to be sourced; standard zsh mechanism.)
>
> We should touch a .zshrc in there if a given configuration does not
> provide one in order to avoid the newuser-module-dialog.

I would rather have a ~/.zshrc that simply uses $ZDOTDIR to
source everything. Solves two problems in one go.


>>  5. Do the handling of $ZSHRC_ALT, $ZDOTDIR and $fpath in the global
>>     zshenv (/etc/zsh/zshenv) in a
>>
>>         if [[ -o interactive ]] ; then
>>         fi
>>
>>     Block;

Would also be solved by the above, so make that three.


Richard



More information about the Grml mailing list