]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
6 years agoFix output dir creation 277/head
Rafael Antognolli [Fri, 20 Jul 2018 20:54:16 +0000 (13:54 -0700)] 
Fix output dir creation

The cache dir is created inside the output dir, so we need to create the
output dir at least before that. Fix the following error:

$ sudo mkosi -d fedora -r 29 -t directory -O bla --default /dev/null

Traceback (most recent call last):
  File "/bin/mkosi", line 3767, in <module>
    main()
  File "/bin/mkosi", line 3757, in main
    build_stuff(args)
  File "/bin/mkosi", line 3573, in build_stuff
    setup_package_cache(args)
  File "/bin/mkosi", line 2412, in setup_package_cache
    d = tempfile.TemporaryDirectory(dir=os.path.dirname(args.output), prefix=".mkosi-")
  File "/usr/lib64/python3.7/tempfile.py", line 788, in __init__
    self.name = mkdtemp(suffix, prefix, dir)
  File "/usr/lib64/python3.7/tempfile.py", line 366, in mkdtemp
    _os.mkdir(file, 0o700)
FileNotFoundError: [Errno 2] No such file or directory: '/home/lucas/p/mkosi/bla/.mkosi-l3oxfchg'

6 years agoFix defaults symlink
Lucas De Marchi [Wed, 31 Oct 2018 23:55:34 +0000 (16:55 -0700)] 
Fix defaults symlink

configs/ got moved to mkosi.files but the symlink was left behind.

6 years agoMerge pull request #276 from poettering/rndseed
Lennart Poettering [Wed, 31 Oct 2018 19:36:15 +0000 (20:36 +0100)] 
Merge pull request #276 from poettering/rndseed

drop random seed in built images, and other fixlets

6 years agomkosi: if/elif simplifications 276/head
Lennart Poettering [Wed, 31 Oct 2018 17:53:14 +0000 (18:53 +0100)] 
mkosi: if/elif simplifications

6 years agomkosi: remove random seed file in images
Lennart Poettering [Wed, 31 Oct 2018 17:48:09 +0000 (18:48 +0100)] 
mkosi: remove random seed file in images

If the random seed is part of the image, then each time it is run would
start with the same pool hence the entropy would be much smaller.

6 years agomkosi: use the usual way to show start/finish of one of the steps for the password...
Lennart Poettering [Wed, 31 Oct 2018 17:39:54 +0000 (18:39 +0100)] 
mkosi: use the usual way to show start/finish of one of the steps for the password setting too

6 years agomkosi: strictly require offline operation from systemctl
Lennart Poettering [Wed, 31 Oct 2018 17:39:06 +0000 (18:39 +0100)] 
mkosi: strictly require offline operation from systemctl

It's very likely systemctl will run in one of the scripts. Let's always
make sure it never even tries to talk to PID, simply as a matter of
robustness.

Fixes: #262
6 years agoMerge pull request #273 from zyga/args-type
Zbigniew Jędrzejewski-Szmek [Thu, 25 Oct 2018 15:18:23 +0000 (17:18 +0200)] 
Merge pull request #273 from zyga/args-type

Begin type-checking parsed command line arguments

6 years agoMerge pull request #264 from lucasdemarchi/tip-arch
Zbigniew Jędrzejewski-Szmek [Thu, 25 Oct 2018 09:55:23 +0000 (11:55 +0200)] 
Merge pull request #264 from lucasdemarchi/tip-arch

Fix archlinux

6 years agoRecursively unmount
Lucas De Marchi [Sat, 6 Oct 2018 01:17:24 +0000 (18:17 -0700)] 
Recursively unmount

We always want to unmount anything left on the root mountpoint. Just
use the --recursive switch from umount.

6 years agoAdd type annotations for esp_partno 273/head
Zygmunt Krynicki [Wed, 24 Oct 2018 11:36:30 +0000 (13:36 +0200)] 
Add type annotations for esp_partno

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
6 years agoAdd type annotations to swap_partno
Zygmunt Krynicki [Wed, 24 Oct 2018 11:35:09 +0000 (13:35 +0200)] 
Add type annotations to swap_partno

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
6 years agoAdd CommandLineArguments type
Zygmunt Krynicki [Wed, 24 Oct 2018 11:33:09 +0000 (13:33 +0200)] 
Add CommandLineArguments type

