]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
7 years agomkosi: use pxz instead of xz if it's installed 238/head
Lennart Poettering [Mon, 12 Feb 2018 12:59:55 +0000 (13:59 +0100)] 
mkosi: use pxz instead of xz if it's installed

Fixes: #227
7 years agoMerge pull request #231 from randomvariable/xfs_support
Lennart Poettering [Mon, 12 Feb 2018 12:20:09 +0000 (13:20 +0100)] 
Merge pull request #231 from randomvariable/xfs_support

Add XFS root support

7 years agomkosi: Add XFS root support 231/head
Naadir Jeewa [Sun, 11 Feb 2018 15:51:59 +0000 (15:51 +0000)] 
mkosi: Add XFS root support

Root size is 1300Mib in this case because of additional metadata

Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk>
7 years agomkosi: Rename raw_gpt output format to raw_ext4
Naadir Jeewa [Sun, 11 Feb 2018 15:51:34 +0000 (15:51 +0000)] 
mkosi: Rename raw_gpt output format to raw_ext4

Removes confusion when adding support for additional filesystems.
raw_gpt is still supported as an output format

Signed-off-by: Naadir Jeewa <naadir@randomvariable.co.uk>
7 years agoMerge pull request #234 from keszybz/check-architecture-lazily
Lucas Werkmeister [Sun, 11 Feb 2018 14:08:41 +0000 (15:08 +0100)] 
Merge pull request #234 from keszybz/check-architecture-lazily

Check architecture lazily

7 years agoMerge pull request #223 from gdiscry/fix/install_arch
Zbigniew Jędrzejewski-Szmek [Sat, 10 Feb 2018 18:02:56 +0000 (19:02 +0100)] 
Merge pull request #223 from gdiscry/fix/install_arch

Improve the Arch Linux installation

7 years agoCheck architecture lazily 234/head
Zbigniew Jędrzejewski-Szmek [Sat, 10 Feb 2018 17:24:52 +0000 (18:24 +0100)] 
Check architecture lazily

Before this patch, mkosi wouldn't even run --help on a platform that
wasn't amd64 or arm64. That's unnecessarily harsh, a lot of functionality
is platform-independent and will work anywhere.

7 years agofix release name detection on Debian hosts (#224)
hfcg-hcf [Sat, 10 Feb 2018 15:48:07 +0000 (15:48 +0000)] 
fix release name detection on Debian hosts (#224)

7 years agoarch: better package selection 223/head
Georges Discry [Tue, 23 Jan 2018 23:52:41 +0000 (00:52 +0100)] 
arch: better package selection

The package selection for Arch Linux is not optimal, especially when the
image is not bootable. The main issue is that a kernel is still
installed when the image is not bootable.

Optional packages from the `base` group that are required under specific
configurations are first deleted from the package selection and
explicitly re-added when required. For example, the `cryptsetup` and
`device-mapper` packages are included only if the image is bootable and
encrypted.  Similarly, a kernel is included only if the image is
bootable or if the user selected one explicitly.

Sets are now better used in the package selection. The appropriate
operators and methods are directly used instead of relying on
intermediary sets.

The installation of the packages is split into two operations. The first
only installs the packages from the `base` group and the second installs
the packages selected by the user. This is necessary because some
packages (e.g. `git`) have an install script that depends on the `base`
group without listing those in their dependencies. If they are installed
before their implicit dependency, their install script will most likely
fail.

7 years agoarch: always use the custom pacman.conf
Georges Discry [Wed, 18 Oct 2017 01:00:18 +0000 (03:00 +0200)] 
arch: always use the custom pacman.conf

The custom pacman.conf is completed to contain a full explicit
configuration based on the `root` directory inside the workspace.

All the calls to pacman (and related commands) use that configuration
and never touch the host system. Particularly, the host keyring and sync
databases are left untouched.

7 years agobump version numbers for v4 v4
Lennart Poettering [Fri, 9 Feb 2018 19:33:25 +0000 (20:33 +0100)] 
bump version numbers for v4

7 years agoMerge pull request #232 from lucasdemarchi/pr-ls-files
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 15:57:53 +0000 (16:57 +0100)] 
Merge pull request #232 from lucasdemarchi/pr-ls-files

Fix and improve copying git files

7 years agoSupport copying git submodule files 232/head
Lucas De Marchi [Thu, 8 Feb 2018 00:23:30 +0000 (16:23 -0800)] 
Support copying git submodule files

Besides getting the files from the git directory, iterate through each
submodules to copy them over to the build image as well. We had some
(better) alternative, but each of them failing to provide what we need:

    - Recent versions for git-ls-files learned a --recurse-submodules
      but they are not support together with --others

    - git-submodule foreach --recursive would allow us to git-ls-files
      inside each submodule, however there's no easy way to control from
      which submodule the command is printing the files in order to
      prepend the submodule path

So for now we live with getting the list of submodules from
`git submodule status --recursive` and calling git-ls-files on each of
them.

7 years agoFix copy of symlinks
Lucas De Marchi [Wed, 7 Feb 2018 23:07:54 +0000 (15:07 -0800)] 
Fix copy of symlinks

When copying files we should not be following the symlinks. This became
a problem in kmod after removing the git-clone method to copy files
because we have intentionally broken symlinks there:

  File "/usr/bin/mkosi", line 170, in open_close
      fd = os.open(path, flags | os.O_CLOEXEC, mode)
      FileNotFoundError: [Errno 2] No such file or directory:
      '/home/lucas/p/kmod/testsuite/rootfs-pristine/test-loaded/sys/module/btusb/drivers/usb:btusb'
      make: *** [Makefile:3009: mkosi] Error 1

Although it's worse when the symlink is broken, it would silently succeed when
it's not but producing an invalid output.

7 years agoStop using git-clone to copy files
Lucas De Marchi [Wed, 7 Feb 2018 21:57:41 +0000 (13:57 -0800)] 
Stop using git-clone to copy files

This partially reverts "0c8d7d5 (rework copy_git_files() to use a git
clone)", retaining the fixes to ls-files. Using git clone allowed build
systems to get commit information through git and work with submodules,
but it didn't come without drawbacks like modifying the mtime and
permissions of the copied files. The drawbacks means that the build
cache doesn't really work as intended.

