mkosi: Beef up testuser a bit
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 Jul 2024 15:42:56 +0000 (17:42 +0200)
committerLuca Boccassi <bluca@debian.org>
Thu, 15 Aug 2024 13:04:41 +0000 (14:04 +0100)
Give it a password and add it to some common groups.

(cherry picked from commit 3fe25d4530356b3b04d505bc5442503897c124dd)

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