This patch adds a new type that is the result of parsing command line
arguments via argparse.ArgumentParser.parse_args(). This type will gain
typed attributes that will allow to type check all the functions using
it, gradually, one by one.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
6 years agoMerge pull request #271 from keszybz/fedora-29-update
Lennart Poettering [Wed, 24 Oct 2018 09:58:34 +0000 (11:58 +0200)] 
Merge pull request #271 from keszybz/fedora-29-update

Update Fedora defaults to 29

6 years agofedora: import new keys 271/head
Zbigniew Jędrzejewski-Szmek [Wed, 24 Oct 2018 09:03:27 +0000 (11:03 +0200)] 
fedora: import new keys

This also makes during rawhide installs we'll check with the F30 key.

6 years agofedora: use F29 as default
Zbigniew Jędrzejewski-Szmek [Wed, 24 Oct 2018 09:00:52 +0000 (11:00 +0200)] 
fedora: use F29 as default

6 years agofedora: remove glibc-minimal-langpack from package list
Zbigniew Jędrzejewski-Szmek [Wed, 24 Oct 2018 08:50:14 +0000 (10:50 +0200)] 
fedora: remove glibc-minimal-langpack from package list

It is now included in the list inside mkosi, so no need to repeat it here.

6 years agofedora: add new dir and make mkosi.default just a symlink
Zbigniew Jędrzejewski-Szmek [Wed, 24 Oct 2018 08:52:53 +0000 (10:52 +0200)] 
fedora: add new dir and make mkosi.default just a symlink

Contributors from other distros will probably want to add similar
configs, so it makes sense to "demote" the Fedora config. A new dir is
created to avoid cluttering the root directory with those files.

6 years agoAdd static type annotations
Zygmunt Krynicki [Fri, 19 Oct 2018 13:22:27 +0000 (15:22 +0200)] 
Add static type annotations

This patch adds a lot of type annotations, as compatible with mypy
0.620. The type checking is not perfect as many places use loosely typed
argparse.Namespace and I didn't want to introduce any changes there.

Some errors reported by mypy now show missing None checks but I also
decided not to fix them and make the review more complex. This patch
should only annotate types, nothing else.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
6 years agoMerge pull request #268 from eliasp/ubuntu-bootable-gpt-dracut
Lucas Werkmeister [Fri, 19 Oct 2018 12:31:24 +0000 (14:31 +0200)] 
Merge pull request #268 from eliasp/ubuntu-bootable-gpt-dracut

Make Ubuntu GPT images bootable

6 years agoUbuntu/GPT-Boot: Include dracut bug workaround comment in conf file 268/head
Elias Probst [Thu, 18 Oct 2018 23:14:06 +0000 (01:14 +0200)] 
Ubuntu/GPT-Boot: Include dracut bug workaround comment in conf file

6 years agoUbuntu/GPT-Boot: Make `install_boot_loader_ubuntu()` use the identical function for...
Elias Probst [Thu, 18 Oct 2018 23:07:21 +0000 (01:07 +0200)] 
Ubuntu/GPT-Boot: Make `install_boot_loader_ubuntu()` use the identical function for Debian

6 years agoFedora: install glibc-minimal-langpack
Zbigniew Jędrzejewski-Szmek [Thu, 18 Oct 2018 12:20:37 +0000 (14:20 +0200)] 
Fedora: install glibc-minimal-langpack

By forcing the installation of glibc-minimal-langpack we avoid glibc-all-langpacks
which is quite large. See
https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot.

While at it, configure the locale as C.utf8 so we don't get the
default which is POSIX.

6 years agoUbuntu/GPT-Boot: Remove TODO list item
Elias Probst [Wed, 17 Oct 2018 22:15:37 +0000 (00:15 +0200)] 
Ubuntu/GPT-Boot: Remove TODO list item

6 years agoUbuntu/GPT-Boot: Add workaround for dracut bug wrt crc32 module
Elias Probst [Wed, 17 Oct 2018 22:03:50 +0000 (00:03 +0200)] 
Ubuntu/GPT-Boot: Add workaround for dracut bug wrt crc32 module

6 years agoUbuntu/GPT-Boot: Add + execute bootloader installation for Ubuntu
Elias Probst [Wed, 17 Oct 2018 22:03:17 +0000 (00:03 +0200)] 
Ubuntu/GPT-Boot: Add + execute bootloader installation for Ubuntu

6 years agoUbuntu/GPT-Boot: Correct the Kernel image pkg name on Ubuntu
Elias Probst [Wed, 17 Oct 2018 21:59:30 +0000 (23:59 +0200)] 
Ubuntu/GPT-Boot: Correct the Kernel image pkg name on Ubuntu