For git-submodules another solution will be provided later.

7 years agoMerge pull request #229 from cmarcelo/extra-search-paths
Lennart Poettering [Wed, 7 Feb 2018 09:51:40 +0000 (10:51 +0100)] 
Merge pull request #229 from cmarcelo/extra-search-paths

Add "ExtraSearchPaths=" and --extra-search-paths

7 years agoMerge pull request #230 from poettering/hostname-kernel-install-fixes
Lennart Poettering [Wed, 7 Feb 2018 09:30:02 +0000 (10:30 +0100)] 
Merge pull request #230 from poettering/hostname-kernel-install-fixes

hostname setting fixes, and fixes to make kernel-install masking/unmasking work

7 years agoAdd "ExtraSearchPaths=" and --extra-search-paths 229/head
Caio Marcelo de Oliveira Filho [Wed, 31 Jan 2018 22:33:29 +0000 (14:33 -0800)] 
Add "ExtraSearchPaths=" and --extra-search-paths

This variable keeps a colon-delimited list of paths to be prepended to
PATH in the context of mkosi execution. Unlike shell variable
expansion, if any path refers to an unset variable, that path will be
ignored.

Besides the environment variables, the variable SUDO_HOME can be used
to refer to the home directory of the user calling mkosi with
sudo. This allows settings like

    ExtraSearchPaths=$SUDO_HOME/go/bin

7 years agoGeneralize PackageAction to ListAction
Caio Marcelo de Oliveira Filho [Tue, 6 Feb 2018 19:29:52 +0000 (11:29 -0800)] 
Generalize PackageAction to ListAction

Use delimiter as parameter. ListAction with a different delimiter will
be used later for colon delimited lists.

Opted to make a CommaDelimitedListAction instead of making "," the
default delimiter so that the lines adding arguments will be more
explicitly about what kind of list they are using.

7 years agomkosi: rework how we reenable kernel-install snippets 230/head
Lennart Poettering [Tue, 6 Feb 2018 19:01:09 +0000 (20:01 +0100)] 
mkosi: rework how we reenable kernel-install snippets

The old code doesn't really work: we can't store the list of snippets we
masked in a global variable, since we run the whole build process
multiple times and data from the first run might confuse follow-up runs
and really should not.

This reworks the logic so that we keep track precisely which snippets
are masked and return this from disable_kernel_install(). We then pass
that back into reenable_kernel_install() to undo the effect later on.
This way the information never leaks into later runs.

