summaryrefslogtreecommitdiffstats
path: root/mkosi.postinst.chroot
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-07-31 17:42:56 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-07-31 18:32:53 +0200
commit3fe25d4530356b3b04d505bc5442503897c124dd (patch)
tree4f8c1d8848a84a9d2def831ef2fd7a6d05189627 /mkosi.postinst.chroot
parentmkosi: Switch to autologin via credentials (diff)
downloadsystemd-3fe25d4530356b3b04d505bc5442503897c124dd.tar.xz
systemd-3fe25d4530356b3b04d505bc5442503897c124dd.zip
mkosi: Beef up testuser a bit
Give it a password and add it to some common groups.
Diffstat (limited to 'mkosi.postinst.chroot')
-rwxr-xr-xmkosi.postinst.chroot15
1 files changed, 14 insertions, 1 deletions
diff --git a/mkosi.postinst.chroot b/mkosi.postinst.chroot
index 7f2666e0a4..1809a302bc 100755
--- a/mkosi.postinst.chroot
+++ b/mkosi.postinst.chroot
@@ -3,7 +3,20 @@
set -e
set -o nounset
-useradd --uid 4711 --create-home --user-group testuser
+if [[ "$DISTRIBUTION" =~ ubuntu|debian ]]; then
+ SUDO_GROUP=sudo
+else
+ SUDO_GROUP=wheel
+fi
+
+useradd \
+ --uid 4711 \
+ --user-group \
+ --create-home \
+ --password "$(openssl passwd -1 testuser)" \
+ --groups "$SUDO_GROUP",systemd-journal \
+ --shell /bin/bash \
+ testuser
if command -v authselect >/dev/null; then
# authselect 1.5.0 renamed the minimal profile to the local profile without keeping backwards compat so