aboutsummaryrefslogtreecommitdiff
path: root/_ops/awwan-test
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-02-08 00:07:27 +0700
committerShulhan <ms@kilabit.info>2025-02-08 15:12:35 +0700
commita8a2d723d9d3cd5df3b7c241d9d3c214d447e281 (patch)
treef18862204dc2a391b000078f2d45ea8e52562b8f /_ops/awwan-test
parent49e7143dbad57a48115fdd299b42ab8e66f6d7cc (diff)
downloadawwan-a8a2d723d9d3cd5df3b7c241d9d3c214d447e281.tar.xz
all: another fix for integration tests
In the mkosi 25.3 the environment variable $MKOSI_UID now using subuid, which return 0 if we have subuid "<user>:100000:65536". The mkosi.nspawn is not imported to the build directory, so we need to copy it from source.
Diffstat (limited to '_ops/awwan-test')
-rw-r--r--_ops/awwan-test/mkosi.conf8
-rwxr-xr-x_ops/awwan-test/mkosi.finalize.chroot7
-rwxr-xr-x_ops/awwan-test/mkosi.postinst.chroot (renamed from _ops/awwan-test/mkosi.prepare.chroot)18
3 files changed, 19 insertions, 14 deletions
diff --git a/_ops/awwan-test/mkosi.conf b/_ops/awwan-test/mkosi.conf
index c245e63..f0ff464 100644
--- a/_ops/awwan-test/mkosi.conf
+++ b/_ops/awwan-test/mkosi.conf
@@ -1,5 +1,8 @@
-[Output]
+[Build]
CacheDirectory=~/.cache/mkosi/
+Incremental=yes
+
+[Output]
CompressOutput=false
Format=tar
Output=awwan-test
@@ -8,6 +11,3 @@ OutputDirectory=/data/awwan/
[Content]
Bootable=no
CleanPackageMetadata=false
-
-[Host]
-Incremental=yes
diff --git a/_ops/awwan-test/mkosi.finalize.chroot b/_ops/awwan-test/mkosi.finalize.chroot
index 96cff1c..eb76798 100755
--- a/_ops/awwan-test/mkosi.finalize.chroot
+++ b/_ops/awwan-test/mkosi.finalize.chroot
@@ -1,9 +1,6 @@
-#!/bin/sh
+#!/bin/bash
systemctl enable sshd.service
+## Fix sshd service not running due to permission too open.
chmod 0600 /etc/ssh/*_key
-chown -R awwan:awwan /home/awwan/
-chmod 0755 /home/awwan
-chown -R awwanssh:awwanssh /home/awwanssh/
-chmod 0755 /home/awwanssh
diff --git a/_ops/awwan-test/mkosi.prepare.chroot b/_ops/awwan-test/mkosi.postinst.chroot
index 0c401fb..783eb64 100755
--- a/_ops/awwan-test/mkosi.prepare.chroot
+++ b/_ops/awwan-test/mkosi.postinst.chroot
@@ -1,18 +1,26 @@
-#!/bin/sh
+#!/bin/bash
set -x
## User testing sudo with password prompt.
-## The UID of user in container must equal with UID in host, for
-## better compatibility.
## The password is "awwan".
+
useradd --create-home --user-group \
- --uid $MKOSI_UID \
--password '$2a$10$XVhjfOB4Un5DJE4TQEBPrOHfBVGVWP4iA3ElUMzcbJ7jdc2zZPgZ2' \
awwan
+mkdir -p /home/awwan/src
+mkdir -p /home/awwan/.cache/go-build
+mkdir -p /home/awwan/go/pkg/mod
+
+chown -R awwan:awwan /home/awwan/
+chmod 0755 /home/awwan
+
## User testing with ssh.
+
useradd --create-home --user-group --groups wheel \
- --uid $((MKOSI_UID+1)) \
--password '$2a$10$XVhjfOB4Un5DJE4TQEBPrOHfBVGVWP4iA3ElUMzcbJ7jdc2zZPgZ2' \
awwanssh
+
+chown -R awwanssh:awwanssh /home/awwanssh/
+chmod 0755 /home/awwanssh