This is necessary in case more than one terminal is installed, and they
both have the same alternative priority.
For example, while installing all packages at once, sometimes apt will
resolve a dependency "x-terminal-emulator" to one of the many packages
that provide it, for example "zutty". And then it will also install the
terminal listed in the "kali-desktop-${desktop}" metapackage that is
selected, eg. "qterminal" for "kali-desktop-xfce".
Both zutty and qterminal have a alternative priority of 40 at the
moment, so if zutty gets unpacked first, it will have precendence and be
the default terminal.
It's a long-standing issue. By the past, We tried to make sure that the
default desktop terminal is installed first, by listing it early in the
dependencies of the "kali-desktop-{desktop}" metapackage, and it kind of
works with the debian-installer, but it was hard to make it work (we had
to do some changes in tasksel), and it's still brittle as it relies on
apt's dependency solving, which is apt's internal sauce and might change
(hint, apt will get a new solver soon, cf [1]).
As it turns out, it doesn't work for the live iso, somehow we still get
zutty taking precedence over qterminal, I didn't check why, it probably
has to do with how live-build constructs the apt command-line in order
to install everything.
In any case: I think our approach so far didn't work, so with this
commit, we take another approach: we set the default terminal from the
finish-install script, for both the installer iso and the live iso. That
should solve the issue for good.
[1]: https://blog.jak-linux.org/2024/05/14/solver3/
Even though it's currently empty, we want users to have this component
enabled so that they don't miss on updates when we start to move
packages from non-free to non-free-firmware.
The function get_user_list returns a list of users on stdout, so
obviously it can't use stdout to also display messages. Use stderr
instead.
Note that we could also silently skip if we find a directory in /home
that is not a user. Does it happen in practice?
The vboxsf group is created by the postinst script of the package
virtualbox-guest-utils. The kali user needs to be part of this group
in order to access VirtualBox's shared folders.
This change does just that. It's effective for all the Live images
(where VirtualBox guest additions are installed unconditionnally),
and for the systems installed by the Installer image where VirtualBox
was detected (and therefore VirtualBox guest additions were installed).
Ref: <https://bugs.kali.org/view.php?id=7643>
Up to now, it was fine to use a command such as:
usermod -a -G group1,group2,... kali
However a limitation is that all the groups that are given to the option
-G must exist. If that's not the case, usermod fails (return code: 6)
without doing anything, and the user is not added to any group.
So with this commit, we prepare the code to support optional groups,
that might or might not exist. If ever a group does not exist, it's
skipped silently.
Changes:
- order groups alphabetically
- use the same comment "Ensure those groups exist" consistently in the 2
scripts, and also drop the comment regarding a "generically named"
function.
- adds "|| true" to the usermod command in kali-user-setup (only for
consistency, the script is not run with "set -e" anyway).
After those changes, the two functions "configure_usergroups()" are very
similar, and it's very easy to spot the differences between both.
This was introduced in 5989ec37de, and
probably that was not the intention.
Adding root to groups doesn't break anything, but I don't think it makes
any sense either.