]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Beef up testuser a bit 33886/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 Jul 2024 15:42:56 +0000 (17:42 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 Jul 2024 16:32:53 +0000 (18:32 +0200)
Give it a password and add it to some common groups.

mkosi.conf.d/10-opensuse/mkosi.conf
mkosi.postinst.chroot

index e741aa4a9c64bf52e97f1c73df98645e900f4de5..dc9bf304290c7796a4751abcca9fe78e844d0ad0 100644 (file)
@@ -43,6 +43,7 @@ Packages=
         glibc-locale-base
         gnutls
         grep
+        group(wheel)
         gzip
         iputils
         kernel-default
index 7f2666e0a43e8ee4f63df8851f737834be3cbceb..1809a302bcf2318fc63266be7a0f44bce4a982ab 100755 (executable)
@@ -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