7 years agomkosi: rework how we set the hostname
Lennart Poettering [Tue, 6 Feb 2018 18:59:36 +0000 (19:59 +0100)] 
mkosi: rework how we set the hostname

Let's make the funciton more like the other install_xyz() functions.
Let's invoke it from the same place.

Also, most importantly: let's unconditionally remove /etc/hostname
first, so that either what the user configured takes effect or the file
doesn't exist at all, so that systemd's internal default hostname logic
can take place. This is also the better choice in case /etc/hostname is
a symlink.

7 years agoMerge pull request #226 from cmarcelo/clearlinux
Lennart Poettering [Wed, 31 Jan 2018 19:35:52 +0000 (20:35 +0100)] 
Merge pull request #226 from cmarcelo/clearlinux

Clear Linux support

7 years agoAdd Clear Linux support 226/head
Caio Marcelo de Oliveira Filho [Thu, 25 Jan 2018 01:31:09 +0000 (17:31 -0800)] 
Add Clear Linux support

7 years agoPass loopdev to install_boot_loader
Caio Marcelo de Oliveira Filho [Thu, 25 Jan 2018 01:27:31 +0000 (17:27 -0800)] 
Pass loopdev to install_boot_loader

It will be used later to allow clr-boot-manager interact with the loop
device of the image to query about UUID and related parameters.

7 years agoDon't fail deleting non-existent /etc/machine-id
Caio Marcelo de Oliveira Filho [Thu, 25 Jan 2018 01:24:10 +0000 (17:24 -0800)] 
Don't fail deleting non-existent /etc/machine-id

When resetting machine-id and it doesn't exist, don't fail, just
proceed to create a new one. The basic filesystem of Clear Linux we
will be using for bootstrap doesn't have a /etc/machine-id
out-of-the-box.

7 years agoAllow passing params to nspawn in run_workspace_command
Caio Marcelo de Oliveira Filho [Thu, 25 Jan 2018 01:23:30 +0000 (17:23 -0800)] 
Allow passing params to nspawn in run_workspace_command

This will be used when executing the install bootloader for Clear
Linux, to let it access /dev (via a bind) and allow it read the loop
devices.

