diff --git a/.mkosi/mkosi.fedora b/.mkosi/mkosi.fedora index 01bfd2338bb..9769b054474 100644 --- a/.mkosi/mkosi.fedora +++ b/.mkosi/mkosi.fedora @@ -31,7 +31,6 @@ BuildPackages= gnu-efi-devel gnutls-devel gperf - hostname iptables-devel kmod-devel libacl-devel diff --git a/.mkosi/mkosi.opensuse b/.mkosi/mkosi.opensuse new file mode 100644 index 00000000000..1faf9cc4763 --- /dev/null +++ b/.mkosi/mkosi.opensuse @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: LGPL-2.1+ + +# This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). +# Simply invoke "mkosi" in the project directory to build an OS image. + +[Distribution] +Distribution=opensuse +Release=tumbleweed + +[Output] +Format=raw_btrfs +Bootable=yes + +[Partitions] +RootSize=3G + +[Packages] +# Uncomment to share system RPM cache (works only with Tumbleweed) +#Cache=/var/cache/zypp/packages +BuildDirectory=mkosi.builddir +BuildPackages= + docbook-xsl-stylesheets + fdupes + gcc + gnu-efi + gperf + intltool + libacl-devel + libapparmor-devel + libblkid-devel + libbz2-devel + libcap-devel + libcryptsetup-devel + libcurl-devel + libgcrypt-devel + libkmod-devel + liblz4-devel + libmicrohttpd-devel + libmount-devel + libseccomp-devel + libselinux-devel + libxslt-tools + m4 + meson + pam-devel + pciutils-devel + pcre-devel + python3 + python3-lxml + qrencode-devel + zlib-devel +# to satisfy tests + acl + glibc-locale + system-group-obsolete + timezone + +Packages= + # brought in via meson->python3 + libp11-kit0 diff --git a/mkosi.build b/mkosi.build index 16ac2e9d0d6..4a13f1075eb 100755 --- a/mkosi.build +++ b/mkosi.build @@ -42,6 +42,14 @@ fi if [ ! -f "$BUILDDIR"/build.ninja ] ; then sysvinit_path=`realpath /etc/init.d` + init_path=`realpath /sbin/init 2>/dev/null` + if [ -z "$init_path" ] ; then + rootprefix="" + else + rootprefix=${init_path%/lib/systemd/systemd} + rootprefix=/${rootprefix#/} + fi + nobody_user=`id -u -n 65534 2> /dev/null` if [ "$nobody_user" != "" ] ; then # Validate that we can translate forth and back @@ -76,11 +84,17 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then fi fi - meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D default-hierarchy=unified -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group" + meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D "rootprefix=$rootprefix" -D default-hierarchy=unified -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group" fi ninja -C "$BUILDDIR" all -[ "$WITH_TESTS" = 0 ] || ninja -C "$BUILDDIR" test +if [ "$WITH_TESTS" = 1 ] ; then + for id in 1 2 3; do + groupadd -g $id testgroup$id || : + done + + ninja -C "$BUILDDIR" test +fi ninja -C "$BUILDDIR" install mkdir -p "$DESTDIR"/etc diff --git a/test/test-execute/exec-specifier.service b/test/test-execute/exec-specifier.service index 7c3f81f2b53..a58abc68dd6 100644 --- a/test/test-execute/exec-specifier.service +++ b/test/test-execute/exec-specifier.service @@ -27,5 +27,5 @@ ExecStart=test %h = /root ExecStart=sh -c 'test %s = /bin/sh' ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)' ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')' -ExecStart=sh -c 'test %H = $$(hostname)' +ExecStart=sh -c 'test %H = $$(uname -n)' ExecStart=sh -c 'test %v = $$(uname -r)' diff --git a/test/test-execute/exec-specifier@.service b/test/test-execute/exec-specifier@.service index a388926846a..faecbf37bc5 100644 --- a/test/test-execute/exec-specifier@.service +++ b/test/test-execute/exec-specifier@.service @@ -25,5 +25,5 @@ ExecStart=test %h = /root ExecStart=sh -c 'test %s = /bin/sh' ExecStart=sh -c 'test %m = $$(cat /etc/machine-id)' ExecStart=sh -c 'test %b = $$(cat /proc/sys/kernel/random/boot_id | sed -e 's/-//g')' -ExecStart=sh -c 'test %H = $$(hostname)' +ExecStart=sh -c 'test %H = $$(uname -n)' ExecStart=sh -c 'test %v = $$(uname -r)'