distr1 / distri

a Linux distribution to research fast package management
https://distr1.org
Other
536 stars 26 forks source link

distri needs an /etc/os-release #33

Closed bureado closed 4 years ago

bureado commented 5 years ago

Currently /etc/os-release is broken. I'm wondering if a systemd wrapper is needed to output an /etc/os-release if it doesn't exist.

I think something simple will suffice:

ID=distri
VERSION_CODENAME=jackherer
PRETTY_NAME="distri (jackherer)"
HOME_URL=https://distr1.org

This makes hostnamectl output:

   Static hostname: distri0
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 201aa7a551c14f299bb973f1ce206503
           Boot ID: b32dcb2061a34dddbe6ae1306babb4cc
    Virtualization: microsoft
  Operating System: distri (jackherer)
            Kernel: Linux 5.1.9
      Architecture: x86-64

Is a wrapper the right implementation for something like this? I tried writing one, but I'm running into building issues for systemd which I haven't been able to debug.

[...]
2019/08/25 23:55:10 run-time dependencies: [cryptsetup-amd64-2.0.4-6 glibc-amd64-2.27-3 json-c-amd64-0.13.1-3 kmod-amd64-25-5 libcap-amd64-2.25-3 libgcrypt-amd64-1.8.3-3 libgpg-error-amd64-1.32-3 libudev-amd64-239-10 lvm2-amd64-2.03.00-6 pam-amd64-1.3.1-10 util-linux-amd64-2.32-6]
2019/08/25 23:55:10 libudev runtime deps: ["cryptsetup-amd64-2.0.4-6" "glibc-amd64-2.27-3" "json-c-amd64-0.13.1-3" "libgcrypt-amd64-1.8.3-3" "libgpg-error-amd64-1.32-3" "kmod-amd64-25-5" "libcap-amd64-2.25-3" "lvm2-amd64-2.03.00-6" "libaio-amd64-0.3.111-3" "pam-amd64-1.3.1-10" "util-linux-amd64-2.32-6" "zlib-amd64-1.2.11-3" "popt-amd64-1.16-3"]
build: open ../distri/pkg/.libudev-amd64-239-10.meta.textproto668611998: no such file or directory
-sh-4.4# 
stapelberg commented 5 years ago

Is a wrapper the right implementation for something like this?

It doesn’t sound like the entirely correct solution to me: /etc/os-release is not just used by systemd, so other packages would need the same wrapper.

In addition, due to its position in the boot process (and initrd!), it might be tricky to correctly implement a wrapper for the systemd executable itself.

We don’t currently have any package which contains hard-coded references to any specific distri release. Instead, when calling distri pack, we pass -branch, so a quick solution is to change pack.go to write /etc/os-release.

A longer-term solution which would also work better with in-place updates (which we haven’t committed to supporting, but haven’t ruled out either) might be to make /etc/os-release a symlink to an exchange dir containing a file shipped by the distri1 package, or the base package. We don’t currently have an exchange directory for etc, but it should be easy to create one (then available at /ro/etc). I haven’t thought about whether there are any negative consequences in making package’s etc directories available in an exchange dir, but I’m willing to experiment with it :)

I tried writing one, but I'm running into building issues for systemd which I haven't been able to debug.

The error message looks like ~/distri/build/distri/pkg not existing to me? Is this related to #32? :)

bureado commented 5 years ago

Yes, the second part is definitely me not understanding how the build environment needed to be setup. This asciinema shows how I set it up, and a successful nano build (I'll contribute it shortly)

ACK on wrapper not being the right approach for this, but leaving the issue open until you have a better idea on whether exchange /etc or something else will work best. Definitely interested in the outcome particularly for updates...