7 years ago[mkosi] Imports reordered (#225)
Batuhan Osman Taşkaya [Wed, 31 Jan 2018 18:02:57 +0000 (21:02 +0300)] 
[mkosi] Imports reordered (#225)

- Files: mk-osi
- Changes: Imports reordered with pep8 importing rules

7 years agoMerge pull request #228 from cmarcelo/firmware-location-in-clear
Lucas De Marchi [Wed, 31 Jan 2018 17:49:24 +0000 (09:49 -0800)] 
Merge pull request #228 from cmarcelo/firmware-location-in-clear

Add qemu firmware location in Clear Linux

7 years agoAdd qemu firmware location in Clear Linux 228/head
Caio Marcelo de Oliveira Filho [Thu, 25 Jan 2018 01:29:12 +0000 (17:29 -0800)] 
Add qemu firmware location in Clear Linux

Make sure mkosi find OVMF_CODE.fd when running on Clear Linux.

7 years agoMerge pull request #213 from L3n41c/arch_networkd
Lucas De Marchi [Fri, 19 Jan 2018 18:08:16 +0000 (10:08 -0800)] 
Merge pull request #213 from L3n41c/arch_networkd

Stop patching nsswitch.conf and make resolv.conf points to stub-resolv.conf on Arch Linux

7 years agoFix Arch Linux boot when the root FS is encrypted (#217)
Lénaïc Huard [Mon, 15 Jan 2018 13:44:31 +0000 (14:44 +0100)] 
Fix Arch Linux boot when the root FS is encrypted (#217)

When the root FS is encrypted, mkinitcpio needs to be instructed to put in
the initrd what is needed to open the LUKS volume.

https://wiki.archlinux.org/index.php/mkinitcpio#Common_hooks

7 years agoAdd the path where the UEFI firmware blob stands on Arch Linux
Lénaïc Huard [Sun, 7 Jan 2018 23:15:19 +0000 (00:15 +0100)] 
Add the path where the UEFI firmware blob stands on Arch Linux

as shipped with the `ovmf` package.

7 years agoUse an UTF-8 locale on Arch Linux (#214)
Lénaïc Huard [Mon, 8 Jan 2018 08:37:34 +0000 (09:37 +0100)] 
Use an UTF-8 locale on Arch Linux (#214)

Commit 0dc40f40 introduced the generation of an UTF-8 locale at build time.
This commit makes it used.

For example, before this commit, we still had:
```
[root@archlinux ~]# systemctl status
* archlinux
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Sun 2018-01-07 22:13:47 CET; 32min ago
   CGroup: /
           |-user.slice
           | `-user-0.slice
           |   |-session-c1.scope
           |   | |-125 login -- root
```
whereas with this commit, we now have a prettier printed:
```
[root@archlinux ~]# systemctl status
● archlinux
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Sun 2018-01-07 22:13:47 CET; 33min ago
   CGroup: /
           ├─user.slice
           │ └─user-0.slice
           │   ├─session-c1.scope
           │   │ ├─125 login -- root
```

7 years agoStop patching nsswitch.conf and make resolv.conf points to stub-resolv.conf on Arch... 213/head
Lénaïc Huard [Sun, 7 Jan 2018 21:27:51 +0000 (22:27 +0100)] 
Stop patching nsswitch.conf and make resolv.conf points to stub-resolv.conf on Arch Linux

The `nsswitch.conf` file that comes by default on Arch Linux is now fully systemd-resolved compatible.
Its `hosts:` line is now:
```
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
```
So, there is no need to patch this file when enabling systemd-resolved on Arch Linux anymore.

Also make `/etc/resolv.conf` points to the new dynamic `/run/systemd/resolve/stub-resolv.conf` rather than the older static `/usr/lib/systemd/resolv.conf`.

7 years agoMerge pull request #206 from poettering/incremental-reflink
Lucas Werkmeister [Fri, 5 Jan 2018 23:24:04 +0000 (00:24 +0100)] 
Merge pull request #206 from poettering/incremental-reflink

mkosi: make -i mode snappier on reflink-capable file systems

7 years agoRe-enable kernel install scripts (#211)
Lucas De Marchi [Fri, 5 Jan 2018 19:12:35 +0000 (11:12 -0800)] 
Re-enable kernel install scripts (#211)

After doing the distro installation we'd better re-enable the install
scripts from the distro so we can continue to support scripts that
install kernels following the Bootloader Spec (even though we prefer
a unified image here).

7 years agoMerge pull request #192 from lucasdemarchi/pr-skeleton
Lennart Poettering [Fri, 5 Jan 2018 19:11:36 +0000 (20:11 +0100)] 
Merge pull request #192 from lucasdemarchi/pr-skeleton

Add support to skeleton trees

7 years agomkosi: make -i mode snappier on reflink-capable file systems 206/head
Lennart Poettering [Wed, 29 Nov 2017 11:20:24 +0000 (12:20 +0100)] 
mkosi: make -i mode snappier on reflink-capable file systems

Let's start out with a reflink copy, even if we don't actually want CoW
for disk images ultimately.

7 years agomkosi: rename _copy_file() → copy_fd()
Lennart Poettering [Fri, 5 Jan 2018 19:00:16 +0000 (20:00 +0100)] 
mkosi: rename _copy_file() → copy_fd()

We have so many similarly named functions, let's clarify that this one
is about fds.

7 years agoAdd tar archive support for extra and skeleton trees 192/head
Lucas De Marchi [Thu, 4 Jan 2018 22:45:34 +0000 (14:45 -0800)] 
Add tar archive support for extra and skeleton trees

Like documentation here says, it allows one to preseve file ownership
when adding files to the final image. This may be particularly useful if
you are adding configuration files for a daemon that is not supposed to
run as root, but as a pre-defined user.

7 years agoOnly add mkosi.{extra,skeleton} if they are directories
Lucas De Marchi [Thu, 4 Jan 2018 22:29:08 +0000 (14:29 -0800)] 
Only add mkosi.{extra,skeleton} if they are directories

This follows the documentation more closely.

7 years agoSimplify assignments by using empty lists as default
Lucas De Marchi [Thu, 4 Jan 2018 22:23:40 +0000 (14:23 -0800)] 
Simplify assignments by using empty lists as default

Make argparse use empty lists as default rather than None
for arguments that receive lists. This allows us to simplify all the
conditional assign or extend throught the code.

This is done for packages, build_packages, extra_trees and
skeleton_trees, removing the conditional assignments and leaving only
a call to extend() that can handle the case the list is empty. Also
checks for `if X is None` need to be converted to `if not X`.

7 years agoAdd support to skeleton trees
Lucas De Marchi [Wed, 8 Nov 2017 16:09:32 +0000 (08:09 -0800)] 
Add support to skeleton trees

It's already possible to pass extra trees to copy over the final tree
after installing all packages. However in some cases it is desirable to
copy the tree before installing packages or running anything in the
image.  One of the cases is if we want to enable additional repositories
for the package manager or want to configure it in a particular way.

Now mkosi can use a mkosi.skeleton directory (or by passing a
--skeleton-tree argument) in the same way it currently supports extra
trees, however copying them before running the "install_distro" phase.

To allow changing the package manager configuration distros may need
more tweaks to point the package manager to the right files. Right now
this has been tested with Fedora 27 by adding
`mkosi.skeleton/etc/yum.repos.d/rpmfusion-free.repo` and installing a
package from that repo.

7 years agoAdd 'References' section to README (#209)
Adam Hunt [Tue, 12 Dec 2017 13:41:47 +0000 (05:41 -0800)] 
Add 'References' section to README (#209)

Created 'Reference' section including a few links to the README.

7 years agoMerge pull request #205 from keszybz/spdx
Lennart Poettering [Mon, 27 Nov 2017 10:57:05 +0000 (11:57 +0100)] 
Merge pull request #205 from keszybz/spdx

Add SPDX license identifiers

7 years agoAdd SPDX license identifiers 205/head
Zbigniew Jędrzejewski-Szmek [Mon, 27 Nov 2017 07:07:03 +0000 (08:07 +0100)] 
Add SPDX license identifiers

7 years agoChange opensuse zypper pattern to a form that works everywhere (#109)
Sebastian [Mon, 27 Nov 2017 07:04:49 +0000 (08:04 +0100)] 
Change opensuse zypper pattern to a form that works everywhere (#109)

[zj: The pattern "lost visibility" at some point. This is fixed in tumbleweed, but
not in some other versions, so let's use the form that works everywhere for now.

See https://bugzilla.opensuse.org/show_bug.cgi?id=1049997.]

7 years agoMerge pull request #201 from keszybz/copystat
Lennart Poettering [Fri, 17 Nov 2017 17:50:26 +0000 (18:50 +0100)] 
Merge pull request #201 from keszybz/copystat

Use shutil.copystat in more places and other cleanups

7 years agoApply shutil.copystat in more places 201/head
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 16:25:37 +0000 (17:25 +0100)] 
Apply shutil.copystat in more places

7 years agoUse universal_newlines instead of explicit decodes
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 16:16:30 +0000 (17:16 +0100)] 
Use universal_newlines instead of explicit decodes

It's not shorter, but feels cleaner.

7 years agoImport run/PIPE/DEVNULL names from subprocess
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 16:13:07 +0000 (17:13 +0100)] 
Import run/PIPE/DEVNULL names from subprocess

... instead of using subprocess.run etc. We use those in some many places it makes
sense to economize a bit. It makes the long lines much shorter and more readable.

7 years agoRemove unused import
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 16:02:44 +0000 (17:02 +0100)] 
Remove unused import

7 years agoFix name of variable
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 16:02:38 +0000 (17:02 +0100)] 
Fix name of variable

7 years agomkosi: Recursively delete btrfs subvolumes (#177)
Georges Discry [Fri, 17 Nov 2017 15:52:59 +0000 (16:52 +0100)] 
mkosi: Recursively delete btrfs subvolumes (#177)

`btrfs subvol delete` can only delete a subvolume if it is not read-only
and if it does not contain another subvolume.

`btrfs subvol list -o` prints the subvolumes below a certain path, but
only gives the paths relative to the filesystem mount point for those
subvolumes. To compute the paths of the children, we need the relative
path of the parent subvolume given by `btrfs subvol show`.

Read-only subvolumes also have to be writeable again before being
deleted. We unconditionally unset the readonly property on a subvolume
before deletion.

7 years agoUse host resolver with host network for build script (#193)
Lucas Werkmeister [Fri, 17 Nov 2017 15:50:07 +0000 (16:50 +0100)] 
Use host resolver with host network for build script (#193)

This is essentially a copy of f4ee420a00, but for the build script,
since @juaningan pointed out in a comment in #188 that we need it there
as well.

7 years agoMerge pull request #200 from keszybz/fedora
Lennart Poettering [Fri, 17 Nov 2017 15:26:38 +0000 (16:26 +0100)] 
Merge pull request #200 from keszybz/fedora

Make installing Fedora a bit nicer

7 years agoOutput a nice error message when "--release rawhide" is used 200/head
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 15:08:28 +0000 (16:08 +0100)] 
Output a nice error message when "--release rawhide" is used

7 years agoAdd keys for Fedora 27 and 28
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 14:55:04 +0000 (15:55 +0100)] 
Add keys for Fedora 27 and 28

7 years agoMerge pull request #180 from poettering/qemu
Zbigniew Jędrzejewski-Szmek [Fri, 17 Nov 2017 12:31:20 +0000 (13:31 +0100)] 
Merge pull request #180 from poettering/qemu

add "mkosi qemu" verb

7 years agomkosi: add "qemu" verb 180/head
Lennart Poettering [Wed, 25 Oct 2017 10:40:28 +0000 (12:40 +0200)] 
mkosi: add "qemu" verb

This adds a new "mkosi qemu" verb that is like "mkosi boot" but invokes
things in a QEMU environment.

This tries to find the native qemu implementation, with a couple of
fallbacks if none is found, always opting for KVM acceleration.

This also tries to automatically discover the UEFI firmware blobs. For
now only the location where the files are on Fedora is encoded in the
search path, but this can be updated for other distributions easily
later on.

Fixes: #179
7 years agomkosi: rework "mkosi shell"/"mkosi boot" to use os.execvp()
Lennart Poettering [Fri, 17 Nov 2017 11:22:15 +0000 (12:22 +0100)] 
mkosi: rework "mkosi shell"/"mkosi boot" to use os.execvp()

When invoked this way we are just preparators for the final nspawn
command, hence it makes a lot of sense to simply replace our process
with nspawn, hence don't fork off nspawn, but simply invoke os.execvp().

7 years agodracut: explicitly enable "qemu" dracut module
Lennart Poettering [Wed, 25 Oct 2017 09:39:48 +0000 (11:39 +0200)] 
dracut: explicitly enable "qemu" dracut module

Dracut really should imply that the "qemu" module is used when
"nohostonly" mode is selected (which we select), but it currently does
not, so deal with that.

Fixes: #56
7 years agomkosi: make sure when copying files we unlink existing matching files first (#198)
Lennart Poettering [Thu, 16 Nov 2017 20:11:23 +0000 (21:11 +0100)] 
mkosi: make sure when copying files we unlink existing matching files first (#198)

Previously, if a file already existed before, we'd open it for write and
write the new file into the same file. If the old file was larger than
the new file we'd not truncate it, so that in that case the resulting
file was a combination of the new small file plus the old suffix.

This one confused the hell out of me...

7 years agoMerge pull request #196 from keszybz/allow-loose-permissions
Lennart Poettering [Thu, 16 Nov 2017 18:53:38 +0000 (19:53 +0100)] 
Merge pull request #196 from keszybz/allow-loose-permissions

Allow loose permissions on password file

7 years agorework image cache logic so that it works without the presence of a build script...
Florent Thiery [Tue, 14 Nov 2017 09:56:56 +0000 (10:56 +0100)] 
rework image cache logic so that it works without the presence of a build script (#155)

In that case, pre-dev and dev images are not generated at all anymore, so that cache images are
not generated every time; note that this means that pre-dev and pre-inst images currently need to
be manually removed to be re-generated.

Fixes #143.

I my build-less case i used the mkosi.postinst to perform the actual customizations, and in that case
the image caching was not used and it took way longer. With these patches the postinst is applied to
the mediacoder-image.raw.cache-pre-inst cache image, speeding up the process.

I use the postinst script to create users, enable/disable services, setup locale, install custom prebuilt
packages. Rebuilding the base image is pretty slow, so i think it is still useful to support -i without
caching (ex: for producing distro spins).

[zj: add commit message based on comments in the PR]

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 agomkosi: generate default UTF-8 locale for Arch Linux (#187)
John Lin [Tue, 14 Nov 2017 09:38:05 +0000 (17:38 +0800)] 
mkosi: generate default UTF-8 locale for Arch Linux (#187)

Fixes: #186
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.