]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
7 years agocorrect spelling mistake 144/head
Edward Betts [Fri, 1 Sep 2017 18:37:06 +0000 (19:37 +0100)] 
correct spelling mistake

8 years agoChange debian default mirror to deb.debian.org (#141)
kBite [Tue, 22 Aug 2017 18:05:42 +0000 (20:05 +0200)] 
Change debian default mirror to deb.debian.org (#141)

httpredir.debian.org is discontinued since 2017-02-17; see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=817155

8 years agoAdded optional hostname assignment (#105)
Alexey Slaykovsky [Thu, 10 Aug 2017 09:51:43 +0000 (11:51 +0200)] 
Added optional hostname assignment (#105)

8 years agoAllow specifying mirror in mkosi.default (#126)
Felipe Sateler [Fri, 21 Jul 2017 12:03:10 +0000 (08:03 -0400)] 
Allow specifying mirror in mkosi.default (#126)

8 years agoEnsure machine name is unique (#127)
Felipe Sateler [Fri, 21 Jul 2017 08:33:57 +0000 (04:33 -0400)] 
Ensure machine name is unique (#127)

Even though we don't register the machine, systemd-nspawn creates a
scope based on the name. Therefore, make sure the name is unique to
prevent collisions.

See https://github.com/systemd/systemd/issues/6347

8 years agoMerge pull request #123 from lucasdemarchi/pr-gitclone
Lennart Poettering [Thu, 20 Jul 2017 14:34:07 +0000 (16:34 +0200)] 
Merge pull request #123 from lucasdemarchi/pr-gitclone

Use git clone

8 years agorework copy_git_files() to use a git clone 123/head
Lucas De Marchi [Tue, 18 Jul 2017 20:25:22 +0000 (13:25 -0700)] 
rework copy_git_files() to use a git clone

Using a git clone allows to solve some problems:
    - It allows to copy git submodules without having to fallback to
      --use-git-files=no since git-ls-files doesn't recurse submodules
    - It allows build systems that rely on git describe or similar to
      tag the build: this is more important when projects use
      git modules and they want to tag the git revision of each
      submodule.
    - It uses less disk space when using output as directory since
      when passing a local directory git will use hard links

Some additional handling for files that were modified (or added with
git -A) was put in place to allow tests to be performed before
committing.

In addition the call to git ls-files was fixed in the following cases:
    - When mkosi is called with -C option: it was calling ls-files inside
      the caller directory, not inside the src dir.
    - When mkosi is called with --git-files=others and .gitignore
      doesn't contain an entry for '.mkosi-*': it would try to copy the
      temporary directory we created and fail

8 years agolet umount commands be handled by mount_cache
Lucas De Marchi [Tue, 18 Jul 2017 20:23:07 +0000 (13:23 -0700)] 
let umount commands be handled by mount_cache

mount_cache() is already handling the umount of cache directories
so it's not necessary to do it in mount_image().

8 years agouse git when build-sources dir is on git repository
Lucas De Marchi [Tue, 18 Jul 2017 06:55:17 +0000 (23:55 -0700)] 
use git when build-sources dir is on git repository

8 years ago#120 - Support basic TAB completion for command-line arguments (#121)
Dmitry Telegin [Mon, 17 Jul 2017 19:08:14 +0000 (22:08 +0300)] 
#120 - Support basic TAB completion for command-line arguments (#121)

8 years agomkosi: support reusing builddirs between subsequent mkosi runs (#114)
Lennart Poettering [Mon, 17 Jul 2017 15:26:04 +0000 (17:26 +0200)] 
mkosi: support reusing builddirs between subsequent mkosi runs (#114)

With this change, mkosi will look for "mkosi.builddir" when invoked.
When this directory exists it is mounted into the build container and
may be used as location for out-of-tree builds, which can be shared
between multiple invocations to speed up the building process.

This is particularly useful when used in conjunction with incremental
building (-i), as with this in place building OS images using mkosi is
only a little slower than just building the project natively on the host
now.

"mkosi clean -f" will empty the builddir if it exists now too, in
addition to the incremental image trees.

8 years agoREADME: Update the distribution information (#118)
Neal Gompa (ニール・ゴンパ) [Mon, 17 Jul 2017 12:24:22 +0000 (08:24 -0400)] 
README: Update the distribution information (#118)

The README is slightly out of date on the distribution information.

Parts of it didn't acknowledge that openSUSE support has been added,
and now Mageia is also supported (which wasn't there at all).

8 years agoMageia Linux support (#112)
Dmitry Telegin [Mon, 17 Jul 2017 07:48:57 +0000 (10:48 +0300)] 
Mageia Linux support (#112)

Add Mageia Linux support

8 years agoIgnore temporary directories while copying (#115)
Lucas De Marchi [Sat, 15 Jul 2017 11:51:23 +0000 (04:51 -0700)] 
Ignore temporary directories while copying (#115)

If we call mkosi passing --build-sources with a directory that contains
the temporary .mkosi-* directories, it will fall in a inifinite
recursion.

This is the case in which we are have the mkosi.* files in a
subdirectory of the git repository and pass the git root dir as argument
to --build-sources.

8 years agodon't patch nsswitch if resolve is already present (#98)
Дамјан Георгиевски [Fri, 30 Jun 2017 15:26:09 +0000 (17:26 +0200)] 
don't patch nsswitch if resolve is already present (#98)

The default nsswitch in ArchLinux (and probably other distros in future)
already has:

    hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname

so don't rewrite `dns` with `resolve` as it then becomes:

    hosts: files mymachines resolve [!UNAVAIL=return] resolve myhostname

Fixes #97.

8 years agoMerge pull request #100 from Conan-Kudo/zyppfedora
Lucas Werkmeister [Thu, 29 Jun 2017 08:26:22 +0000 (10:26 +0200)] 
Merge pull request #100 from Conan-Kudo/zyppfedora

Adjust note about Fedora and package manager tools

8 years agoAdjust note about Fedora and package manager tools 100/head
Neal Gompa [Wed, 28 Jun 2017 22:31:08 +0000 (23:31 +0100)] 
Adjust note about Fedora and package manager tools

Since Fedora 26, all four tools are available in Fedora, as Zypper
was added for Fedora 26.

8 years agoupdate README a bit
Lennart Poettering [Wed, 28 Jun 2017 15:55:30 +0000 (17:55 +0200)] 
update README a bit

8 years agobump version numbers for v3 v3
Lennart Poettering [Wed, 28 Jun 2017 07:47:27 +0000 (09:47 +0200)] 
bump version numbers for v3

8 years agoadd simple release script
Lennart Poettering [Wed, 28 Jun 2017 07:46:38 +0000 (09:46 +0200)] 
add simple release script

This will patch the version numbers into the python scripts, add them to
git, and tag them.

8 years agoOptionally ignore all untracked files in git ls-files (#94) v2
Zbigniew Jędrzejewski-Szmek [Thu, 22 Jun 2017 15:58:02 +0000 (11:58 -0400)] 
Optionally ignore all untracked files in git ls-files (#94)

It is very easy for a large file to end up in the built image. Either
the package cache, or some other already built image, or the new
*.cache-* files are large enough to overflow the available space in
the destination image.

Some people (me ;)) find it convenient to just use the list of files
that git knows about ('git ls-files --cached') and ignore anything
else (git can be taught about the existence of new not-yet-staged
files with 'git add -N'). Then build products or images or cache files
can be safely present in the build directory, and there's no need to
craft --exclude patterns for them.

--git-files=others is the default and preserves previous behaviour.
--git-files=cached uses all committed or staged files as found in
the working directory.

It would be an interesting option to use an actual committed tree
instead of files in the working directory, but it would require a
significant changes, because files would have to be extracted directly
from the git cache. It's an interesting future direction.

I made 'git-files' a new option instead of adding a new value to
'use-git-files' because it seems better to keep the detection of
whether git ls-files should be used orthogonal to what files are
included.

Also drop the .mkosi-* excludes, because those particular files are
most likely mkosi configuration, and there's no need to exclude them.
The package cache is called mkosi.cache by default, and mkosi build
products and image caches don't match this pattern either.

8 years agomkosi: properly copy symlinks again (#95)
Lennart Poettering [Thu, 22 Jun 2017 15:49:21 +0000 (17:49 +0200)] 
mkosi: properly copy symlinks again (#95)

We really shouldn't follow symlinks when we copy stuff. Otherwise we
can't build casync, because it contains a number of dangling symlinks in
its test-files/ directory.

8 years agoMerge pull request #85 from poettering/incremental
Zbigniew Jędrzejewski-Szmek [Thu, 22 Jun 2017 13:30:22 +0000 (09:30 -0400)] 
Merge pull request #85 from poettering/incremental

Support for incremental image building.

8 years agomkosi: add concept of "incremental" builds 85/head
Lennart Poettering [Wed, 21 Jun 2017 12:44:51 +0000 (14:44 +0200)] 
mkosi: add concept of "incremental" builds

Incremental builds permit caching the build and final images right after
OS package installation — before the source or build tree is copied in.
This is useful to drastically reduce the runtime of mkosi image building.

If you have a source tree, you may now type in:

       # mkosi -if -t raw_gpt -o output.raw

This will build an image possibly making use of a pre-existing
"output.raw.cache-pre-dev" and "output.raw.cache-pre-inst" image files
to speed up the build. If the files exist, they are used under the
assumption they contain a pre-generated version of the disk images in
the state immediately before copying in the source tree or build tree.
(-i is short for --incremental). If the files don't exist, they are
generated, and thus available for speeding up subsequent runs. The
".cache-pre-dev" file contains the image for the development build of
the image, the ".cache-pre-inst" file contains the image for the final
build of the image.

If "mkosi -iff" is run (i.e. with two --force parameters) any
pre-existing cache image is removed before the operation is run. In this
mode the cache images are hence generated from scratch, and never used.

If --incremental is not specified behaviour is identical to the status
quo ante.

Note that there currently is no logic in place to only rebuild the image
automatically in full if the mkosi.defaults file is newer than the cache
files, this may be added in a later commit.

To remove the cache files without rebuilding, use "mkosi clean -f".

Note that this kind of "incremental" caching is orthogonal to the
already existing "package" caching on the package manager level. The
former caches the result of a the initial package manager run, while the
latter only caches individual packages before the package manager is
run. The latter is particular useful as it permits optimizing the build
time of the usual double image generation of mkosi (i.e. when a
development build is done followed by a final build).

Note that the caching works very differently for the output modes for
raw disk images and those for directory trees. In the former case we'll
cache the actual raw disk image after all partition setup and basic
directory tree setup. In the latter case we'll store the image directory
tree as directory. Note that the "raw_squashfs" is treated like a
directory mode in this regard, since squashfs compression is applied
much later than the point in time we create the cache version of the
image.

8 years agoluks: fix return value of luks_setup_root()
Lennart Poettering [Thu, 18 May 2017 19:10:29 +0000 (21:10 +0200)] 
luks: fix return value of luks_setup_root()

8 years agofix breakage when making directory format in current directory (#89)
Chris Morin [Wed, 21 Jun 2017 10:20:20 +0000 (06:20 -0400)] 
fix breakage when making directory format in current directory (#89)

Making an osi of type "directory" when using the default path (the
current working directory) causes the build step to fail. This occurs
because mkosi attempts to copy the .mkosi-* directory into itself and
causes an infinite recursion.

This also resolve an issue where directories that don't contain any
tracked files are copied to the build directory (e.g. the .git
directory).

8 years agoRemove tautological tests (#92)
Lénaïc Huard [Wed, 21 Jun 2017 10:18:39 +0000 (12:18 +0200)] 
Remove tautological tests (#92)

8 years agomkosi: rewrite bootable tests (#93)
AsciiWolf [Wed, 21 Jun 2017 10:18:07 +0000 (12:18 +0200)] 
mkosi: rewrite bootable tests (#93)

8 years agoDo not duplicate btrfs metadata (#91)
Lénaïc Huard [Thu, 15 Jun 2017 08:01:57 +0000 (10:01 +0200)] 
Do not duplicate btrfs metadata (#91)

By default `mkfs.btrfs` uses the `dup` profile for metadata of non-SSD
single device btrfs filesystem.
This duplication is not desired for VM drives. So, let’s use the `single`
profile instead.

8 years agoAdd package cache handling for Arch distribution (#90)
Lénaïc Huard [Thu, 15 Jun 2017 07:59:58 +0000 (09:59 +0200)] 
Add package cache handling for Arch distribution (#90)

8 years agorequire python 3.5 as minimum version (#86)
Lennart Poettering [Wed, 24 May 2017 12:17:07 +0000 (14:17 +0200)] 
require python 3.5 as minimum version (#86)

Fixes: #79
8 years agomkosi: fix bootable raw_btrfs Debian image (#87)
AsciiWolf [Mon, 22 May 2017 09:12:40 +0000 (11:12 +0200)] 
mkosi: fix bootable raw_btrfs Debian image (#87)

8 years agomkosi: strip man-db from arch-linux package list (#81)
David Herrmann [Thu, 11 May 2017 15:00:54 +0000 (17:00 +0200)] 
mkosi: strip man-db from arch-linux package list (#81)

The man-db hooks might trigger on boot and regenerate the database, taking up to several minutes. There is no need to trigger this in a minimal image, so strip `man-db` from the arch-linux package list. While at it, let's remove the man-pages as well, since there is little need for those either.

8 years agoREADME: remove erroneous <<EOF (#78)
v1.0.0.batts [Thu, 13 Apr 2017 16:21:23 +0000 (12:21 -0400)] 
README: remove erroneous <<EOF (#78)

8 years agoFix typo that breaks postinst script loading from default file (#77)
Lucas Werkmeister [Wed, 12 Apr 2017 21:51:45 +0000 (23:51 +0200)] 
Fix typo that breaks postinst script loading from default file (#77)

8 years agomkosi: support mirror option in openSUSE builds (#73)
Lucas Werkmeister [Thu, 30 Mar 2017 08:43:17 +0000 (10:43 +0200)] 
mkosi: support mirror option in openSUSE builds (#73)

Fixes #72.

8 years agoUse `--merged-usr` for `debootstrap` to fix #74 75/head
Elias Probst [Sat, 25 Mar 2017 15:35:07 +0000 (16:35 +0100)] 
Use `--merged-usr` for `debootstrap` to fix #74

8 years agomkosi: add missing openSUSE package cache umount (#70)
AsciiWolf [Thu, 16 Mar 2017 00:30:40 +0000 (01:30 +0100)] 
mkosi: add missing openSUSE package cache umount (#70)

8 years agomkosi: use https for openSUSE repo urls (#71)
AsciiWolf [Thu, 16 Mar 2017 00:29:38 +0000 (01:29 +0100)] 
mkosi: use https for openSUSE repo urls (#71)

8 years agoREADME: add zypper to wrapped tools (#69)
Lucas Werkmeister [Wed, 1 Mar 2017 19:27:48 +0000 (20:27 +0100)] 
README: add zypper to wrapped tools (#69)

I forgot to mention this in #66.

8 years agoAdd option to run scripts with network access (#65)
Lucas Werkmeister [Wed, 1 Mar 2017 19:19:52 +0000 (20:19 +0100)] 
Add option to run scripts with network access (#65)

8 years agoreset_machine_id: ask for forgiveness, not permission (#67)
Felipe Sateler [Wed, 1 Mar 2017 17:16:45 +0000 (14:16 -0300)] 
reset_machine_id: ask for forgiveness, not permission (#67)

Avoid TOCTOU by always deleting and handling the FileNotFoundError

8 years agoAdd support for openSUSE distros (#66)
Franck Bui [Tue, 28 Feb 2017 16:28:30 +0000 (17:28 +0100)] 
Add support for openSUSE distros (#66)

8 years agoMerge pull request #64 from systemd/options
Zbigniew Jędrzejewski-Szmek [Sun, 26 Feb 2017 23:59:39 +0000 (18:59 -0500)] 
Merge pull request #64 from systemd/options

Two fixes to option parsing.

8 years agoFix default file parsing of store_true options 64/head
Lucas Werkmeister [Sun, 26 Feb 2017 23:02:19 +0000 (00:02 +0100)] 
Fix default file parsing of store_true options

With action='store_true', argparse adds a default value of False if the
option isn’t specified, so it could never be None.

8 years agoFix default file parsing of three options
Lucas Werkmeister [Sun, 26 Feb 2017 23:00:41 +0000 (00:00 +0100)] 
Fix default file parsing of three options

The default file should only be used if an option is not specified on
the command line, but instead, it was only used if the option *was*
specified (overriding the specified value).

8 years agoMerge pull request #63 from fsateler/kernel-cmdline
Lucas Werkmeister [Sun, 26 Feb 2017 18:30:20 +0000 (19:30 +0100)] 
Merge pull request #63 from fsateler/kernel-cmdline

Allow setting kernel command line in the configuration file

8 years agoMerge pull request #62 from fsateler/reset-machine-id
Lucas Werkmeister [Sun, 26 Feb 2017 18:30:11 +0000 (19:30 +0100)] 
Merge pull request #62 from fsateler/reset-machine-id

Fixes to reset_machine_id

8 years agoAllow setting kernel command line in the configuration file 63/head
Felipe Sateler [Sun, 26 Feb 2017 14:00:02 +0000 (11:00 -0300)] 
Allow setting kernel command line in the configuration file

8 years agoAlso nuke the dbus machine id 62/head
Felipe Sateler [Sun, 26 Feb 2017 16:10:36 +0000 (13:10 -0300)] 
Also nuke the dbus machine id

Otherwise the machine-id will not really be a new one

8 years agoReset machine-id right before making root read-only
Felipe Sateler [Sun, 26 Feb 2017 13:59:21 +0000 (10:59 -0300)] 
Reset machine-id right before making root read-only

kernel-install, which is used to install the bootloader, requires that
the machine-id is set. Since the build or postinst scripts might want
it too, move it to the end.

8 years agoMerge pull request #60 from docent-net/master
Lennart Poettering [Thu, 23 Feb 2017 15:18:50 +0000 (16:18 +0100)] 
Merge pull request #60 from docent-net/master

mkosi: documentation fix for systemd-nspawn invocation

8 years agomkosi: documentation fix for systemd-nspawn invocation 60/head
Maciej Lasyk [Thu, 23 Feb 2017 14:49:32 +0000 (15:49 +0100)] 
mkosi: documentation fix for systemd-nspawn invocation

Missing '-D' parameter for directory name

8 years agoMerge pull request #55 from poettering/directory-fixes
Lucas Werkmeister [Tue, 21 Feb 2017 20:36:00 +0000 (21:36 +0100)] 
Merge pull request #55 from poettering/directory-fixes

fixes to make -t directory work again

8 years agomkosi: properly remove root tree and /var/tmp between first and second build 55/head
Lennart Poettering [Thu, 22 Dec 2016 15:26:02 +0000 (16:26 +0100)] 
mkosi: properly remove root tree and /var/tmp between first and second build

Let's make sure to remove both the old OS tree and its /var/tmp file
after the first build finished and we ran the build script inside of it,
but before we start the next iteration.

This fixes "-t directory" builds.

8 years agomkosi: create /root and /root/dest in the right access mode
Lennart Poettering [Thu, 22 Dec 2016 15:25:37 +0000 (16:25 +0100)] 
mkosi: create /root and /root/dest in the right access mode

8 years agomkosi: mount package cache only as long as we need to
Lennart Poettering [Thu, 22 Dec 2016 15:24:31 +0000 (16:24 +0100)] 
mkosi: mount package cache only as long as we need to

That way it doesn't interfere with us removing the intermediary build
tree if development builds are selected.

8 years agomkosi: don't mount LUKS if directory/subvolume/tar mode is selected
Lennart Poettering [Thu, 22 Dec 2016 15:24:12 +0000 (16:24 +0100)] 
mkosi: don't mount LUKS if directory/subvolume/tar mode is selected

8 years agoMerge pull request #54 from poettering/sha256sums
Lucas Werkmeister [Wed, 21 Dec 2016 20:50:27 +0000 (21:50 +0100)] 
Merge pull request #54 from poettering/sha256sums

mkosi: rename SHA256SUM → SHA256SUMS

8 years agomkosi: rename SHA256SUM → SHA256SUMS 54/head
Lennart Poettering [Wed, 21 Dec 2016 09:50:37 +0000 (10:50 +0100)] 
mkosi: rename SHA256SUM → SHA256SUMS

This was an unfortunate typo I unfortunately didn't notice earlier. The
file was really supposed to be created as SHA256SUMS rather than
SHA256SUM, in order to follow Ubuntu's naming of the checksums of OS
images.  Moreover systemd's importd tool will actually look for
SHA256SUMS rather than SHA256SUM.

Hence, let's rename this now, even if this is to some level a compat
break. But as nobody noticed this earlier I figure people didn't care so
far.

8 years agoMerge pull request #53 from poettering/secureboot
Lucas Werkmeister [Wed, 21 Dec 2016 08:56:17 +0000 (09:56 +0100)] 
Merge pull request #53 from poettering/secureboot

basic UEFI SecureBoot setup

8 years agomkosi: also bind mount /var/tmp for the build script 53/head
Lennart Poettering [Wed, 21 Dec 2016 00:16:39 +0000 (01:16 +0100)] 
mkosi: also bind mount /var/tmp for the build script

This is a follow-up for efa2f8593f0adf1009a9b221b51fb2b5203ac81c, and
also ensures /var/tmp is writable during the main build script
invocation (in addition to the already patched "workspace" invocations).

8 years agomkosi: add PostInstallationScript= mkosi.default option
Lennart Poettering [Tue, 20 Dec 2016 14:21:32 +0000 (15:21 +0100)] 
mkosi: add PostInstallationScript= mkosi.default option

This configuration file counterpart to the --postinst-script= command
line switch was forgotten when the concept was added.

8 years agomkosi: optionally sign resulting kernel images with "sbsign" for UEFI SecureBoot
Lennart Poettering [Tue, 20 Dec 2016 14:20:17 +0000 (15:20 +0100)] 
mkosi: optionally sign resulting kernel images with "sbsign" for UEFI SecureBoot

Maybe one day we can also support using "pesign" for this, but for now
"sbsign" is much simpler to use, and fits neatly into mkosi's design as
we can simply invoke it with key material loaded from mkosi.* key
material in the working directory.

8 years agoMerge pull request #51 from poettering/flags
Lucas Werkmeister [Mon, 19 Dec 2016 17:19:14 +0000 (18:19 +0100)] 
Merge pull request #51 from poettering/flags

generate unified kernel+initrd images that include the root hash as last step of the build + other improvements

8 years agomkosi: update TODO 51/head
Lennart Poettering [Fri, 16 Dec 2016 20:26:35 +0000 (21:26 +0100)] 
mkosi: update TODO

8 years agomkosi: show kernel command line in summary
Lennart Poettering [Mon, 19 Dec 2016 16:17:31 +0000 (17:17 +0100)] 
mkosi: show kernel command line in summary

This also moves the "Bootable" information away from the "Partitions"
section, and into the "Output" section, as "Bootable" is hardly a
specific type of partition, but more general information about the
output.

8 years agomkosi: generate a unified UEFI kernel+initrd binary as last step of the build
Lennart Poettering [Fri, 16 Dec 2016 19:55:03 +0000 (20:55 +0100)] 
mkosi: generate a unified UEFI kernel+initrd binary as last step of the build

On verity-enabled builds we want to embedd the root hash of the root
file system in the kernel command line, and want to package the kernel,
the initrd, a kernel command line as a single EFI executable that later
may be signed.

This adds an aditional step to the build process: after the verity data
has been generated, invoke "dracut --uefi" in the image to generate the
unified image, and place it in /EFI/Linux in the ESP. sd-boot already
knows how to deal with these single-file boot items, hence this is
sufficient to make a boot image appear in its menu.

This also disables ESP kernel installation during the usual RPM process,
as we aren't interested in the images generated that way.

This patch makes the necessary changes for all of this only for Fedora.
Other distributions using dracut should be able to make the similar
logic work, but that's left for a later commit.

(the roothash= related bits in this PR will only be honoured by systemd
at boot-time with https://github.com/systemd/systemd/pull/4879 in place)

8 years agomkosi: tweak the default fedora package list in some conditions
Lennart Poettering [Fri, 16 Dec 2016 19:52:35 +0000 (20:52 +0100)] 
mkosi: tweak the default fedora package list in some conditions

When we generate a bootable ext4 image, include the e2fsck in the image. Similar for btrfs. This way we can properly fsck all devices during boot.

The Arch Linux code already had a similar tweak, let's copy that.

Also, install "cryptsetup" if encryption is requested. Strictly speaking
nothing will call the tool, however Dracut uses it has condition when to
pack DM rules into the initrd. Hence let's add it for now, even though
we can eventually drop this, when Dracut gets fixed.

8 years agomkosi: mount /var/tmp outside of the image while building
Lennart Poettering [Fri, 16 Dec 2016 19:50:02 +0000 (20:50 +0100)] 
mkosi: mount /var/tmp outside of the image while building

This way during a --read-only build (i.e. where the root directory is
read-only while the build script runs) temporary files in /var/tmp still
work.

8 years agomkosi: fix parsing of sfdisk --dump output if partition names contain ":"
Lennart Poettering [Fri, 16 Dec 2016 16:31:33 +0000 (17:31 +0100)] 
mkosi: fix parsing of sfdisk --dump output if partition names contain ":"

8 years agomkosi: set GPT read-only flags properly
Lennart Poettering [Fri, 16 Dec 2016 16:29:35 +0000 (17:29 +0100)] 
mkosi: set GPT read-only flags properly

This makes sure the --read-only setting has an effect on the GPT
read-only flags of the root partition.

Note that we generate the sfdisk lines in a format that works around an
sfdisk bug with older version: we place the partition name last in each
line, as we need to enclose it in "", but the sfdisk parser is confused
by it otherwise. (See: https://github.com/karelzak/util-linux/issues/380)

8 years agoMerge pull request #50 from systemd/improvements
Lennart Poettering [Thu, 15 Dec 2016 17:21:52 +0000 (18:21 +0100)] 
Merge pull request #50 from systemd/improvements

Some small improvements

8 years agoExtract die() function to print message and exit 50/head
Lucas Werkmeister [Thu, 15 Dec 2016 17:01:43 +0000 (18:01 +0100)] 
Extract die() function to print message and exit

It also takes an additional, optional argument for a custom exit status,
though none of the current call sites use it.

8 years agoAdd missing line break
Lucas Werkmeister [Thu, 15 Dec 2016 16:57:34 +0000 (17:57 +0100)] 
Add missing line break

8 years agoFix spelling of Arch Linux (two words)
Lucas Werkmeister [Thu, 15 Dec 2016 16:56:20 +0000 (17:56 +0100)] 
Fix spelling of Arch Linux (two words)

8 years agoadded basic luks support (#49)
Lennart Poettering [Thu, 15 Dec 2016 12:13:41 +0000 (13:13 +0100)] 
added basic luks support (#49)

8 years agoMerge pull request #46 from poettering/postinst
Lucas Werkmeister [Tue, 13 Dec 2016 17:05:42 +0000 (18:05 +0100)] 
Merge pull request #46 from poettering/postinst

mkosi: add support for running postinst scripts and other fixes

8 years agomkosi: shorten umount commands a bit 46/head
Lennart Poettering [Fri, 9 Dec 2016 16:27:31 +0000 (17:27 +0100)] 
mkosi: shorten umount commands a bit

8 years agomkosi: optionally run a post-installation script
Lennart Poettering [Fri, 9 Dec 2016 14:41:07 +0000 (15:41 +0100)] 
mkosi: optionally run a post-installation script

This adds an additional scripting hook to the build script. We look for
"mkosi.postinst". If it exists the script will be run as last step of the
each build. The script will be passed one parameter: either "build" or
"final", depending if it is invoked on the first iteration of the image
creation (the "build phase") or the second iteration (the "final
phase").

8 years agomkosi: drop a spurious newline
Lennart Poettering [Fri, 9 Dec 2016 14:40:38 +0000 (15:40 +0100)] 
mkosi: drop a spurious newline

8 years agomkosi: mount /proc, /dev, /sys only for "dnf"
Lennart Poettering [Fri, 9 Dec 2016 14:36:49 +0000 (15:36 +0100)] 
mkosi: mount /proc, /dev, /sys only for "dnf"

There's no point in running it for any of the other commands, and as it
conflicts with using nspawn on the directory as is let's just mount them
for the shortest possible time.

8 years agomkosi: always use /efi for the boot loader logic
Lennart Poettering [Fri, 9 Dec 2016 11:55:16 +0000 (12:55 +0100)] 
mkosi: always use /efi for the boot loader logic

This way the GPT auto-discovery logic in nspawn and the initrd can work,
and we leave /boot for compatibility symlinks.

8 years agomkosi: pass the same uuid to all nspawn invocations
Lennart Poettering [Fri, 9 Dec 2016 11:52:47 +0000 (12:52 +0100)] 
mkosi: pass the same uuid to all nspawn invocations

This is useful so that tools that need one have always the same. This is
particularly useful for dracut which uses the machine ID for creating
directories in the ESP.

8 years agomkosi: fix passing of the --image= parameter to nspawn
Lennart Poettering [Fri, 9 Dec 2016 11:51:52 +0000 (12:51 +0100)] 
mkosi: fix passing of the --image= parameter to nspawn

8 years agomkosi: let's remove if checks from build_image() a bit
Lennart Poettering [Fri, 9 Dec 2016 11:41:58 +0000 (12:41 +0100)] 
mkosi: let's remove if checks from build_image() a bit

Let's move most remaining if conditions into the functions we are about
to call. This way the flow of control of build_image() is easier to
follow as the exceptions are hidden and the common flow of control
emphasised.

8 years agoMerge pull request #48 from keszybz/fixes
Lucas Werkmeister [Sun, 11 Dec 2016 16:03:15 +0000 (17:03 +0100)] 
Merge pull request #48 from keszybz/fixes

Two unrelated fixes

8 years agomkosi: fix overriding of boolean arguments 48/head
Zbigniew Jędrzejewski-Szmek [Sun, 11 Dec 2016 03:46:42 +0000 (22:46 -0500)] 
mkosi: fix overriding of boolean arguments

The command line should have higher priority then the configuration file,
but this wouldn't work when the config file said yes and command line no.

8 years agomkosi: create cache in world-readable mode
Zbigniew Jędrzejewski-Szmek [Sun, 11 Dec 2016 03:10:45 +0000 (22:10 -0500)] 
mkosi: create cache in world-readable mode

There's really nothing to hide here, and installation might fail
if the cache is not readable:
W: Can't drop privileges for downloading as file '/var/cache/apt/archives/partial/libexpat1_2.2.0-1_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

8 years agoMerge pull request #45 from keszybz/complete-step-cm
Lennart Poettering [Fri, 9 Dec 2016 11:05:02 +0000 (12:05 +0100)] 
Merge pull request #45 from keszybz/complete-step-cm

Add a context manager / decorator to wrap stuff with print_step pairs

8 years agomkosi: increase buffer size when hashing files 45/head
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2016 15:16:21 +0000 (10:16 -0500)] 
mkosi: increase buffer size when hashing files

We need to do some buffering here, because the files we are hashing can be gigabytes
in size, but Python loops are slow, so it's better to use a larger buffer.

8 years agomkosi: use a single read/write call pair to copy nspawn settings
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2016 15:06:42 +0000 (10:06 -0500)] 
mkosi: use a single read/write call pair to copy nspawn settings

With Python, a loop is usually slower than using native calls. nspawn settings
files are not too large, so just copy then in one fell swoop.

8 years agogitignore: add .roothash
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2016 14:56:53 +0000 (09:56 -0500)] 
gitignore: add .roothash

8 years agomkosi: extend complete_step with customizable end message
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2016 14:56:17 +0000 (09:56 -0500)] 
mkosi: extend complete_step with customizable end message

A context manager cannot see any values from the block directly, so
a mutable object (list) is used to pass the state to format the final message.
This isn't entirely elegant, but I think it is worth it, because it allows
the opening and closing messages to be specified next to one another and makes
things a bit more concise and consistent.

8 years agomkosi: remove unnecessary str and int casts
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2016 01:54:19 +0000 (20:54 -0500)] 
mkosi: remove unnecessary str and int casts

// returns an integer, format converts to str automatically.

8 years agomkosi: add context manager / decorator for print_step pairs
Zbigniew Jędrzejewski-Szmek [Thu, 8 Dec 2016 01:31:40 +0000 (20:31 -0500)] 
mkosi: add context manager / decorator for print_step pairs

8 years agomkosi: automatically reset /etc/machine-id to the empty file 39/head
Lennart Poettering [Wed, 7 Dec 2016 11:59:36 +0000 (12:59 +0100)] 
mkosi: automatically reset /etc/machine-id to the empty file

8 years agomkosi: remove debug output of build script command line
Lennart Poettering [Wed, 7 Dec 2016 11:49:35 +0000 (12:49 +0100)] 
mkosi: remove debug output of build script command line

This was accidentally added in bfc0738632a79f4261601d61af18866bb38fe35a,
and really shouldn't be there.

8 years agomkosi: set bit 60 of the GPT partition flags if the root disk shall be read-only
Lennart Poettering [Wed, 7 Dec 2016 11:48:16 +0000 (12:48 +0100)] 
mkosi: set bit 60 of the GPT partition flags if the root disk shall be read-only

the systemd dissector looks for this, hence set it.

8 years agomkosi: add support writing out verity partitions
Lennart Poettering [Wed, 7 Dec 2016 11:43:08 +0000 (12:43 +0100)] 
mkosi: add support writing out verity partitions

This adds a new switch --verity. When passed the root partition will be
complemented by a dm-verity partition, and the root hash is written to a
<image>.roothash file, as well as printed to the status output.

If this mode is enabled the partition UUID of the root partition is
changed to the first 128bit of the top-level hash, and the partition
UUID of the verity partition is changed to the second (and final) 128bit
of the top-level hash (assuming sha256 is used as hash algorithm, which
is the default). This means the two partitions can be easily determined
from the specification of the roothash alone. Since both the root
partition and the verity partition in this case are read-only and the
roothash describes both it's a good candidate for using as partition
UUID.

The partition type UUID of the verity partition is initialized to a new
set of UUIDs that match the existing per-architecture root partition
type UUIDs, that I generated randomly.