]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
7 years agoMinor prettification 196/head
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 09:42:15 +0000 (10:42 +0100)] 
Minor prettification

7 years agoDrop redundant args to open()
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 09:25:04 +0000 (10:25 +0100)] 
Drop redundant args to open()

UTF-8 and text read mode are the default.

7 years agoDowngrade fatal permissions error to warning
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 09:11:44 +0000 (10:11 +0100)] 
Downgrade fatal permissions error to warning

There are various circumstances in which it is OK to have permissions
mask which goes above 0o700:
- when the user has own group
- when the file is shared with others using a special group
- when doing QA and the password should be set but is not secret
- when the access is limited through other means

So let's not be too strict here.

Also, let's use plain octal mask instead of the stat.S_* macros. This
is way more legible! This is inspired by a recent comment from Linus
Torvalds:
https://github.com/torvalds/linux/commit/277642dcca765a1955d4c753a5a315ff7f2eb09d.
In Python we have the advantage that we have an unambigous notation
for octal numbers, so let's just use them.

7 years agoAdd warn() helper similar to die()
Zbigniew Jędrzejewski-Szmek [Tue, 14 Nov 2017 09:10:19 +0000 (10:10 +0100)] 
Add warn() helper similar to die()

7 years agoFix breakage when generating image without bmap (#195)
Lucas De Marchi [Tue, 14 Nov 2017 08:36:59 +0000 (00:36 -0800)] 
Fix breakage when generating image without bmap (#195)

When generating an image without bmap it was failing with:

       ‣ Creating BMAP file...
        Traceback (most recent call last):
          File "/usr/bin/mkosi", line 3304, in <module>
            main()
          File "/usr/bin/mkosi", line 3297, in main
            build_stuff(args)
          File "/usr/bin/mkosi", line 3231, in build_stuff
            bmap = calculate_bmap(args, raw)
          File "/usr/bin/mkosi", line 1995, in calculate_bmap
            dir=os.path.dirname(args.output_bmap))
        AttributeError: 'Namespace' object has no attribute 'output_bmap'

Fix it by doing the same as we do in other functions, checking if
bmap is actually enabled.

7 years agoAdd support to bmap-tools (#190)
Lucas De Marchi [Sun, 12 Nov 2017 21:47:59 +0000 (13:47 -0800)] 
Add support to bmap-tools (#190)

bmap-tools (https://github.com/intel/bmap-tools) allows us to write
images to physical disks like USB drives without having to write the
entire image. It rather writes only the used blocks.  With this we
reduce the time to write to a disk when we manually set the size of the
partitions.

7 years agoMerge pull request #188 from NeilW/master
Lennart Poettering [Wed, 8 Nov 2017 16:46:45 +0000 (17:46 +0100)] 
Merge pull request #188 from NeilW/master

Fix ubuntu builds

7 years agoUpdate default to current Ubuntu release (#191)
bit [Wed, 8 Nov 2017 16:45:29 +0000 (16:45 +0000)] 
Update default to current Ubuntu release (#191)

7 years agoMerge pull request #183 from keszybz/copy-tree
Lennart Poettering [Wed, 8 Nov 2017 16:43:04 +0000 (17:43 +0100)] 
Merge pull request #183 from keszybz/copy-tree

Copy tree

7 years agomkosi: update default ubuntu distribution 188/head
Neil Wilson [Fri, 3 Nov 2017 11:15:31 +0000 (11:15 +0000)] 
mkosi: update default ubuntu distribution

Update default to a currently supported version

7 years agomkosi: use Host resolver config with Host network
Neil Wilson [Fri, 3 Nov 2017 11:11:34 +0000 (11:11 +0000)] 
mkosi: use Host resolver config with Host network

If we're running a sub-command in the Host network namespace
use the resolver from the Host namespace to avoid name resolution
errors.

Bind as read-only so we get errors if anything tries to update it
while we're using the Host network.

Fixes #185

7 years agoAdd an internal tree copy implementation 183/head
Zbigniew Jędrzejewski-Szmek [Fri, 27 Oct 2017 15:26:10 +0000 (17:26 +0200)] 
Add an internal tree copy implementation

The general idea is to copy everything, preserving access mode, times,
xattrs on files. An attempt to create the new object is first made,
followed by an unlink and a repeated attempt. This optimizes for the
case where the output tree is empty, which seems to be the common
thing in our case.

Reflink is attempted for normal files.

Symlinks are not adjusted: if they pointed outside of the tree being
copied, they might be dangling now.

Block and character device nodes and any other special files are not
copied.

7 years agoAdd mkdir_last helper
Zbigniew Jędrzejewski-Szmek [Sun, 29 Oct 2017 16:11:08 +0000 (17:11 +0100)] 
Add mkdir_last helper

7 years agofedora: install F27 by default
Zbigniew Jędrzejewski-Szmek [Mon, 30 Oct 2017 08:20:46 +0000 (09:20 +0100)] 
fedora: install F27 by default

It'll become stable in a week or two.

7 years agomkosi: create builddir if configured but missing (#181)
Lennart Poettering [Thu, 26 Oct 2017 19:51:22 +0000 (21:51 +0200)] 
mkosi: create builddir if configured but missing (#181)

If a builddir is explicitly configured but missing, automatically create
it.

This follows the logic already implemented for mkosi.output/ and
mkosi.cache/.

This is particularly useful when storing mkosi settings in a git repo,
as git normally doesn't allow us to store empty directories, and hence
we cannot make use of auto-discovery of mkosi.output/ and mkosi.cache/.
By configuring these paths explicitly in mkosi.default however, we can
work around this, as in that case we'll create the directories if
needed.

7 years agoMerge pull request #165 from poettering/output-dir
Zbigniew Jędrzejewski-Szmek [Wed, 25 Oct 2017 14:00:50 +0000 (16:00 +0200)] 
Merge pull request #165 from poettering/output-dir

mkosi.output/ directory support

7 years agoREADME: document mkosi.output/ and why and how to use it 165/head
Lennart Poettering [Tue, 10 Oct 2017 16:35:26 +0000 (18:35 +0200)] 
README: document mkosi.output/ and why and how to use it

7 years agomkosi: exclude all cache and output directories from the copied build sources
Lennart Poettering [Tue, 10 Oct 2017 16:34:04 +0000 (18:34 +0200)] 
mkosi: exclude all cache and output directories from the copied build sources

We should exclude mkosi.builddir/, mkosi.output/, mkosi.cache/ when
preparing the build image, as they aren't really part of the sources,
but contain artifacts of previous mkosi invocations.

7 years agomkosi: add "mkosi.output/" directory concept
Lennart Poettering [Tue, 10 Oct 2017 16:33:14 +0000 (18:33 +0200)] 
mkosi: add "mkosi.output/" directory concept

This adds support for an "mkosi.output/" directory where all built
artifacts are places by default.

See discussion around #151.

7 years agoExtract require_private_file function (#175)
Lucas Werkmeister [Sun, 15 Oct 2017 11:52:00 +0000 (13:52 +0200)] 
Extract require_private_file function (#175)

The code for mkosi.rootpw was clearly copied from mkosi.passphrase, so
let’s just extract it into a function shared between the two.

7 years agoMerge pull request #173 from fbuihuu/opensuse-use-http
Lucas Werkmeister [Thu, 12 Oct 2017 21:36:01 +0000 (23:36 +0200)] 
Merge pull request #173 from fbuihuu/opensuse-use-http

openSUSE: don't use https to access mirrors for now

7 years agoMerge pull request #122 from poettering/boot-verb
Lucas Werkmeister [Thu, 12 Oct 2017 20:39:24 +0000 (22:39 +0200)] 
Merge pull request #122 from poettering/boot-verb

Some assorted additions, including new "mkosi shell" and "mkosi boot" commands

7 years agoopenSUSE: don't use https to access mirrors for the time being 173/head
Franck Bui [Thu, 12 Oct 2017 15:08:11 +0000 (17:08 +0200)] 
openSUSE: don't use https to access mirrors for the time being

Some openSUSE mirrors redirect https to http and this seems to make
curl(1) unhappy now.

There's a request to fix that on mirror side:
https://github.com/openSUSE/mirrorbrain/issues/3 but for the time
being switch to http to access all mirrors.

There seems to be no additional values in https:// as the rpms are
signed by gpg keys already, so is the repodata anyways.

Fixes: #137
Fixes: #159
7 years agoMerge pull request #168 from UbiCastTeam/167-fix-vmlinuz-detection
Lucas Werkmeister [Thu, 12 Oct 2017 09:42:06 +0000 (11:42 +0200)] 
Merge pull request #168 from UbiCastTeam/167-fix-vmlinuz-detection

fix unreliable vmlinuz file detection

7 years agoMerge pull request #170 from UbiCastTeam/fix-crash-arch-nopackages
Lucas Werkmeister [Thu, 12 Oct 2017 09:40:33 +0000 (11:40 +0200)] 
Merge pull request #170 from UbiCastTeam/fix-crash-arch-nopackages

Fix building base Arch image if no additional package was requested

7 years agofix building base Arch image if no additional package was requested 170/head
Florent Thiéry [Wed, 11 Oct 2017 15:48:57 +0000 (17:48 +0200)] 
fix building base Arch image if no additional package was requested

7 years agofix detecting vmlinuz file which was unreliably detected due to improper use of lstri... 168/head
Florent Thiéry [Wed, 11 Oct 2017 08:28:55 +0000 (10:28 +0200)] 
fix detecting vmlinuz file which was unreliably detected due to improper use of lstrip, refs #167

7 years agosupport other arch support kernels if specified in package list (only keep base kerne...
Florent Thiery [Tue, 10 Oct 2017 16:47:46 +0000 (18:47 +0200)] 
support other arch support kernels if specified in package list (only keep base kernel if explicitly requested by the user in the packages) (#158)

7 years agoREADME: on debian, the ubuntu keyring is named ubuntu-archive-keyring (#164)
Felipe Sateler [Tue, 10 Oct 2017 13:45:49 +0000 (10:45 -0300)] 
README: on debian, the ubuntu keyring is named ubuntu-archive-keyring (#164)

7 years agoREADME: document the debian/ubuntu keyring situation explicitly (#163)
Lennart Poettering [Tue, 10 Oct 2017 13:07:35 +0000 (15:07 +0200)] 
README: document the debian/ubuntu keyring situation explicitly (#163)

I figure the mkosi distro packages should add both deps explicitly to
avoid any confusion.

Fixes: #139
7 years agoMerge pull request #161 from poettering/rootpw
Lennart Poettering [Tue, 10 Oct 2017 08:43:26 +0000 (10:43 +0200)] 
Merge pull request #161 from poettering/rootpw

add support for reading the root password to use from "mkosi.rootpw"

7 years agomkosi: minor prettification 161/head
Lennart Poettering [Fri, 6 Oct 2017 18:08:06 +0000 (20:08 +0200)] 
mkosi: minor prettification

There's no need to append an empty string if we have to conditionalize
things anyway.

7 years agomkosi: read root pw to set from "mkosi.rootpw"
Lennart Poettering [Fri, 6 Oct 2017 18:04:43 +0000 (20:04 +0200)] 
mkosi: read root pw to set from "mkosi.rootpw"

Let's add a way to store the root pw in a separate file, outside of
mkosi.default. That way it's easy for people to build images locally of
an upstream project without having to modify the mkosi.default file,
simply by dropping their own file.

7 years agomkosi: unbreak the squashfs mode, when used together with build trees (#160)
Lennart Poettering [Tue, 10 Oct 2017 08:33:25 +0000 (10:33 +0200)] 
mkosi: unbreak the squashfs mode, when used together with build trees (#160)

We need to create the mount point for the build tree early on, so that
it is included in the read-only squashfs image, and we can mount the
host's builddir into it.

Without this patch squashfs builds with builddir usage fail.

7 years agomkosi: drop redundant \n in die()
Lennart Poettering [Fri, 6 Oct 2017 18:01:10 +0000 (20:01 +0200)] 
mkosi: drop redundant \n in die()

7 years agomkosi: don't show root password on screen
Lennart Poettering [Fri, 6 Oct 2017 18:00:28 +0000 (20:00 +0200)] 
mkosi: don't show root password on screen

It's probably not a good idea to show passwords on screen needlessly.
Hence let's just show whether one is set, instead of its actual
contents.

7 years agoDo not setup systemd-networkd and systemd-resolved if networkmanager is in the packag...
Florent Thiery [Fri, 6 Oct 2017 18:12:18 +0000 (20:12 +0200)] 
Do not setup systemd-networkd and systemd-resolved if networkmanager is in the packages list on Arch, fixes #153 (#154)

7 years agoSupport package cache on arch despite have no Release defined (#148)
Florent Thiery [Fri, 6 Oct 2017 17:42:27 +0000 (19:42 +0200)] 
Support package cache on arch despite have no Release defined (#148)

Support package cache on arch (or it crashes when trying to use a package cache), fixes #146

7 years agoMerge pull request #134 from DanielG/fix-tree-copy
Lennart Poettering [Fri, 6 Oct 2017 17:39:29 +0000 (19:39 +0200)] 
Merge pull request #134 from DanielG/fix-tree-copy

Use 'cp' instead of python shutil to copy tees

7 years agomkosi: add new switch --without-tests/-T for running the build script without running... 122/head
Lennart Poettering [Mon, 17 Jul 2017 17:10:29 +0000 (19:10 +0200)] 
mkosi: add new switch --without-tests/-T for running the build script without running tests

This new option simply controls the $WITH_TESTS environment variable
(which defaults to 1), that is supposed to be honoured by the build
script the same way as $WITH_DOCS is honoured. If set to 0 the build script
should avoid unit running tests during the build process.

This is useful for speeding up the build process, in particular when
combining this with incremental mode, as it brings build-times for mkosi
much closer to build-times on the host, when developing software.

Note that this new switch changes exactly nothing in the way mkosi puts
together image, it only controls the value of $WITH_TESTS, and it is
exclusively up to the build script to honour this or not.

My new favourite command is now:

        # mkosi -ifT shell

This command will build a new image, avoid running tests and quickly
give me a shell in it.

7 years agomkosi: avoid running "dracut" needlessly during the first (development) image building
Lennart Poettering [Mon, 17 Jul 2017 17:05:04 +0000 (19:05 +0200)] 
mkosi: avoid running "dracut" needlessly during the first (development) image building

We won't boot up the development system via qemu anyway, hence let's
avoid making it bootable, given that Dracut is awfully slow.

7 years agomkosi: make package cache path absolute too
Lennart Poettering [Mon, 17 Jul 2017 16:16:24 +0000 (18:16 +0200)] 
mkosi: make package cache path absolute too

all other paths (such as the builddir or build script path) we make
absolute, but we forgot the package cache path. Fix that.

7 years agomkosi: also clear out the package cache on "mkosi -ff clean"
Lennart Poettering [Mon, 17 Jul 2017 16:15:32 +0000 (18:15 +0200)] 
mkosi: also clear out the package cache on "mkosi -ff clean"

We already clear out the build dir and the incremental images, hence
let's clean out the package cache too, in order to avoid surprises and
confusion, but do so only if the use specifies at least two "--force"
parameters on "mkosi clean" or three on "mkosi build"

7 years agomkosi: add two new verbs "boot" and "shell"
Lennart Poettering [Mon, 17 Jul 2017 15:59:49 +0000 (17:59 +0200)] 
mkosi: add two new verbs "boot" and "shell"

Both verbs are very similar: they build the image similar to "mkosi
build" (except if it exists already) and then invoke "systemd-nspawn"
interactively on the output image. "boot" will pass "--boot" to nspawn,
while "shell" doesn't.

The command may be combined with "-f" as usual, to force a rebuild
before invoking nspawn on the result.

With this in place getting to a test shell from a current git checkout
of a project like systemd is as easy as typing "mkosi shell".

In a later PR we should really add a "mkosi vm" command or so, which
permits booting up the image in qemu properly finding UEFI and kvm
support for it, and so on.

7 years agomkosi: add support for doing CentOS images (#119)
Lennart Poettering [Fri, 6 Oct 2017 17:22:57 +0000 (19:22 +0200)] 
mkosi: add support for doing CentOS images (#119)

This is very similar to Fedora/Mageia support, but uses yum rather than
dnf, as CentOS doesn't have that by default.

7 years agoimprove doc about config file syntax, fixes #149 (#150)
Florent Thiery [Thu, 21 Sep 2017 15:49:35 +0000 (17:49 +0200)] 
improve doc about config file syntax, fixes #149 (#150)

7 years agoMerge pull request #144 from EdwardBetts/spelling
Lucas Werkmeister [Sat, 2 Sep 2017 11:03:20 +0000 (13:03 +0200)] 
Merge pull request #144 from EdwardBetts/spelling

Correct spelling mistake

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 agoIgnore '*.cache-pre-{dev,inst} when copying build sources without git 134/head
Daniel Gröber [Wed, 2 Aug 2017 10:51:48 +0000 (12:51 +0200)] 
Ignore '*.cache-pre-{dev,inst} when copying build sources without git

8 years agoUse 'cp' instead of python shutil to copy tees
Daniel Gröber [Tue, 1 Aug 2017 14:06:06 +0000 (16:06 +0200)] 
Use 'cp' instead of python shutil to copy tees

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.