6 years agoUbuntu/GPT-Boot: Add `universe` repo for Ubuntu to allow `dracut` installation
Elias Probst [Wed, 17 Oct 2018 15:08:18 +0000 (17:08 +0200)] 
Ubuntu/GPT-Boot: Add `universe` repo for Ubuntu to allow `dracut` installation

6 years agoUbuntu/GPT-Boot: Don't die creating a bootable Ubuntu image
Elias Probst [Wed, 17 Oct 2018 22:00:44 +0000 (00:00 +0200)] 
Ubuntu/GPT-Boot: Don't die creating a bootable Ubuntu image

6 years agoReorganize and expand OVMF firmware locations
Lucas Werkmeister [Mon, 12 Feb 2018 21:40:25 +0000 (22:40 +0100)] 
Reorganize and expand OVMF firmware locations

Add architecture-specific paths before generic ones (they’re more likely
to be correct for the current architecture), and add some paths from the
Arch Linux `ovmf` (“extra” repository) and `edk2-ovmf` (Arch User
Repository) packages.

6 years agomkosi: fix to enable Fedora rawhide support
Chris Patterson [Tue, 13 Feb 2018 16:07:07 +0000 (11:07 -0500)] 
mkosi: fix to enable Fedora rawhide support

The Fedora repos require using the release version of 'rawhide' in the URLs,
while mkosi currently forces you to select a specific version number, e.g. 28.
You can not install Fedora '28', but you can install 'rawhide', using the gpg
keys for release version '28'.

These changes:
(1) Assume the latest (known) version when --release=rawhide, but warn the user
(2) Allow user to override a specific rawhide version with the option
--release=rawhide-<version>

Signed-off-by: Chris Patterson <cjp256@gmail.com>
6 years agoMerge pull request #265 from lucasdemarchi/tip-clear
Zbigniew Jędrzejewski-Szmek [Thu, 11 Oct 2018 06:10:02 +0000 (08:10 +0200)] 
Merge pull request #265 from lucasdemarchi/tip-clear

Allow to run on qemu >= 2.12

6 years agoLog command line run on qemu 265/head
Lucas De Marchi [Mon, 8 Oct 2018 23:07:29 +0000 (16:07 -0700)] 
Log command line run on qemu

This makes it easier to debug and customize what we are running when
calling qemu. And example customization might be:

sudo mkosi --default mkosi.fedora qemu \
    -drive if=pflash,format=raw,file=myvars.fd

6 years agoubuntu: fix docs removal
Asbjørn Apeland [Wed, 10 Oct 2018 07:30:30 +0000 (09:30 +0200)] 
ubuntu: fix docs removal

systemd-nspawn fails to spawn `rm`
systemd-nspawn succeeds to spawn `/bin/rm`

6 years agoAllow to run qemu >= 2.12
Lucas De Marchi [Mon, 8 Oct 2018 23:01:57 +0000 (16:01 -0700)] 
Allow to run qemu >= 2.12

While trying to call "mkosi qemu" on a Clear Linux host it reported

    qemu: could not load PC BIOS '/usr/share/qemu/OVMF_CODE.fd'

Cross checking with my Fedora host the only real difference I see is the
qemu version. Changing it to pass a pflash drive directly makes it work
and also make it explicit that the it is a readonly device.

6 years agoRecursively unmount 264/head
Lucas De Marchi [Sat, 6 Oct 2018 01:17:24 +0000 (18:17 -0700)] 
Recursively unmount

We always want to unmount anything left on the root mountpoint. Just
use the --recursive switch from umount.

6 years agoarchlinux: kill any leftover process
Lucas De Marchi [Sat, 6 Oct 2018 01:07:41 +0000 (18:07 -0700)] 
archlinux: kill any leftover process

By adding some debugs I noticed pacstrap leaves dirmngr running. Kill
any leftover process.

6 years agoTwo minor comment fixes
Lucas Werkmeister [Sun, 9 Sep 2018 12:04:57 +0000 (14:04 +0200)] 
Two minor comment fixes

