Change default shell from bash to zsh by default?

Please feel free to proceed with integrating this by default in Kicksecure / Whonix.

Ideally using ZDOTDIR environment variable if possible. “Stealing” (overwriting) config files from Debian’s zsh (or any other) package using config-package-dev should be avoided if somehow possible.

Ok.

Looks really nice.

Yeah, I guess so. No strong opinion here.

I am looking at this from a different perspective. More like: I always want to see some result even if it means “OK” because otherwise I question if the mechanism to show the error itself is broken. Maybe very likely unlikely here. These fail-safe considerations of mine are probably less important than the usability impact of only showing exit codes on failure.

Or to find out about unexpected exit codes. (Zero when it should be non-zero.)

If nobody else has an opinion here, probably best to only show the non-zero exit codes by default.

Looks really great.

Where should ZDOTDIR be set? Which file will export that variable?

Change for that? Remove RPS1 in favor of the setopt PRINT_EXIT_VALUE?

1 Like

Yes.

/etc/X11/Xsession.d + /etc/profile.d
Similar to other examples in Whonix source code.
…unless there are other solutions that I am not aware of. Distributions setting global environment variables is messy. There are probably no better solutions.

Seems to be dependent on Xorg being installed

Zsh does not source that folder unless in compatibility mode, which is not what we want.

I am still searching for other directories…

1 Like

Yes but it’s OK to drop config file snippets in that folder independent of Xorg being installed. So that doesn’t speak against using it. If a drop-in is there, then Xorg is supported.

So seems setting that environment variable in Xorg is easy and reliably possible thanks to /etc/X11/Xsession.d.

For Virtual Consoles I am not sure. I will probably open a separate forum thread because setting environment variables might need a re-design if possible.

https://manpages.debian.org/bullseye/zsh-common/zshall.1.en.html#STARTUP/SHUTDOWN_FILES

Maybe I found a solution…

  • No need to use /etc/X11/Xsession.d.
  • No need to use /etc/profile.d.
  • Only use /usr/lib/systemd/system.conf.d mechanism.

/usr/lib/systemd/system.conf.d/30_desktop-config-dist.conf

[Manager]
DefaultEnvironment=ZDOTDIR=/etc/zsh/dist

Reboot required.

dist stands for distribution. What distribution? Kicksecure and Whonix. I couldn’t come up with a better common name. That’s where the “dist” is coming from. Kept it open so potentially other distributions could fork it so neither Kicksecure nor Whonix are inside the package or folder name if not required.

Does this work? What do you think?

What is the reason it can’t be in Skel?

Systemd does not work on Qubes apparently per your mentioned post.

.zprofile symlink to .config/shell/profile

.config/shell/profile exports ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"

ZDOTDIR contains the .zshrc

I think this is the cleanest way. The only thing is that skel needs to have some files. Is there a problem in that?

It does not depend on external program being installed and used.

Oops. Forgot to write DefaultEnvironment=. Now fixed and edited in above post.

Could you try again please?

I tested it with other variable names. Maybe it only works for other variable names and unfortunately there is some mechanism breaking it for ZDOTDIR.

This one is 100% tested and functional.

/usr/lib/systemd/system.conf.d/30_kicksecure.conf

[Manager]
DefaultEnvironment=TESTVAR=1

/usr/lib/systemd/system.conf.d/30_kicksecure.conf

[Manager]
DefaultEnvironment=TESTVAR=1

DefaultEnvironment=ZTESTDIR=/etc/zsh/dist

DefaultEnvironment=ZDOTDIR=/etc/zsh/dist

DefaultEnvironment=ZDOTDIRWHAT=/etc/zsh/dist

All functional.

env  | grep ZDOTDIR

ZDOTDIRWHAT=/etc/zsh/dist
ZDOTDIR=/etc/zsh/dist

(We’ll of course not ship the other variables which are just there for testing. Production version will of course only have ZDOTDIR.)

No such issue. All good.

Last resort only. Reasons:

The systemd DefaultEnvironment approach seems much cleaner.

OK, will accept this method.

Will test then.

To which repo this should be added together with the dotfiles?

1 Like

Good question. Looking through Kicksecure · GitHub I was wondering in which package it fits best without needing to invent yet another package. GitHub - Kicksecure/desktop-config-dist seems best. Since it’s kinda a “desktop” modification. Not desktop as in graphical desktop but desktop/notebook user interface related settings.

Currently description is Configuration for Derivative Xfce Desktop but Xfce can be removed from the description to make it more general. Changes by that package seem useful, some even have security impact but still optional and not of very critical importance.

1 Like

IJust to remeber to myself this doesn’t work on Qubes, prefix should be /usr/local/lib

1 Like

Nevermind, I should have done this on the template…

1 Like
1 Like