diff --git a/.gitignore b/.gitignore index d6f6caca55e..cc7d3aa41ed 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,6 @@ __pycache__/ /mkosi.builddir/ /mkosi.output/ /mkosi.default -mkosi.default.d/* -!mkosi.default.d/10-systemd.conf +# Ignore any mkosi config files with "local" in the name +/mkosi.default.d/*local*.conf /tags diff --git a/docs/HACKING.md b/docs/HACKING.md index 7982be34d08..3131597c222 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -34,13 +34,10 @@ possible, however. In order to simplify testing for cases like this we provide a set of `mkosi` build files directly in the source tree. `mkosi` is a tool for building clean OS images from an upstream distribution in combination with a fresh build of the project in the local working directory. To make use of this, -please acquire `mkosi` from https://github.com/systemd/mkosi first, unless your -distribution has packaged it already and you can get it from there. After the -tool is installed, symlink the settings file for your distribution of choice -from .mkosi/ to mkosi.default in the project root directory (note that the -package manager for this distro needs to be installed on your host system). -After doing that, it is sufficient to type `mkosi` in the systemd project -directory to generate a disk image `image.raw` you can boot either in +please install the `mkosi` package (if not packaged for your distro, it can be +downloaded from https://github.com/systemd/mkosi). `mkosi` will build an image +for the host distro by default. It is sufficient to type `mkosi` in the systemd +project directory to generate a disk image `image.raw` you can boot either in `systemd-nspawn` or in an UEFI-capable VM: ``` diff --git a/mkosi.build b/mkosi.build index 201b1888d5c..e73cf554ca3 100755 --- a/mkosi.build +++ b/mkosi.build @@ -20,7 +20,7 @@ fi # that /usr/bin/ld is a symlink that points to a non-existing file in # /etc/alternative/ in this mode. Let's work around this for now by manually # redirect "ld" to "ld.bfd", i.e. circumventing the /usr/bin/ld symlink. -if [ ! -x /usr/bin/ld -a -x /usr/bin/ld.bfd ] ; then +if [ ! -x /usr/bin/ld ] && [ -x /usr/bin/ld.bfd ]; then mkdir -p "$HOME"/bin ln -s /usr/bin/ld.bfd "$HOME"/bin/ld PATH="$HOME/bin:$PATH" @@ -35,7 +35,7 @@ fi # So let's ensure we're running under UTF-8. # # If our current locale already is UTF-8, then we don't need to do anything: -if [ "$(locale charmap 2> /dev/null)" != "UTF-8" ] ; then +if [ "$(locale charmap 2>/dev/null)" != "UTF-8" ] ; then # Try using C.UTF-8 locale, if available. This locale is not shipped # by upstream glibc, so it's not available in all distros. # (In particular, it's not available in Arch Linux.) @@ -54,9 +54,9 @@ if [ "$(locale charmap 2> /dev/null)" != "UTF-8" ] ; then fi if [ ! -f "$BUILDDIR"/build.ninja ] ; then - sysvinit_path=`realpath /etc/init.d` + sysvinit_path=$(realpath /etc/init.d) - init_path=`realpath /sbin/init 2>/dev/null` + init_path=$(realpath /sbin/init 2>/dev/null) if [ -z "$init_path" ] ; then rootprefix="" else @@ -64,46 +64,10 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then rootprefix=/${rootprefix#/} fi - nobody_user=`id -u -n 65534 2> /dev/null` - if [ "$nobody_user" != "" ] ; then - # Validate that we can translate forth and back - if [ "`id -u $nobody_user`" != 65534 ] ; then - nobody_user="" - fi - fi - if [ "$nobody_user" = "" ] ; then - if id -u nobody 2> /dev/null ; then - # The "nobody" user is defined already for something else, pick the Fedora name - nobody_user=nfsnobody - else - # The "nobody" user name is free, use it - nobody_user=nobody - fi - fi - - nobody_group=`id -g -n 65534 2> /dev/null` - if [ "$nobody_group" != "" ] ; then - # Validate that we can translate forth and back - if [ "`id -g $nobody_group`" != 65534 ] ; then - nobody_group="" - fi - fi - if [ "$nobody_group" = "" ] ; then - if id -u nobody 2> /dev/null ; then - # The "nobody" group is defined already for something else, pick the Fedora name - nobody_group=nfsnobody - else - # The "nobody" group name is free, use it - nobody_group=nobody - fi - fi - meson "$BUILDDIR" \ -D "sysvinit-path=$sysvinit_path" \ -D "rootprefix=$rootprefix" \ -D man=false \ - -D "nobody-user=$nobody_user" \ - -D "nobody-group=$nobody_group" \ -D translations=false \ -D version-tag="${VERSION_TAG}" fi @@ -112,7 +76,7 @@ cd "$BUILDDIR" ninja "$@" if [ "$WITH_TESTS" = 1 ] ; then for id in 1 2 3; do - getent group $id > /dev/null || groupadd -g $id testgroup$id + getent group $id >/dev/null || groupadd -g $id testgroup$id done ninja test @@ -128,7 +92,7 @@ fi mkdir -p "$DESTDIR"/etc -cat > "$DESTDIR"/etc/issue <"$DESTDIR"/etc/issue <