We usually start comments in uppercase, as far as I can tell. (Follow-up
for #263.)

6 years agoMerge pull request #263 from terceiro/debian-optimize
Lucas Werkmeister [Sun, 9 Sep 2018 12:03:59 +0000 (14:03 +0200)] 
Merge pull request #263 from terceiro/debian-optimize

Optimize size of Debian rootfs

6 years agodebian: also remove docs installed by debootstrap 263/head
Antonio Terceiro [Fri, 7 Sep 2018 14:53:24 +0000 (11:53 -0300)] 
debian: also remove docs installed by debootstrap

On my tests, this reduces a minimal Debian stable rootfs from ~204 MB to
~157 MB

6 years agodebian: remove unecessary conditional
Antonio Terceiro [Fri, 7 Sep 2018 14:23:30 +0000 (11:23 -0300)] 
debian: remove unecessary conditional

extra_packages is initialized unconditionally to an non-empty list a few
lines above, so the conditional will always be true

7 years agoMerge pull request #260 from BlackYoup/cenots
Lucas De Marchi [Wed, 1 Aug 2018 05:05:48 +0000 (22:05 -0700)] 
Merge pull request #260 from BlackYoup/cenots

centos: fix typo in updates repository base url

7 years agocentos: fix typo in updates repository base url 260/head
Arnaud Lefebvre [Tue, 31 Jul 2018 23:33:46 +0000 (01:33 +0200)] 
centos: fix typo in updates repository base url

7 years agoRemove `pcmciautils` from the filtered packages for archlinux
Robin B [Mon, 9 Jul 2018 01:11:58 +0000 (03:11 +0200)] 
Remove `pcmciautils` from the filtered packages for archlinux

`pcmciautils` was dropped from the base group and the official repositories for good, there is no need to explicitly remove it from the list

7 years agoMerge pull request #254 from keszybz/fedora-update
Lennart Poettering [Tue, 19 Jun 2018 10:38:41 +0000 (12:38 +0200)] 
Merge pull request #254 from keszybz/fedora-update

Fedora update

7 years agofedora: use F28, it is the latest version 254/head
Zbigniew Jędrzejewski-Szmek [Tue, 19 Jun 2018 10:16:05 +0000 (12:16 +0200)] 
fedora: use F28, it is the latest version

7 years agofedora: cut down on the installation set size
Zbigniew Jędrzejewski-Szmek [Tue, 19 Jun 2018 10:15:40 +0000 (12:15 +0200)] 
fedora: cut down on the installation set size

By installing glibc-minimal-langpack we avoid the installation of glibc-all-langpacks
(glibc requires glibc-langpack (provided by all langpacks) and suggests
glibc-all-langpacks (so that is the default when there is nothing else to
satisfy the require). By forcing a different langpack package, we avoid the
installation of any others.

git-core is similar to git, but does not pull in some lisp and perl stuff.

kernel-core is similar to kernel, but does not include some fancy drivers.

7 years agoFix file descriptor leak (#250)
Lucas Werkmeister [Sat, 19 May 2018 11:12:04 +0000 (13:12 +0200)] 
Fix file descriptor leak (#250)

See also #249.

(The conversion of string concatenation to two writes makes this snippet
more similar to the cmdline snippet below; perhaps we can later refactor
it into a helper function, similar to systemd’s write_string_file().)

7 years agoUse path strings instead of pathlib.Path objects
Filipe Brandenburger [Fri, 2 Mar 2018 06:10:18 +0000 (22:10 -0800)] 
Use path strings instead of pathlib.Path objects

The methods in os and shutil only accept pathlib.Path objects starting
with Python 3.6, so revert those changes to keep compatibility with
Python 3.5.

7 years agoREADME: add e2fsprogs and xfsprogs to package list (#242)
Lucas Werkmeister [Sun, 18 Feb 2018 16:38:50 +0000 (17:38 +0100)] 
README: add e2fsprogs and xfsprogs to package list (#242)

7 years agoRename "Post Installation Script" to "Postinstall script" (#235)
Zbigniew Jędrzejewski-Szmek [Mon, 12 Feb 2018 15:07:55 +0000 (16:07 +0100)] 
Rename "Post Installation Script" to "Postinstall script" (#235)

The short version is pretty well established in packaging world, and
anyway "post-installation" or even "postinstallation" would be more
correct than "post installation" as an adjective.

7 years agoMerge pull request #238 from poettering/pxz
Lucas De Marchi [Mon, 12 Feb 2018 15:06:22 +0000 (07:06 -0800)] 
Merge pull request #238 from poettering/pxz

mkosi: use pxz instead of xz if it's installed

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 agoREADME.md: Update for new raw_xfs, and renamed raw_ext4 options
Naadir Jeewa [Mon, 12 Feb 2018 12:51:56 +0000 (12:51 +0000)] 
README.md: Update for new raw_xfs, and renamed raw_ext4 options

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.]