diff --git a/packages/base-images/build.yaml b/packages/base-images/build.yaml deleted file mode 100644 index 511a9f152..000000000 --- a/packages/base-images/build.yaml +++ /dev/null @@ -1,14 +0,0 @@ -image: "{{.Values.image}}" -env: -- DEBIAN_FRONTEND=noninteractive -steps: - -{{ if eq .Values.pm "apt-get" }} -- | - apt update && \ - apt-get install -y {{.Values.packages}} && apt-get clean && rm -rf /var/cache/* -{{ else if eq .Values.pm "zypper" }} -- | - zypper ref && \ - zypper in -y {{.Values.packages}} && zypper cc -{{ end }} \ No newline at end of file diff --git a/packages/base-images/collection.yaml b/packages/base-images/collection.yaml deleted file mode 100644 index 50775d9b4..000000000 --- a/packages/base-images/collection.yaml +++ /dev/null @@ -1,125 +0,0 @@ -packages: -# Note, the package list is a dup of Kairos/images. -# TODO: use those images in Kairos as are tagged and document how to create an image from scratch -- &ubuntu - name: "ubuntu" - category: "base-image" - pm: "apt-get" - version: "22.10-1" - packages: >- - systemd - sudo - iproute2 - squashfs-tools - parted - dracut - dracut-network - dracut-live - tar - e2fsprogs - dosfstools - coreutils - debianutils - curl - openssh-server - nano - gawk - haveged - rsync - jq - neovim - open-vm-tools - conntrack - iptables - image: "ubuntu" -- <<: *ubuntu - name: "ubuntu-20-lts" - category: "base-image" - version: "20.04-1" - image: "ubuntu:20.04" - packages: >- - systemd - sudo - iproute2 - squashfs-tools - parted - dracut - dracut-network - tar - e2fsprogs - dosfstools - coreutils - debianutils - curl - openssh-server - nano - gawk - haveged - rsync - jq - neovim - open-vm-tools - conntrack - iptables -- <<: *ubuntu - name: "ubuntu-22-lts" - category: "base-image" - version: "22.04-1" - image: "ubuntu:22.04" -- name: "opensuse-leap" - category: "base-image" - pm: "zypper" - version: "15.4+2" - image: "opensuse/leap:15.4" - packages: >- - bash-completion - conntrack-tools - coreutils - curl - dhcp - device-mapper - dosfstools - dracut - e2fsprogs - cryptsetup - findutils - gawk - gptfdisk - logrotate - fail2ban - haveged - htop - iproute2 - iptables - iputils - issue-generator - jq - less - lsscsi - lvm2 - mdadm - multipath-tools - nano - nfs-utils - open-iscsi - open-vm-tools - openssh - parted - polkit - pigz - policycoreutils - procps - qemu-guest-agent - rng-tools - rsync - squashfs - strace - systemd - systemd-network - systemd-sysvinit - sudo - tar - timezone - tmux - vim - which diff --git a/packages/bundles/kairos-default-configs/build.yaml b/packages/bundles/kairos-default-configs/build.yaml deleted file mode 100644 index 187ae3ec2..000000000 --- a/packages/bundles/kairos-default-configs/build.yaml +++ /dev/null @@ -1,10 +0,0 @@ -image: alpine -prelude: -- apk add git -- git clone https://github.com/kairos-io/kairos -- | - PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \ - cd kairos && git checkout v$PACKAGE_VERSION -steps: -- mkdir -p /system/oem -- cp -rfv kairos/overlay/files/system/oem/* /system/oem diff --git a/packages/bundles/kairos-default-configs/collection.yaml b/packages/bundles/kairos-default-configs/collection.yaml deleted file mode 100644 index b0731fd3e..000000000 --- a/packages/bundles/kairos-default-configs/collection.yaml +++ /dev/null @@ -1,8 +0,0 @@ -packages: - - name: "kairos-configs" - category: "bundles" - version: "2.3.2" - labels: - github.repo: "kairos" - github.owner: "kairos-io" - autobump.strategy: "release" diff --git a/packages/system/dracut/immucore/build.yaml b/packages/dracut/immucore/build.yaml similarity index 100% rename from packages/system/dracut/immucore/build.yaml rename to packages/dracut/immucore/build.yaml diff --git a/packages/system/dracut/immucore/definition.yaml b/packages/dracut/immucore/definition.yaml similarity index 100% rename from packages/system/dracut/immucore/definition.yaml rename to packages/dracut/immucore/definition.yaml diff --git a/packages/system/dracut/network-legacy-compat/build.yaml b/packages/dracut/network-legacy-compat/build.yaml similarity index 100% rename from packages/system/dracut/network-legacy-compat/build.yaml rename to packages/dracut/network-legacy-compat/build.yaml diff --git a/packages/system/dracut/network-legacy-compat/collection.yaml b/packages/dracut/network-legacy-compat/collection.yaml similarity index 100% rename from packages/system/dracut/network-legacy-compat/collection.yaml rename to packages/dracut/network-legacy-compat/collection.yaml diff --git a/packages/system/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf b/packages/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf similarity index 100% rename from packages/system/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf rename to packages/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf diff --git a/packages/system/dracut/network-legacy/build.yaml b/packages/dracut/network-legacy/build.yaml similarity index 100% rename from packages/system/dracut/network-legacy/build.yaml rename to packages/dracut/network-legacy/build.yaml diff --git a/packages/system/dracut/network-legacy/collection.yaml b/packages/dracut/network-legacy/collection.yaml similarity index 100% rename from packages/system/dracut/network-legacy/collection.yaml rename to packages/dracut/network-legacy/collection.yaml diff --git a/packages/system/dracut/network-legacy/conf/90-kairos-network-legacy.conf b/packages/dracut/network-legacy/conf/90-kairos-network-legacy.conf similarity index 100% rename from packages/system/dracut/network-legacy/conf/90-kairos-network-legacy.conf rename to packages/dracut/network-legacy/conf/90-kairos-network-legacy.conf diff --git a/packages/system/dracut/sysext/build.yaml b/packages/dracut/sysext/build.yaml similarity index 100% rename from packages/system/dracut/sysext/build.yaml rename to packages/dracut/sysext/build.yaml diff --git a/packages/system/dracut/sysext/collection.yaml b/packages/dracut/sysext/collection.yaml similarity index 100% rename from packages/system/dracut/sysext/collection.yaml rename to packages/dracut/sysext/collection.yaml diff --git a/packages/system/dracut/sysext/conf/90-kairos-sysext.conf b/packages/dracut/sysext/conf/90-kairos-sysext.conf similarity index 100% rename from packages/system/dracut/sysext/conf/90-kairos-sysext.conf rename to packages/dracut/sysext/conf/90-kairos-sysext.conf diff --git a/packages/k8s/containerd/build.yaml b/packages/k8s/containerd/build.yaml deleted file mode 100644 index e21664b83..000000000 --- a/packages/k8s/containerd/build.yaml +++ /dev/null @@ -1,26 +0,0 @@ -requires: -- name: "toolchain-ubuntu" - category: "development" - version: ">=0" -prelude: -{{$arch:=(default "amd64" .Values.arch)}} -{{ if eq $arch "arm" }} -{{$arch:="arm64"}} -{{end}} -steps: -- curl -o containerd.tar.gz -L ${CONTAINERD_URL} && tar Cxzvf / containerd.tar.gz --absolute-names --transform 's@usr@opt@' --transform 's@sbin@bin@' --transform 's@opt/local@opt@' && rm containerd.tar.gz -- cp files/etc/systemd/system/containerd.service /etc/systemd/system -- mkdir /etc/systemd/system/containerd.service.d -- cp files/etc/systemd/system/containerd.service.d/*.conf /etc/systemd/system/containerd.service.d -- systemctl enable containerd -- mkdir /etc/containerd -- cp files/etc/containerd/config.toml /etc/containerd -- cp files/etc/modules-load.d/*.conf /etc/modules-load.d/ -- cp files/etc/sysctl.d/*.conf /etc/sysctl.d -env: -- DEBIAN_FRONTEND=noninteractive -- CONTAINERD_TGZ="cri-containerd-{{.Values.containerd_version }}-linux-{{$arch}}.tar.gz" -- CONTAINERD_URL="https://github.com/containerd/containerd/releases/download/v{{.Values.containerd_version}}/${CONTAINERD_TGZ}" -excludes: -- /etc/crictl.yaml -- /opt/bin/crictl diff --git a/packages/k8s/containerd/collection.yaml b/packages/k8s/containerd/collection.yaml deleted file mode 100644 index 279a94070..000000000 --- a/packages/k8s/containerd/collection.yaml +++ /dev/null @@ -1,12 +0,0 @@ -packages: - - name: containerd - arch: amd64 - category: container-runtime - version: 1.6.4 - pause_image: "k8s.gcr.io/pause:3.6" - kubernetes_http_source: "https://dl.k8s.io/release" - crictl_version: "1.20.0" - containerd_version: "1.6.4" - runc_version: "1.1.2" - cni_version: "1.1.1" - containerd_cri_socket: "/var/run/containerd/containerd.sock" diff --git a/packages/k8s/containerd/definition.yaml.old b/packages/k8s/containerd/definition.yaml.old deleted file mode 100644 index 20949251c..000000000 --- a/packages/k8s/containerd/definition.yaml.old +++ /dev/null @@ -1,10 +0,0 @@ -name: containerd -category: container-runtime -version: "1.6.4" -pause_image: "k8s.gcr.io/pause:3.6" -kubernetes_http_source: "https://dl.k8s.io/release" -crictl_version: "1.20.0" -containerd_version: "1.6.4" -runc_version: "1.1.2" -cni_version: "1.1.1" -containerd_cri_socket: "/var/run/containerd/containerd.sock" diff --git a/packages/k8s/containerd/files/etc/containerd/config.toml b/packages/k8s/containerd/files/etc/containerd/config.toml deleted file mode 100644 index 7a5d46783..000000000 --- a/packages/k8s/containerd/files/etc/containerd/config.toml +++ /dev/null @@ -1,11 +0,0 @@ -version = 2 - -imports = ["/etc/containerd/conf.d/*.toml"] - -[plugins] - [plugins."io.containerd.grpc.v1.cri"] - sandbox_image = "k8s.gcr.io/pause:3.6" - [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] - runtime_type = "io.containerd.runc.v2" - [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] - SystemdCgroup = true diff --git a/packages/k8s/containerd/files/etc/crictl.yaml b/packages/k8s/containerd/files/etc/crictl.yaml deleted file mode 100644 index f60a18698..000000000 --- a/packages/k8s/containerd/files/etc/crictl.yaml +++ /dev/null @@ -1 +0,0 @@ -runtime-endpoint: unix:///var/run/containerd/containerd.sock diff --git a/packages/k8s/containerd/files/etc/modules-load.d/k8s.conf b/packages/k8s/containerd/files/etc/modules-load.d/k8s.conf deleted file mode 100644 index 43dd5433b..000000000 --- a/packages/k8s/containerd/files/etc/modules-load.d/k8s.conf +++ /dev/null @@ -1,2 +0,0 @@ -overlay -br_netfilter diff --git a/packages/k8s/containerd/files/etc/sysctl.d/k8s.conf b/packages/k8s/containerd/files/etc/sysctl.d/k8s.conf deleted file mode 100644 index 8df03f11a..000000000 --- a/packages/k8s/containerd/files/etc/sysctl.d/k8s.conf +++ /dev/null @@ -1,3 +0,0 @@ -net.bridge.bridge-nf-call-iptables = 1 -net.bridge.bridge-nf-call-ip6tables = 1 -net.ipv4.ip_forward = 1 diff --git a/packages/k8s/containerd/files/etc/systemd/system/containerd.service b/packages/k8s/containerd/files/etc/systemd/system/containerd.service deleted file mode 100644 index 7931aa894..000000000 --- a/packages/k8s/containerd/files/etc/systemd/system/containerd.service +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright The containerd Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -[Unit] -Description=containerd container runtime -Documentation=https://containerd.io -After=network.target local-fs.target - -[Service] -ExecStartPre=-/sbin/modprobe overlay -ExecStart=/opt/bin/containerd - -Type=notify -Delegate=yes -KillMode=process -Restart=always -RestartSec=5 -# Having non-zero Limit*s causes performance problems due to accounting overhead -# in the kernel. We recommend using cgroups to do container-local accounting. -LimitNPROC=infinity -LimitCORE=infinity -LimitNOFILE=infinity -# Comment TasksMax if your systemd version does not supports it. -# Only systemd 226 and above support this version. -TasksMax=infinity -OOMScoreAdjust=-999 - -[Install] -WantedBy=multi-user.target diff --git a/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/10-custom-opt-bin.conf b/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/10-custom-opt-bin.conf deleted file mode 100644 index 192af7fcc..000000000 --- a/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/10-custom-opt-bin.conf +++ /dev/null @@ -1,6 +0,0 @@ -[Service] -Environment=PATH=/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin -ExecStartPre=mkdir -p /run/docker/libcontainerd -ExecStartPre=ln -fs /run/containerd/containerd.sock /run/docker/libcontainerd/docker-containerd.sock -ExecStart= -ExecStart=/opt/bin/containerd --config /etc/containerd/config.toml diff --git a/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/max-tasks.conf b/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/max-tasks.conf deleted file mode 100644 index 14aaeaa3f..000000000 --- a/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/max-tasks.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -# Do not limit the number of tasks that can be spawned by containerd -TasksMax=infinity diff --git a/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/memory-pressure.conf b/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/memory-pressure.conf deleted file mode 100644 index 4345fa7de..000000000 --- a/packages/k8s/containerd/files/etc/systemd/system/containerd.service.d/memory-pressure.conf +++ /dev/null @@ -1,8 +0,0 @@ -[Service] -# Decreases the likelihood that containerd is killed due to memory -# pressure. -# -# Please see the following link for more information about the -# OOMScoreAdjust configuration property: -# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#OOMScoreAdjust= -OOMScoreAdjust=-999 diff --git a/packages/k8s/containerd/templates/config.yaml b/packages/k8s/containerd/templates/config.yaml deleted file mode 100644 index bf1496014..000000000 --- a/packages/k8s/containerd/templates/config.yaml +++ /dev/null @@ -1,14 +0,0 @@ -{{ define "config" }} - version = 2 - -imports = ["/etc/containerd/conf.d/*.toml"] - -[plugins] - [plugins."io.containerd.grpc.v1.cri"] - sandbox_image = "{{.}}" - [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] - runtime_type = "io.containerd.runc.v2" - [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] - SystemdCgroup = true - -{{ end }} diff --git a/packages/bundles/kairos-overlay-files/build.yaml b/packages/static/kairos-overlay-files/build.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/build.yaml rename to packages/static/kairos-overlay-files/build.yaml diff --git a/packages/bundles/kairos-overlay-files/collection.yaml b/packages/static/kairos-overlay-files/collection.yaml similarity index 72% rename from packages/bundles/kairos-overlay-files/collection.yaml rename to packages/static/kairos-overlay-files/collection.yaml index ced7499e8..152e7e6d2 100644 --- a/packages/bundles/kairos-overlay-files/collection.yaml +++ b/packages/static/kairos-overlay-files/collection.yaml @@ -1,4 +1,4 @@ packages: - name: "kairos-overlay-files" - category: "bundles" + category: "static" version: "1.0.7" diff --git a/packages/bundles/kairos-overlay-files/files/etc/bash.bashrc.local b/packages/static/kairos-overlay-files/files/etc/bash.bashrc.local similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/bash.bashrc.local rename to packages/static/kairos-overlay-files/files/etc/bash.bashrc.local diff --git a/packages/bundles/kairos-overlay-files/files/etc/default/console-setup b/packages/static/kairos-overlay-files/files/etc/default/console-setup similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/default/console-setup rename to packages/static/kairos-overlay-files/files/etc/default/console-setup diff --git a/packages/bundles/kairos-overlay-files/files/etc/issue.d/01-KAIROS b/packages/static/kairos-overlay-files/files/etc/issue.d/01-KAIROS similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/issue.d/01-KAIROS rename to packages/static/kairos-overlay-files/files/etc/issue.d/01-KAIROS diff --git a/packages/bundles/kairos-overlay-files/files/etc/kairos/branding/grubmenu.cfg b/packages/static/kairos-overlay-files/files/etc/kairos/branding/grubmenu.cfg similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/kairos/branding/grubmenu.cfg rename to packages/static/kairos-overlay-files/files/etc/kairos/branding/grubmenu.cfg diff --git a/packages/bundles/kairos-overlay-files/files/etc/kairos/branding/install_text b/packages/static/kairos-overlay-files/files/etc/kairos/branding/install_text similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/kairos/branding/install_text rename to packages/static/kairos-overlay-files/files/etc/kairos/branding/install_text diff --git a/packages/bundles/kairos-overlay-files/files/etc/kairos/branding/interactive_install_text b/packages/static/kairos-overlay-files/files/etc/kairos/branding/interactive_install_text similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/kairos/branding/interactive_install_text rename to packages/static/kairos-overlay-files/files/etc/kairos/branding/interactive_install_text diff --git a/packages/bundles/kairos-overlay-files/files/etc/kairos/branding/recovery_text b/packages/static/kairos-overlay-files/files/etc/kairos/branding/recovery_text similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/kairos/branding/recovery_text rename to packages/static/kairos-overlay-files/files/etc/kairos/branding/recovery_text diff --git a/packages/bundles/kairos-overlay-files/files/etc/kairos/branding/reset_text b/packages/static/kairos-overlay-files/files/etc/kairos/branding/reset_text similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/kairos/branding/reset_text rename to packages/static/kairos-overlay-files/files/etc/kairos/branding/reset_text diff --git a/packages/bundles/kairos-overlay-files/files/etc/logrotate.d/kairos b/packages/static/kairos-overlay-files/files/etc/logrotate.d/kairos similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/logrotate.d/kairos rename to packages/static/kairos-overlay-files/files/etc/logrotate.d/kairos diff --git a/packages/bundles/kairos-overlay-files/files/etc/motd b/packages/static/kairos-overlay-files/files/etc/motd similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/motd rename to packages/static/kairos-overlay-files/files/etc/motd diff --git a/packages/bundles/kairos-overlay-files/files/etc/runlevels/.keep b/packages/static/kairos-overlay-files/files/etc/runlevels/.keep similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/runlevels/.keep rename to packages/static/kairos-overlay-files/files/etc/runlevels/.keep diff --git a/packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-agent.service b/packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-agent.service similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-agent.service rename to packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-agent.service diff --git a/packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-interactive.service b/packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-interactive.service similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-interactive.service rename to packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-interactive.service diff --git a/packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-recovery.service b/packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-recovery.service similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-recovery.service rename to packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-recovery.service diff --git a/packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-reset.service b/packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-reset.service similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-reset.service rename to packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-reset.service diff --git a/packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-webui.service b/packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-webui.service similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos-webui.service rename to packages/static/kairos-overlay-files/files/etc/systemd/system/kairos-webui.service diff --git a/packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos.service b/packages/static/kairos-overlay-files/files/etc/systemd/system/kairos.service similarity index 100% rename from packages/bundles/kairos-overlay-files/files/etc/systemd/system/kairos.service rename to packages/static/kairos-overlay-files/files/etc/systemd/system/kairos.service diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/00_datasource.yaml b/packages/static/kairos-overlay-files/files/system/oem/00_datasource.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/00_datasource.yaml rename to packages/static/kairos-overlay-files/files/system/oem/00_datasource.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/00_rootfs.yaml b/packages/static/kairos-overlay-files/files/system/oem/00_rootfs.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/00_rootfs.yaml rename to packages/static/kairos-overlay-files/files/system/oem/00_rootfs.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/02_agent.yaml b/packages/static/kairos-overlay-files/files/system/oem/02_agent.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/02_agent.yaml rename to packages/static/kairos-overlay-files/files/system/oem/02_agent.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/02_notify.yaml b/packages/static/kairos-overlay-files/files/system/oem/02_notify.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/02_notify.yaml rename to packages/static/kairos-overlay-files/files/system/oem/02_notify.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/03-setupcon.yaml b/packages/static/kairos-overlay-files/files/system/oem/03-setupcon.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/03-setupcon.yaml rename to packages/static/kairos-overlay-files/files/system/oem/03-setupcon.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/05_network.yaml b/packages/static/kairos-overlay-files/files/system/oem/05_network.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/05_network.yaml rename to packages/static/kairos-overlay-files/files/system/oem/05_network.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/08_grub.yaml b/packages/static/kairos-overlay-files/files/system/oem/08_grub.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/08_grub.yaml rename to packages/static/kairos-overlay-files/files/system/oem/08_grub.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/09_services.yaml b/packages/static/kairos-overlay-files/files/system/oem/09_services.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/09_services.yaml rename to packages/static/kairos-overlay-files/files/system/oem/09_services.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/10_accounting.yaml b/packages/static/kairos-overlay-files/files/system/oem/10_accounting.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/10_accounting.yaml rename to packages/static/kairos-overlay-files/files/system/oem/10_accounting.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/11_persistent.yaml b/packages/static/kairos-overlay-files/files/system/oem/11_persistent.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/11_persistent.yaml rename to packages/static/kairos-overlay-files/files/system/oem/11_persistent.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/12_nvidia.yaml b/packages/static/kairos-overlay-files/files/system/oem/12_nvidia.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/12_nvidia.yaml rename to packages/static/kairos-overlay-files/files/system/oem/12_nvidia.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/13_openrc_services.yaml b/packages/static/kairos-overlay-files/files/system/oem/13_openrc_services.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/13_openrc_services.yaml rename to packages/static/kairos-overlay-files/files/system/oem/13_openrc_services.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/21_kcrypt.yaml b/packages/static/kairos-overlay-files/files/system/oem/21_kcrypt.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/21_kcrypt.yaml rename to packages/static/kairos-overlay-files/files/system/oem/21_kcrypt.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/23_c3os.yaml b/packages/static/kairos-overlay-files/files/system/oem/23_c3os.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/23_c3os.yaml rename to packages/static/kairos-overlay-files/files/system/oem/23_c3os.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/24_sysext.yaml b/packages/static/kairos-overlay-files/files/system/oem/24_sysext.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/24_sysext.yaml rename to packages/static/kairos-overlay-files/files/system/oem/24_sysext.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/25_autologin.yaml b/packages/static/kairos-overlay-files/files/system/oem/25_autologin.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/25_autologin.yaml rename to packages/static/kairos-overlay-files/files/system/oem/25_autologin.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/26_selinux.yaml b/packages/static/kairos-overlay-files/files/system/oem/26_selinux.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/26_selinux.yaml rename to packages/static/kairos-overlay-files/files/system/oem/26_selinux.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/26_vm.yaml b/packages/static/kairos-overlay-files/files/system/oem/26_vm.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/26_vm.yaml rename to packages/static/kairos-overlay-files/files/system/oem/26_vm.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/28_cgroups.yaml b/packages/static/kairos-overlay-files/files/system/oem/28_cgroups.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/28_cgroups.yaml rename to packages/static/kairos-overlay-files/files/system/oem/28_cgroups.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/29_blacklist.yaml b/packages/static/kairos-overlay-files/files/system/oem/29_blacklist.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/29_blacklist.yaml rename to packages/static/kairos-overlay-files/files/system/oem/29_blacklist.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/30_ulimit.yaml b/packages/static/kairos-overlay-files/files/system/oem/30_ulimit.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/30_ulimit.yaml rename to packages/static/kairos-overlay-files/files/system/oem/30_ulimit.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/31_hosts.yaml b/packages/static/kairos-overlay-files/files/system/oem/31_hosts.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/31_hosts.yaml rename to packages/static/kairos-overlay-files/files/system/oem/31_hosts.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/50_recovery.yaml b/packages/static/kairos-overlay-files/files/system/oem/50_recovery.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/50_recovery.yaml rename to packages/static/kairos-overlay-files/files/system/oem/50_recovery.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/51_reset.yaml b/packages/static/kairos-overlay-files/files/system/oem/51_reset.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/51_reset.yaml rename to packages/static/kairos-overlay-files/files/system/oem/51_reset.yaml diff --git a/packages/bundles/kairos-overlay-files/files/system/oem/52_installer.yaml b/packages/static/kairos-overlay-files/files/system/oem/52_installer.yaml similarity index 100% rename from packages/bundles/kairos-overlay-files/files/system/oem/52_installer.yaml rename to packages/static/kairos-overlay-files/files/system/oem/52_installer.yaml diff --git a/packages/bundles/kairos-overlay-files/files/usr/lib/os-release.tmpl b/packages/static/kairos-overlay-files/files/usr/lib/os-release.tmpl similarity index 100% rename from packages/bundles/kairos-overlay-files/files/usr/lib/os-release.tmpl rename to packages/static/kairos-overlay-files/files/usr/lib/os-release.tmpl diff --git a/packages/bundles/kairos-overlay-files/files/usr/libexec/.keep b/packages/static/kairos-overlay-files/files/usr/libexec/.keep similarity index 100% rename from packages/bundles/kairos-overlay-files/files/usr/libexec/.keep rename to packages/static/kairos-overlay-files/files/usr/libexec/.keep diff --git a/packages/bundles/kairos-overlay-files/files/var/log/kairos/.keep b/packages/static/kairos-overlay-files/files/var/log/kairos/.keep similarity index 100% rename from packages/bundles/kairos-overlay-files/files/var/log/kairos/.keep rename to packages/static/kairos-overlay-files/files/var/log/kairos/.keep diff --git a/packages/system/cloud-config/build.yaml b/packages/system/cloud-config/build.yaml deleted file mode 100644 index 608eaa435..000000000 --- a/packages/system/cloud-config/build.yaml +++ /dev/null @@ -1,7 +0,0 @@ -image: alpine - -steps: -- mkdir -p /system/oem -- chmod 700 /system/oem -- cp -rfv oem/* /system/oem -- chmod -R 600 /system/oem diff --git a/packages/system/cloud-config/definition.yaml b/packages/system/cloud-config/definition.yaml deleted file mode 100644 index 692cc2ce7..000000000 --- a/packages/system/cloud-config/definition.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "base-cloud-config" -category: "system" -version: "0.2.0" \ No newline at end of file diff --git a/packages/system/cloud-config/oem/00_rootfs.yaml b/packages/system/cloud-config/oem/00_rootfs.yaml deleted file mode 100644 index 85e7b8564..000000000 --- a/packages/system/cloud-config/oem/00_rootfs.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# Rootfs Kairos OEM configuration file -# -# This file is part of Kairos and will get reset during upgrades. -# -# Before you change this file manually, -# consider copying this file to /usr/local/cloud-config or -# copy the file with a prefix starting by 90, e.g. /oem/91_custom.yaml -name: "Rootfs Layout Settings" -stages: - rootfs.before: - - name: "Pull data from provider" - datasource: - providers: ["aws", "gcp", "openstack", "cdrom"] - path: "/oem" - rootfs: - - if: '[ ! -f "/run/cos/recovery_mode" ]' - name: "Layout configuration" - environment_file: /run/cos/cos-layout.env - environment: - VOLUMES: "LABEL=COS_OEM:/oem LABEL=COS_PERSISTENT:/usr/local" - OVERLAY: "tmpfs:25%" - - if: '[ -f "/run/cos/recovery_mode" ]' - # omit the persistent partition on recovery mode - name: "Layout configuration" - environment_file: /run/cos/cos-layout.env - environment: - VOLUMES: "LABEL=COS_OEM:/oem" - OVERLAY: "tmpfs:25%" - initramfs: - - if: '[ ! -f "/run/cos/recovery_mode" ]' - name: "Persist /etc/machine-id" - commands: - - | - # persist machine-id - if [ -s /usr/local/etc/machine-id ]; then - cat /usr/local/etc/machine-id > /etc/machine-id - else - mkdir -p /usr/local/etc - cp /etc/machine-id /usr/local/etc - fi diff --git a/packages/system/cloud-config/oem/06_recovery.yaml b/packages/system/cloud-config/oem/06_recovery.yaml deleted file mode 100644 index a7d8f7acf..000000000 --- a/packages/system/cloud-config/oem/06_recovery.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Default Kairos OEM configuration file -# -# This file is part of Kairos and will get reset during upgrades. -# -# Before you change this file manually, -# consider copying this file to /usr/local/cloud-config or -# copy the file with a prefix starting by 90, e.g. /oem/91_custom.yaml -name: "Recovery partition boot setup" -stages: - rootfs.before: - - if: | - [ -n "$(blkid -L COS_SYSTEM || true)" ] || cat /proc/cmdline | grep -q "COS_RECOVERY" - name: "Identify recovery mode" - files: - - path: /run/cos/recovery_mode - content: "1" - permissions: 0600 - owner: 0 - group: 0 - boot: - - name: "Recovery" - if: '[ -f "/run/cos/recovery_mode" ]' - hostname: "cos-recovery" - commands: - - | - source /etc/os-release - echo >> /etc/issue - echo "You are booting from recovery mode. Run 'kairos-agent reset' to reset the system to $VERSION" >> /etc/issue - echo " or kairos-agent upgrade to upgrade the active partition" >> /etc/issue - echo >> /etc/issue diff --git a/packages/system/cloud-config/oem/07_live.yaml b/packages/system/cloud-config/oem/07_live.yaml deleted file mode 100644 index 41589a273..000000000 --- a/packages/system/cloud-config/oem/07_live.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Rootfs Kairos OEM configuration file -# -# This file is part of Kairos and will get reset during upgrades. -# -# Before you change this file manually, -# consider copying this file to /usr/local/cloud-config or -# copy the file with a prefix starting by 90, e.g. /oem/91_custom.yaml -name: "LiveCD Detection" -stages: - rootfs.before: - - if: | - cat /proc/cmdline | grep -q "CDLABEL" || cat /proc/cmdline | grep -q "rd.cos.disable" - name: "Identify live mode" - files: - - path: /run/cos/live_mode - content: "1" - permissions: 0600 - owner: 0 - group: 0 diff --git a/packages/system/cloud-config/oem/08_boot_assessment.yaml b/packages/system/cloud-config/oem/08_boot_assessment.yaml deleted file mode 100644 index 88a2e4faf..000000000 --- a/packages/system/cloud-config/oem/08_boot_assessment.yaml +++ /dev/null @@ -1,125 +0,0 @@ -# Rootfs Kairos OEM configuration file -# -# This file is part of Kairos and will get reset during upgrades. - -# The boot assessment works in this way: -# - After we upgrade, we set a grub env sentinel variable indicating that we did run an upgrade -# - At the first boot, if we did an upgrade, we set another sentinel variable, which indicates we are trying to boot -# - If we boot fine, we remove both sentinels -# - If we get back again at the GRUB menu, a failure must have occurred and we select the fallback entry, creating also -# sentinels files and a specific cmdline option indicating we failed booting after an upgrade - -name: "Boot assessment" -stages: - boot.before: - # Remove any grub sentinel and add - # System sentinel to /run to indicate if we are booting after a failed upgrade. - # This needs to run only on the active partition. - # To note, we could similarly enable boot assessment always, also besides upgrades. - # In this case it is enough to reset only boot_assessment_tentative here, and set - # enable_boot_assessment to 'yes'. - # This can be then customized easily by having a cloud-config file which always enables boot assessment on - # the boot stage. - - name: "Remove GRUB sentinels" - if: | - cat /proc/cmdline | grep -q "active.img" - commands: - - | - mount -o rw,remount /run/initramfs/cos-state - grub2-editenv /run/initramfs/cos-state/boot_assessment set enable_boot_assessment= - grub2-editenv /run/initramfs/cos-state/boot_assessment set boot_assessment_tentative= - mount -o ro,remount /run/initramfs/cos-state - - name: "Create upgrade failure sentinel if necessary" - if: | - cat /proc/cmdline | grep -q "upgrade_failure" - files: - - path: /run/cos/upgrade_failure - content: "1" - permissions: 0600 - owner: 0 - group: 0 - after-install: - # After install, reset, and upgrade, we install additional GRUB configuration for boot assessment into COS_STATE. - - - &statemount - name: "Mount state" - commands: - - | - STATEDIR=/tmp/mnt/STATE - STATE=$(blkid -L COS_STATE || true) - mkdir -p $STATEDIR || true - mount ${STATE} $STATEDIR - # Here we hook the boot assessment configuration to 'grubcustom' - # we do that selectively in order to just "append" eventual other configuration provided. - # XXX: maybe we should just write to /grubcustom and override any other custom grub? - - &customhook - name: "Hook boot assessment grub configuration" - if: | - ! grep -q "grub_boot_assessment" /tmp/mnt/STATE/grubcustom - commands: - - | - cat << 'EOF' >> /tmp/mnt/STATE/grubcustom - set bootfile="/grub_boot_assessment" - search --no-floppy --file --set=bootfile_loc "${bootfile}" - if [ "${bootfile_loc}" ]; then - source "(${bootfile_loc})${bootfile}" - fi - EOF - # Overrides the active cmdline by adding "rd.emergency=reboot", "rd.shell=0" and "panic=5" - # so that any failure in booting initramfs or kernel loading results in a reboot. - # It loads then the boot assessment environment and overrides default boot target if - # a boot failure is detected. - # A boot is considered failed when both sentinel are present ( upgrade triggered, tentative ). - # The tentative sentinel is set after an upgrade was triggered. - # This configuration is separated so it can be tracked separately from the install hook - # - - &bootgrub - name: "Add boot assessment grub configuration" - files: - - path: "/tmp/mnt/STATE/grub_boot_assessment" - owner: 0 - group: 0 - permsisions: 0600 - content: | - set extra_active_cmdline="rd.emergency=reboot rd.shell=0 panic=5 systemd.crash_reboot systemd.crash_shell=0" - set boot_assessment="/boot_assessment" - search --no-floppy --file --set=boot_assessment_blk "${boot_assessment}" - if [ "${boot_assessment_blk}" ]; then - load_env -f "(${boot_assessment_blk})${boot_assessment}" - fi - if [ "${enable_boot_assessment}" = "yes" -o "${enable_boot_assessment_always}" = "yes" ]; then - if [ -z "${selected_entry}" ]; then - if [ "${boot_assessment_tentative}" = "yes" ]; then - set default="fallback" - set extra_passive_cmdline="upgrade_failure" - else - set boot_assessment_tentative="yes" - save_env -f "(${boot_assessment_blk})${boot_assessment}" boot_assessment_tentative - fi - fi - fi - - &stateumount - name: "umount state" - commands: - - | - umount /tmp/mnt/STATE - - # Here we do enable boot assessment for the next bootup. - # Similarly, we could trigger boot assessment in other cases - after-upgrade: - - <<: *statemount - - name: "Set upgrade sentinel" - commands: - - | - grub2-editenv /tmp/mnt/STATE/boot_assessment set enable_boot_assessment=yes - # We do re-install hooks here if needed to track upgrades of boot assessment - - <<: *customhook - - <<: *bootgrub - - <<: *stateumount - - after-reset: - - <<: *statemount - # Reset completely restores COS_STATE, so we re-inject ourselves - - <<: *customhook - - <<: *bootgrub - - <<: *stateumount \ No newline at end of file diff --git a/packages/system/cloud-config/oem/09_services.yaml b/packages/system/cloud-config/oem/09_services.yaml deleted file mode 100644 index a2796c432..000000000 --- a/packages/system/cloud-config/oem/09_services.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Rootfs Kairos OEM configuration file -# -# This file is part of Kairos and will get reset during upgrades. - -name: "Default config" -stages: - initramfs: - - name: "Default systemd config" - if: '[ -e "/sbin/systemctl" ] || [ -e "/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]' - systemctl: - enable: - - systemd-timesyncd \ No newline at end of file diff --git a/packages/system/dracut/immutable-rootfs-legacy-compat/30cos-immutable-rootfs/cos-loop-img.sh b/packages/system/dracut/immutable-rootfs-legacy-compat/30cos-immutable-rootfs/cos-loop-img.sh deleted file mode 100755 index 252cdebbd..000000000 --- a/packages/system/dracut/immutable-rootfs-legacy-compat/30cos-immutable-rootfs/cos-loop-img.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -function doLoopMount { - local partdev - local partname - local dev - - # Iterate over current device labels - for partdev in $(lsblk -nlp | awk '$0 ~ /part/ {print $1}'); do - partname=$(basename "${partdev}") - [ -e "/tmp/cosloop-${partname}" ] && continue - > "/tmp/cosloop-${partname}" - - # Ensure run system-fsck, at least, for the root partition - systemd-fsck "${partdev}" - - # Only run systemd-fsck if root is already found - [ "${found}" == "ok" ] && continue - - mount -t auto -o "${cos_root_perm}" "${partdev}" "${cos_state}" || continue - if [ -f "${cos_state}/${cos_img}" ]; then - - dev=$(losetup --show -f "${cos_state}/${cos_img}") - - # attempt to run systemd-fsck on the loop device - systemd-fsck "${dev}" - - found="ok" - else - umount "${cos_state}" - fi - done -} - -type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh - -PATH=/usr/sbin:/usr/bin:/sbin:/bin - -declare cos_img=$1 -declare cos_root_perm="ro" -declare cos_state="/run/initramfs/cos-state" -declare found="" - -[ -z "${cos_img}" ] && exit 1 - -if getargbool 0 rd.cos.debugrw; then - cos_root_perm="rw" -fi - -ismounted "${cos_state}" && exit 0 - -mkdir -p "${cos_state}" - -doLoopMount -if [ "${found}" == "ok" ]; then - exit 0 -fi - -rm -r "${cos_state}" -exit 1 diff --git a/packages/system/dracut/immutable-rootfs-legacy-compat/LICENSE b/packages/system/dracut/immutable-rootfs-legacy-compat/LICENSE deleted file mode 100644 index 68428665e..000000000 --- a/packages/system/dracut/immutable-rootfs-legacy-compat/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -This package is a fork of the immutable-rootfs package in rancher/elemental-toolkit. - -Copyright (c) 2020-2021 SUSE, LLC -Copyright (c) 2022 Kairos - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/system/dracut/immutable-rootfs-legacy-compat/README.md b/packages/system/dracut/immutable-rootfs-legacy-compat/README.md deleted file mode 100644 index 08f42409e..000000000 --- a/packages/system/dracut/immutable-rootfs-legacy-compat/README.md +++ /dev/null @@ -1,2 +0,0 @@ -This package auguments the immutable-rootfs package by adding support for legacy -versions of uitl-linux/lsblk which are present in systems like RHEL 8 diff --git a/packages/system/dracut/immutable-rootfs-legacy-compat/build.yaml b/packages/system/dracut/immutable-rootfs-legacy-compat/build.yaml deleted file mode 100644 index 3ac7bd033..000000000 --- a/packages/system/dracut/immutable-rootfs-legacy-compat/build.yaml +++ /dev/null @@ -1,5 +0,0 @@ -image: alpine -package_dir: "/package" -steps: -- mkdir -p /package/usr/lib/dracut/modules.d -- cp -r 30cos-immutable-rootfs /package/usr/lib/dracut/modules.d diff --git a/packages/system/dracut/immutable-rootfs-legacy-compat/definition.yaml b/packages/system/dracut/immutable-rootfs-legacy-compat/definition.yaml deleted file mode 100644 index 4ac952624..000000000 --- a/packages/system/dracut/immutable-rootfs-legacy-compat/definition.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "immutable-rootfs-legacy-compat" -category: "dracut" -version: "0.10" diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-generator.sh b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-generator.sh deleted file mode 100755 index a23f365c9..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-generator.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh - -cos_unit="cos-immutable-rootfs.service" -cos_layout="/run/cos/cos-layout.env" - -# Omit any immutable roofs module logic if disabled -if getargbool 0 rd.cos.disable; then - exit 0 -fi - -[ -z "${root}" ] && root=$(getarg root=) - -cos_root_perm="ro" -if getargbool 0 rd.cos.debugrw; then - cos_root_perm="rw" -fi - -oem_timeout=$(getargnum 120 1 1800 rd.cos.oemtimeout=) -oem_label=$(getarg rd.cos.oemlabel=) -cos_overlay=$(getarg rd.cos.overlay=) -[ -z "${cos_overlay}" ] && cos_overlay="tmpfs:20%" - -GENERATOR_DIR="$2" -[ -z "$GENERATOR_DIR" ] && exit 1 -[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR" - -if [ -n "${oem_label}" ]; then - dev=$(dev_unit_name /dev/disk/by-label/${oem_label}) - { - echo "[Unit]" - echo "DefaultDependencies=no" - echo "Before=cos-setup-rootfs.service" - echo "Conflicts=initrd-switch-root.target" - echo "[Mount]" - echo "Where=/oem" - echo "What=/dev/disk/by-label/${oem_label}" - echo "Options=rw,suid,dev,exec,noauto,nouser,async" - } > "$GENERATOR_DIR"/oem.mount - - if [ ! -e "$GENERATOR_DIR/cos-setup-rootfs.service.wants/oem.mount" ]; then - mkdir -p "$GENERATOR_DIR"/cos-setup-rootfs.service.wants - ln -s "$GENERATOR_DIR"/oem.mount \ - "$GENERATOR_DIR"/cos-setup-rootfs.service.wants/oem.mount - fi - - mkdir -p "$GENERATOR_DIR/$dev.device.d" - { - echo "[Unit]" - echo "Before=initrd-root-fs.target" - echo "JobRunningTimeoutSec=${oem_timeout}" - } > "$GENERATOR_DIR/$dev.device.d/timeout.conf" - - if [ ! -e "$GENERATOR_DIR/initrd-root-fs.target.wants/$dev.device" ]; then - mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.wants - ln -s "$GENERATOR_DIR"/"$dev".device \ - "$GENERATOR_DIR"/initrd-root-fs.target.wants/"$dev".device - fi -fi - -case "${cos_overlay}" in - UUID=*) \ - cos_overlay="block:/dev/disk/by-uuid/${cos_overlay#UUID=}" - ;; - LABEL=*) \ - cos_overlay="block:/dev/disk/by-label/${cos_overlay#LABEL=}" - ;; -esac - -cos_mounts=() -for mount in $(getargs rd.cos.mount=); do - case "${mount}" in - UUID=*) \ - mount="/dev/disk/by-uuid/${mount#UUID=}" - ;; - LABEL=*) \ - mount="/dev/disk/by-label/${mount#LABEL=}" - ;; - esac - cos_mounts+=("${mount}") -done - -mkdir -p "/run/systemd/system/${cos_unit}.d" -{ - echo "[Service]" - echo "Environment=\"cos_mounts=${cos_mounts[@]}\"" - echo "Environment=\"cos_overlay=${cos_overlay}\"" - echo "Environment=\"cos_root_perm=${cos_root_perm}\"" - echo "EnvironmentFile=${cos_layout}" -} > "/run/systemd/system/${cos_unit}.d/override.conf" - -case "${root}" in - LABEL=*) \ - root="${root//\//\\x2f}" - root="/dev/disk/by-label/${root#LABEL=}" - rootok=1 ;; - UUID=*) \ - root="/dev/disk/by-uuid/${root#UUID=}" - rootok=1 ;; - /dev/*) \ - rootok=1 ;; -esac - -[ "${rootok}" != "1" ] && exit 0 - -dev=$(dev_unit_name "${root}") -{ - echo "[Unit]" - echo "Before=initrd-root-fs.target" - echo "DefaultDependencies=no" - echo "[Mount]" - echo "Where=/sysroot" - echo "What=${root}" - echo "Options=${cos_root_perm},suid,dev,exec,auto,nouser,async" -} > "$GENERATOR_DIR"/sysroot.mount - -if [ ! -e "$GENERATOR_DIR/initrd-root-fs.target.requires/sysroot.mount" ]; then - mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires - ln -s "$GENERATOR_DIR"/sysroot.mount \ - "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount -fi - -mkdir -p "$GENERATOR_DIR/$dev.device.d" -{ - echo "[Unit]" - echo "JobTimeoutSec=300" - echo "JobRunningTimeoutSec=300" -} > "$GENERATOR_DIR/$dev.device.d/timeout.conf" diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-immutable-rootfs.service b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-immutable-rootfs.service deleted file mode 100644 index 4125e753e..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-immutable-rootfs.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=cOS system immutable rootfs mounts -DefaultDependencies=no -After=initrd-root-fs.target cos-setup-rootfs.service -Requires=initrd-root-fs.target -Before=initrd-fs.target -Conflicts=initrd-switch-root.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStartPre=-/usr/bin/systemctl stop oem.mount -ExecStart=/sbin/cos-mount-layout diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-loop-img.sh b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-loop-img.sh deleted file mode 100755 index 869eaa987..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-loop-img.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -function doLoopMount { - local partdev - local partname - local dev - - # Iterate over current device labels - for partdev in $(lsblk -ln -o path,type | grep part | cut -d" " -f1); do - partname=$(basename "${partdev}") - [ -e "/tmp/cosloop-${partname}" ] && continue - > "/tmp/cosloop-${partname}" - - # Ensure run system-fsck, at least, for the root partition - systemd-fsck "${partdev}" - - # Only run systemd-fsck if root is already found - [ "${found}" == "ok" ] && continue - - mount -t auto -o "${cos_root_perm}" "${partdev}" "${cos_state}" || continue - if [ -f "${cos_state}/${cos_img}" ]; then - - dev=$(losetup --show -f "${cos_state}/${cos_img}") - - # attempt to run systemd-fsck on the loop device - systemd-fsck "${dev}" - - found="ok" - else - umount "${cos_state}" - fi - done -} - -type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh - -PATH=/usr/sbin:/usr/bin:/sbin:/bin - -declare cos_img=$1 -declare cos_root_perm="ro" -declare cos_state="/run/initramfs/cos-state" -declare found="" - -[ -z "${cos_img}" ] && exit 1 - -if getargbool 0 rd.cos.debugrw; then - cos_root_perm="rw" -fi - -ismounted "${cos_state}" && exit 0 - -mkdir -p "${cos_state}" - -doLoopMount -if [ "${found}" == "ok" ]; then - exit 0 -fi - -rm -r "${cos_state}" -exit 1 diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-mount-layout.sh b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-mount-layout.sh deleted file mode 100755 index 7864638ce..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-mount-layout.sh +++ /dev/null @@ -1,278 +0,0 @@ -#!/bin/bash -# cos_root_perm, cos_mounts and cos_overlay variables already processsed - -#====================================== -# Functions -#-------------------------------------- - -function getOverlayMountpoints { - local mountpoints - - for path in "${rw_paths[@]}"; do - if ! hasMountpoint "${path}" "${cos_mounts[@]}"; then - mountpoints+="${path}:overlay " - fi - done - echo "${mountpoints}" -} - -function getStateMountpoints { - local mountpoints=$1 - local state_mounts - - for path in "${state_paths[@]}"; do - if ! hasMountpoint "${path}" "${mountpoints}"; then - state_mounts+="${path} " - fi - done - echo "${state_mounts}" -} - -function hasMountpoint { - local path=$1 - shift - local mounts=("$@") - - for mount in "${mounts[@]}"; do - if [ "${path}" = "${mount#*:}" ]; then - return 0 - fi - done - return 1 -} - -function parseOverlay { - local overlay=$1 - - case "${overlay}" in - UUID=*) \ - overlay="block:/dev/disk/by-uuid/${overlay#UUID=}" - ;; - LABEL=*) \ - overlay="block:/dev/disk/by-label/${overlay#LABEL=}" - ;; - esac - echo "${overlay}" -} - -function parseCOSMount { - local mount=$1 - - case "${mount}" in - UUID=*) \ - mount="/dev/disk/by-uuid/${mount#UUID=}" - ;; - LABEL=*) \ - mount="/dev/disk/by-label/${mount#LABEL=}" - ;; - esac - echo "${mount}" -} - -function readCOSLayoutConfig { - local mounts=() - : "${MERGE:=true}" - - if [ "${DEBUG_RW}" = "true" ]; then - cos_root_perm="rw" - fi - - if [ -n "${VOLUMES}" ]; then - for volume in ${VOLUMES}; do - mounts+=("$(parseCOSMount ${volume})") - done - fi - - if [ "${MERGE}" = "true" ]; then - if [ -n "${cos_mounts}" ]; then - for mount in ${cos_mounts}; do - if ! hasMountpoint "${mount#*:}" "${mounts[@]}"; then - mounts+=("${mount}") - fi - done - fi - fi - - if [ -n "${OVERLAY}" ]; then - cos_overlay=$(parseOverlay "${OVERLAY}") - fi - if [ ${#mounts[@]} -gt 0 ]; then - cos_mounts=("${mounts[@]}") - else - cos_mounts=() - fi - - state_paths=() - state_bind="${PERSISTENT_STATE_BIND:-false}" - state_target="${PERSISTENT_STATE_TARGET:-/usr/local/.state}" - - # An empty RW_PATHS is a valid value, default rw_paths are only - # applied when RW_PATHS is unset. - if [ -n "${RW_PATHS+x}" ]; then - rw_paths=(${RW_PATHS}) - fi - if [ -n "${PERSISTENT_STATE_PATHS}" ]; then - state_paths=(${PERSISTENT_STATE_PATHS}) - fi -} - -function getCOSMounts { - local mounts - - for mount in "${cos_mounts[@]}"; do - mounts+="${mount#*:}:${mount%%:*} " - done - mounts+="$(getOverlayMountpoints)" - echo -e "${mounts// /\\n}" | sort - -} - -function mountOverlayBase { - local fstab_line - - mkdir -p "${overlay_base}" - if [ "${cos_overlay%%:*}" = "tmpfs" ]; then - overlay_size="${cos_overlay#*:}" - mount -t tmpfs -o "defaults,size=${overlay_size}" tmpfs "${overlay_base}" - fstab_line="tmpfs ${overlay_base} tmpfs defaults,size=${overlay_size} 0 0\n" - elif [ "${cos_overlay%%:*}" = "block" ]; then - overlay_block="${cos_overlay#*:}" - mount -t auto "${overlay_block}" "${overlay_base}" - fstab_line="${overlay_block} ${overlay_base} auto defaults 0 0\n" - fi - echo "${fstab_line}" -} - -function mountOverlay { - local mount=$1 - local base=${2:-$overlay_base} - local merged - local upperdir - local workdir - local fstab_line - - mount="${mount#/}" - merged="/sysroot/${mount}" - if [ "${base##/run}" == "${base}" ]; then - base="/sysroot${base}" - fi - if ! mountpoint -q "${merged}"; then - upperdir="${base}/${mount//\//-}.overlay/upper" - workdir="${base}/${mount//\//-}.overlay/work" - mkdir -p "${merged}" "${upperdir}" "${workdir}" - if [ $? -ne 0 ]; then - >&2 echo "failed creating one of '${merged}', '${upperdir}' or '${workdir}'. Ignoring '${merged}' mount" - return - fi - mount -t overlay overlay -o "defaults,lowerdir=${merged},upperdir=${upperdir},workdir=${workdir}" "${merged}" - fstab_line="overlay /${mount} overlay defaults,lowerdir=/${mount},upperdir=${upperdir##/sysroot},workdir=${workdir##/sysroot}" - required_mount=$(findmnt -fno TARGET --target "${base}") - if [ -n "${required_mount}" ] && [ "${required_mount}" != "/" ]; then - fstab_line+=",x-systemd.requires-mounts-for=${required_mount##/sysroot}" - fi - fstab_line+="\n" - fi - echo "${fstab_line}" -} - -function mountState { - local mount=$1 - local base - local fstab_line - local state_dir - - if [ "${state_bind}" = "true" ]; then - mount="${mount#/}" - base="/sysroot/${mount}" - state_dir="/sysroot${state_target}/${mount//\//-}.bind" - if ! mountpoint -q "${base}"; then - mkdir -p "${base}" "${state_dir}" - if [ $? -ne 0 ]; then - >&2 echo "failed creating '${base}' or '${state_dir}'. Ignoring '${base}' mount" - return - fi - rsync -aqAX "${base}/" "${state_dir}/" - mount -o defaults,bind "${state_dir}" "${base}" - fstab_line="${state_dir##/sysroot} /${mount} none defaults,bind 0 0\n" - fi - else - fstab_line=$(mountOverlay "${mount}" "${state_target}") - fi - echo "${fstab_line}" -} - -function mountPersistent { - local mount=$1 - - if [ -e "${mount#*:}" ] && ! findmnt -rno SOURCE "${mount#*:}" > /dev/null; then - mount -t auto "${mount#*:}" "/sysroot${mount%%:*}" - else - echo "Warning: ${mount#*:} already mounted or device not found" >&2 - fi - echo "${mount#*:} ${mount%%:*} auto defaults 0 0\n" -} - -#====================================== -# Mount the rootfs layout -#-------------------------------------- - -PATH=/usr/sbin:/usr/bin:/sbin:/bin - -declare cos_mounts=${cos_mounts} -declare cos_overlay=${cos_overlay} -declare cos_root_perm=${cos_root_perm} -declare overlay_base="/run/overlay" -declare rw_paths=("/etc" "/root" "/home" "/opt" "/srv" "/usr/local" "/var") -declare etc_conf="/sysroot/etc/systemd/system/etc.mount.d" -declare cos_layout="/run/cos/cos-layout.env" -declare root_fstype=$(findmnt -rno FSTYPE /sysroot) -declare root=$(findmnt -rno SOURCE /sysroot) -declare fstab -declare state_label -declare state_paths -declare state_bind -declare state_target - -readCOSLayoutConfig - -[ -z "${cos_overlay}" ] && exit 0 - -# If sysroot is already an overlay do not prepare the rw overlay -if [ "${root_fstype}" != "overlay" ]; then - state_label=$(ls /tmp/cosloop-*) - state_label="${state_label##/tmp/cosloop-}" - if [ -f "/dev/disk/by-label/${state_label}" ]; then - fstab="/dev/disk/by-label/${state_label} /run/initramfs/cos-state auto ${cos_root_perm} 0 0\n" - fi - fstab+="${root} / auto ${cos_root_perm} 0 0\n" - fstab+=$(mountOverlayBase) -fi - -mountpoints=($(getCOSMounts)) - -for mount in "${mountpoints[@]}"; do - if [ "${mount#*:}" = "overlay" ]; then - if [ "${root_fstype}" != "overlay" ]; then - fstab+=$(mountOverlay "${mount%%:*}") - fi - else - # FSCK - systemd-fsck "${mount#*:}" - fstab+=$(mountPersistent "${mount}") - fi -done - -for mount in $(getStateMountpoints "${mountpoints[@]}"); do - fstab+=$(mountState "${mount}") -done - -echo -e "${fstab}" > /sysroot/etc/fstab - -if [ ! -f "${etc_conf}/override.conf" ]; then - mkdir -p "${etc_conf}" - { - echo "[Mount]" - echo "LazyUnmount=true" - } > "${etc_conf}/override.conf" -fi - -exit 0 diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-setup-initramfs.service b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-setup-initramfs.service deleted file mode 100644 index e0cccd146..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-setup-initramfs.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=cOS system initramfs setup before switch root -DefaultDependencies=no -After=initrd-fs.target -Requires=initrd-fs.target -Before=initrd.target - -[Service] -RootDirectory=/sysroot -BindPaths=/proc /sys /dev /run /tmp -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/elemental run-stage initramfs - -[Install] -RequiredBy=initrd.target diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-setup-rootfs.service b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-setup-rootfs.service deleted file mode 100644 index b464e58b6..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-setup-rootfs.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=cOS system early rootfs setup -DefaultDependencies=no -After=initrd-root-fs.target -Requires=initrd-root-fs.target -Conflicts=initrd-switch-root.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStartPre=/usr/bin/ln -sf -t / /sysroot/system -ExecStart=/usr/bin/elemental run-stage rootfs - -[Install] -RequiredBy=initrd-fs.target diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/module-setup.sh b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/module-setup.sh deleted file mode 100755 index 39e04f34f..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/module-setup.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# called by dracut -check() { - require_binaries "$systemdutildir"/systemd || return 1 - return 255 -} - -# called by dracut -depends() { - echo systemd rootfs-block dm fs-lib - return 0 -} - -# called by dracut -installkernel() { - instmods overlay -} - -# called by dracut -install() { - declare moddir=${moddir} - declare systemdutildir=${systemdutildir} - declare systemdsystemunitdir=${systemdsystemunitdir} - declare initdir="${initdir}" - - inst_multiple \ - mount mountpoint elemental sort findmnt rmdir findmnt rsync cut - - # Include utilities required for cos-setup services, - # probably a devoted cos-setup dracut module makes sense - inst_multiple -o \ - "$systemdutildir"/systemd-fsck partprobe sync udevadm lsblk sgdisk parted mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.vfat mkfs.fat mkfs.xfs blkid e2fsck resize2fs mount xfs_growfs umount basename - inst_hook cmdline 30 "${moddir}/parse-cos-cmdline.sh" - inst_script "${moddir}/cos-generator.sh" \ - "${systemdutildir}/system-generators/dracut-cos-generator" - inst_script "${moddir}/cos-mount-layout.sh" "/sbin/cos-mount-layout" - inst_script "${moddir}/cos-loop-img.sh" "/sbin/cos-loop-img" - inst_simple "${moddir}/cos-immutable-rootfs.service" \ - "${systemdsystemunitdir}/cos-immutable-rootfs.service" - inst_simple "${moddir}/cos-setup-initramfs.service" \ - "${systemdsystemunitdir}/cos-setup-initramfs.service" - inst_simple "${moddir}/cos-setup-rootfs.service" \ - "${systemdsystemunitdir}/cos-setup-rootfs.service" - mkdir -p "${initdir}/${systemdsystemunitdir}/initrd-fs.target.requires" - ln_r "../cos-immutable-rootfs.service" \ - "${systemdsystemunitdir}/initrd-fs.target.requires/cos-immutable-rootfs.service" - ln_r "$systemdutildir"/systemd-fsck \ - "/sbin/systemd-fsck" - ln_r "../cos-setup-rootfs.service" \ - "${systemdsystemunitdir}/initrd-fs.target.requires/cos-setup-rootfs.service" - mkdir -p "${initdir}/${systemdsystemunitdir}/initrd.target.requires" - ln_r "../cos-setup-initramfs.service" \ - "${systemdsystemunitdir}/initrd.target.requires/cos-setup-initramfs.service" - dracut_need_initqueue -} diff --git a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/parse-cos-cmdline.sh b/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/parse-cos-cmdline.sh deleted file mode 100755 index 0dd93970e..000000000 --- a/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/parse-cos-cmdline.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# immutable root is specified with -# rd.cos.mount=LABEL=: -# rd.cos.mount=UUID=: -# rd.cos.overlay=tmpfs: -# rd.cos.overlay=LABEL= -# rd.cos.overlay=UUID= -# rd.cos.oemtimeout= -# rd.cos.oemlabel= -# rd.cos.debugrw -# rd.cos.disable -# cos-img/filename=/cOS/active.img - -type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh - -if getargbool 0 rd.cos.disable; then - return 0 -fi - -cos_img=$(getarg cos-img/filename=) -[ -z "${cos_img}" ] && return 0 -[ -z "${root}" ] && root=$(getarg root=) - -cos_root_perm="ro" -if getargbool 0 rd.cos.debugrw; then - cos_root_perm="rw" -fi - -case "${root}" in - LABEL=*) \ - root="${root//\//\\x2f}" - root="/dev/disk/by-label/${root#LABEL=}" - rootok=1 ;; - UUID=*) \ - root="/dev/disk/by-uuid/${root#UUID=}" - rootok=1 ;; - /dev/*) \ - root="${root}" - rootok=1 ;; -esac - -[ "${rootok}" != "1" ] && return 0 - -info "root device set to root=${root}" - -wait_for_dev -n "${root}" -/sbin/initqueue --settled --unique /sbin/cos-loop-img "${cos_img}" - -return 0 diff --git a/packages/system/dracut/immutable-rootfs/LICENSE b/packages/system/dracut/immutable-rootfs/LICENSE deleted file mode 100644 index 68428665e..000000000 --- a/packages/system/dracut/immutable-rootfs/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -This package is a fork of the immutable-rootfs package in rancher/elemental-toolkit. - -Copyright (c) 2020-2021 SUSE, LLC -Copyright (c) 2022 Kairos - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/system/dracut/immutable-rootfs/README.md b/packages/system/dracut/immutable-rootfs/README.md deleted file mode 100644 index c7ad6cf81..000000000 --- a/packages/system/dracut/immutable-rootfs/README.md +++ /dev/null @@ -1,139 +0,0 @@ -This package ships the `immutable-rootfs` dracut module responsible of mounting the root tree during -boot time with the immutable specific setup. The immutability concept refers -to read only root (`/`) system. To ensure the linux OS is still functional -certain paths or areas are required to be writable, in those cases an -ephemeral overaly tmpfs is set in place. Additionaly, the immutable rootfs -module can also mount a custom list of device blocks with read write -permissions, those are mostly devoted to store persistent data. - -The dracut module is mostly configured via kernel command line parameters or -via the `/run/cos/cos-layout.env` environment file. - -These are the read write paths the module mounts as part of the overlay -ephemeral tmpfs: `/etc`, `/root`, `/home`, `/opt`, `/srv`, `/usr/local` -and `/var`. - -These paths will be all ephemeral unless there is a block device configured -to be mounted in the same path. - -It is important to remark all the immutable root configuration is applied -in initrd before switching root and after `rootfs` cloud-init stage but -before `initramfs` stage. So immutable rootfs configuration via cloud-init -using the `/run/cos/cos-layout.env` file is only effective if called in any -of the `rootfs.before`, `rootfs` or `rootfs.after` cloud-init stages. - -## Kernel configuraton paramters - -The immutable rootfs can be configured witht he following kernel parameters: - -* `cos-img/filename=`: This is one of the main parameters, it defines - the location of the image file to boot from. - -* `rd.cos.overlay=tmpfs:`: This defines the size of the tmpfs used for - the ephemeral overlayfs. It can be expressed in MiB or as a % of the available - memory. Defaults to `rd.cos.overlay=tmpfs:20%` if not present. - -* `rd.cos.overlay=LABEL=`: Optionally and mostly for debugging - purposes the overlayfs can be mounted on top of a persistent block device. - Block devices can be expressed by LABEL (`LABEL=`) or by UUID - (`UUID=`) - -* `rd.cos.mount=LABEL::`: This option defines a - persistent block device and its mountpoint. Block devices can also be - defined by UUID (`UUID=:`). This option can be passed - multiple times. - -* `rd.cos.oemtimeout=`: cOS by default assumes the existence of a - persistent block device labelled `COS_OEM` which is used to keep some - configuration data (mostly cloud-init files). The immutable rootfs tries - to mount this device at very early stages of the boot even before applying - the immutable rootfs configs. It done this way to enable to configure the - immutable rootfs module within the cloud-init files. As the `COS_OEM` device - might not be always present the boot process just continues without failing - after a certain timeout. This option configures such a timeout. Defaults to - 10s. - -* `rd.cos.debugrw`: This is a boolean option, true if present, false if not. - This option sets the root image to be mounted as a writable device. Note this - completely breaks the concept of an immutable root. This is helpful for - debugging or testing purposes, so changes persist across reboots. - -* `rd.cos.disable`: This is a boolean option, true if present, false if not. - It disables the execution of any immutable rootfs module logic at boot. - -### Configuration with an environment file - -The immutable rootfs can be configured with the `/run/cos/cos-layout.env` -environment file. It is important to note that all the immutable root -configuration is applied in initrd before switching root and after -`rootfs` cloud-init stage but before `initramfs` stage. So immutable rootfs -configuration via cloud-init using the `/run/cos/cos-layout.env` file is -only effective if called in any of the `rootfs.before`, `rootfs` or -`rootfs.after` cloud-init stages. - - -In the environment file few options are available: - - -* `VOLUMES=LABEL=:`: This variable expects a block device - and it mountpoint pair space separated list. The default cOS configuration is: - - `VOLUMES="LABEL=COS_OEM:/oem LABEL=COS_PERSISTENT:/usr/local"` - -* `OVERLAY`: It defines the underlaying device for the overlayfs as in - `rd.cos.overlay=` kernel parameter. - -* `DEBUGRW=true`: Sets the root (`/`) to be mounted with read/write permissions. - -* `MERGE=true`: Sets makes the `VOLUMES` values to be merged with any other - volume that might have been defined in the kernel command line. The merging - criteria is simple: any overlapping volume is overwritten all others are - appended to whatever was already defined as a kernel parameter. If not - defined defaults to `true`. - -* `RW_PATHS`: This is a space separated list of paths. These are the paths - that will be used for the ephemeral overlayfs. These are the paths that - will be mounted as overlay on top of the `OVERLAY` (or `rd.cos.overlay`) - device. Default value is: - - `RW_PATHS="/etc /root /home /opt /srv /usr/local /var"` - **Note**: as those paths are overlayed with an ephemeral mount (`tmpfs`), - additional data wrote on those location won't be available on subsequent boots. - -* `PERSISTENT_STATE_TARGET`: This is the folder where the persistent state data - will be stored, if any. Default value is `/usr/local/.state`. - -* `PERSISTENT_STATE_PATHS`: This is a space separated list of paths. These are - the paths that will become writable and store its data inside - `PERSISTENT_STATE_TARGET`. By default this variable is empty, which means - no persistent state area is created or used. - - **Note**: The specified paths needs either to exist or be located in an area - which is writeable ( for example, inside locations specified with `RW_PATHS`). - The dracut module will attempt to create non-existant directories, - but might fail if the mountpoint where are located is read-only. - -* `PERSISTENT_STATE_BIND="true|false"`: When this variable is set to true - the persistent state paths are bind mounted (instead of using overlayfs) - after being mirrored with the original content. By default this variable is - set to `false`. - -Note that persistent state are is setup once the ephemeral paths and persistent -volumes are mounted. Persistent state paths can't be an already existing mount -point. If the persistent state requires any of the paths that are part of the -ephemeral area by default, then `RW_PATHS` needs to be defined to avoid -overlapping paths. - -For exmaple a common cOS configuration can be expressed as part of the -cloud-init configuration as follows: - -```yaml -name: example -stage: - rootfs: - - name: "Layout configuration" - environment_file: /run/cos/cos-layout.env - environment: - VOLUMES: "LABEL=COS_OEM:/oem LABEL=COS_PERSISTENT:/usr/local" - OVERLAY: "tmpfs:25%" -``` diff --git a/packages/system/dracut/immutable-rootfs/build.yaml b/packages/system/dracut/immutable-rootfs/build.yaml deleted file mode 100644 index ef55c3660..000000000 --- a/packages/system/dracut/immutable-rootfs/build.yaml +++ /dev/null @@ -1,10 +0,0 @@ -image: alpine -package_dir: "/package" -steps: -- mkdir -p /package/etc/systemd/system -- mkdir -p /package/etc/dracut.conf.d -- cp -rf tmp.mount /package/etc/systemd/system -- mkdir -p /package/usr/lib/dracut/modules.d -- cp -r 30cos-immutable-rootfs /package/usr/lib/dracut/modules.d -- cp -rfv conf/* /package/etc/dracut.conf.d -- cp -rfv 30cos-immutable-rootfs/cos-setup-*.service /package/etc/systemd/system diff --git a/packages/system/dracut/immutable-rootfs/conf/02-cos-immutable-rootfs.conf b/packages/system/dracut/immutable-rootfs/conf/02-cos-immutable-rootfs.conf deleted file mode 100644 index 67271e31a..000000000 --- a/packages/system/dracut/immutable-rootfs/conf/02-cos-immutable-rootfs.conf +++ /dev/null @@ -1 +0,0 @@ -add_dracutmodules+=" cos-immutable-rootfs " diff --git a/packages/system/dracut/immutable-rootfs/conf/02-cos-setup-initramfs.conf b/packages/system/dracut/immutable-rootfs/conf/02-cos-setup-initramfs.conf deleted file mode 100644 index daa6e3392..000000000 --- a/packages/system/dracut/immutable-rootfs/conf/02-cos-setup-initramfs.conf +++ /dev/null @@ -1,2 +0,0 @@ -install_items+=" /etc/hosts " -add_dracutmodules+=" network " diff --git a/packages/system/dracut/immutable-rootfs/conf/50-cos-initrd.conf b/packages/system/dracut/immutable-rootfs/conf/50-cos-initrd.conf deleted file mode 100644 index 81894b7ad..000000000 --- a/packages/system/dracut/immutable-rootfs/conf/50-cos-initrd.conf +++ /dev/null @@ -1,5 +0,0 @@ -hostonly_cmdline="no" -hostonly="no" -compress="xz" -omit_dracutmodules+=" multipath " -add_dracutmodules+=" livenet dmsquash-live " diff --git a/packages/system/dracut/immutable-rootfs/definition.yaml b/packages/system/dracut/immutable-rootfs/definition.yaml deleted file mode 100644 index b09abbc2a..000000000 --- a/packages/system/dracut/immutable-rootfs/definition.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "immutable-rootfs" -category: "dracut" -version: "0.10" diff --git a/packages/system/dracut/immutable-rootfs/tmp.mount b/packages/system/dracut/immutable-rootfs/tmp.mount deleted file mode 100644 index 7c2e58c19..000000000 --- a/packages/system/dracut/immutable-rootfs/tmp.mount +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Temporary Directory /tmp -Documentation=https://systemd.io/TEMPORARY_DIRECTORIES -Documentation=man:file-hierarchy(7) -Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems -ConditionPathIsSymbolicLink=!/tmp -DefaultDependencies=no -Conflicts=umount.target -Before=local-fs.target umount.target -After=swap.target - -[Mount] -What=tmpfs -Where=/tmp -Type=tmpfs -Options=mode=1777,strictatime,nosuid,nodev,size=50%%,nr_inodes=1m \ No newline at end of file diff --git a/packages/system/dracut/kcrypt/build.yaml b/packages/system/dracut/kcrypt/build.yaml deleted file mode 100644 index 0c36dd62b..000000000 --- a/packages/system/dracut/kcrypt/build.yaml +++ /dev/null @@ -1,18 +0,0 @@ -image: "alpine" - -prelude: -- apk add git -- | - PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && \ - git clone https://github.com/${GITHUB_ORG}/{{ .Values.name }}.git && cd {{.Values.name}} && git checkout v"${PACKAGE_VERSION}" - -steps: -- mkdir -p /package/usr/lib/dracut/modules.d -- mkdir -p /package/etc/dracut.conf.d/ -- cp -r {{.Values.name}}/dracut/29kcrypt /package/usr/lib/dracut/modules.d/29kcrypt -- cp {{.Values.name}}/dracut/*.conf /package/etc/dracut.conf.d/ - -env: -- GITHUB_ORG={{ ( index .Values.labels "github.owner" ) }} - -package_dir: "/package" \ No newline at end of file diff --git a/packages/system/dracut/kcrypt/definition.yaml b/packages/system/dracut/kcrypt/definition.yaml deleted file mode 100644 index 51edf7be3..000000000 --- a/packages/system/dracut/kcrypt/definition.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: kcrypt -category: dracut -version: "0.7.0" -labels: - github.repo: "kcrypt" - github.owner: "kairos-io" -uri: - - https://github.com/kairos-io/kcrypt -license: "Apache License v2" -description: "Dracut module for kcrypt" diff --git a/packages/system/dracut/network/build.yaml b/packages/system/dracut/network/build.yaml deleted file mode 100644 index a04f31e79..000000000 --- a/packages/system/dracut/network/build.yaml +++ /dev/null @@ -1,5 +0,0 @@ -image: alpine -package_dir: "/{{.Values.category}}{{.Values.name}}" -steps: -- mkdir -p /{{.Values.category}}{{.Values.name}}/etc/dracut.conf.d -- cp -rfv conf/* /{{.Values.category}}{{.Values.name}}/etc/dracut.conf.d diff --git a/packages/system/dracut/network/conf/90-kairos-network.conf b/packages/system/dracut/network/conf/90-kairos-network.conf deleted file mode 100644 index f60ca866d..000000000 --- a/packages/system/dracut/network/conf/90-kairos-network.conf +++ /dev/null @@ -1,2 +0,0 @@ -install_items+=" /etc/systemd/network/20-dhcp.network /etc/systemd/network/20-dhcp-legacy.network " -add_dracutmodules+=" systemd-networkd " diff --git a/packages/system/dracut/network/definition.yaml b/packages/system/dracut/network/definition.yaml deleted file mode 100644 index 7895a6092..000000000 --- a/packages/system/dracut/network/definition.yaml +++ /dev/null @@ -1,8 +0,0 @@ -name: "network" -category: "dracut" -version: "0.13" -# System files shipped separately as consumed by both dracut and user-space -requires: -- name: "network" - category: "systemd-default" - version: ">=0" diff --git a/packages/system/dracut/systemd-resolved/build.yaml b/packages/system/dracut/systemd-resolved/build.yaml deleted file mode 100644 index 1b4e067a3..000000000 --- a/packages/system/dracut/systemd-resolved/build.yaml +++ /dev/null @@ -1,5 +0,0 @@ -image: alpine -package_dir: "/package" -steps: -- mkdir -p /package/etc/dracut.conf.d -- cp -rfv conf/* /package/etc/dracut.conf.d \ No newline at end of file diff --git a/packages/system/dracut/systemd-resolved/conf/90-kairos-resolved.conf b/packages/system/dracut/systemd-resolved/conf/90-kairos-resolved.conf deleted file mode 100644 index f19cc82b8..000000000 --- a/packages/system/dracut/systemd-resolved/conf/90-kairos-resolved.conf +++ /dev/null @@ -1 +0,0 @@ -add_dracutmodules+=" systemd-resolved " diff --git a/packages/system/dracut/systemd-resolved/definition.yaml b/packages/system/dracut/systemd-resolved/definition.yaml deleted file mode 100644 index e80a0bf7f..000000000 --- a/packages/system/dracut/systemd-resolved/definition.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "systemd-resolved" -category: "dracut" -version: "0.10" diff --git a/packages/system/elemental/build.yaml b/packages/system/elemental/build.yaml deleted file mode 100644 index 23d13b8af..000000000 --- a/packages/system/elemental/build.yaml +++ /dev/null @@ -1,20 +0,0 @@ -requires: -- name: "toolchain-go" - category: "development" - version: ">=0" -env: -- PATH=$PATH:/usr/local/go/bin -- CGO_ENABLED=0 -- REPO={{( index .Values.labels "github.repo" )}} - -prelude: -- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && git clone --branch v"${PACKAGE_VERSION}" https://github.com/{{( index .Values.labels "github.owner" )}}/$REPO - -steps: - - | - cd $REPO && GIT_COMMIT=$(git rev-parse HEAD) && \ - go build -o bin/{{.Values.bin_name}} -ldflags "-s -w -X 'github.com/rancher/elemental-cli/internal/version.version=v${PACKAGE_VERSION}' -X 'github.com/rancher/elemental-cli/internal/version.gitCommit=${GIT_COMMIT}'" && \ - mv bin/{{.Values.bin_name}} /usr/bin/{{.Values.bin_name}} - -includes: - - /usr/bin/{{.Values.bin_name}} \ No newline at end of file diff --git a/packages/system/elemental/definition.yaml b/packages/system/elemental/definition.yaml deleted file mode 100644 index e5f9aace5..000000000 --- a/packages/system/elemental/definition.yaml +++ /dev/null @@ -1,8 +0,0 @@ -name: "elemental-cli" -category: "system" -version: "0.3.1" -bin_name: "elemental" -fips: false -labels: - github.repo: "elemental-cli" - github.owner: "kairos-io" diff --git a/packages/system/init-svc/systemd-defaults/network/build.yaml b/packages/system/init-svc/systemd-defaults/network/build.yaml deleted file mode 100644 index ad9ff6c2c..000000000 --- a/packages/system/init-svc/systemd-defaults/network/build.yaml +++ /dev/null @@ -1,5 +0,0 @@ -image: alpine -package_dir: "/package" -steps: -- mkdir -p /package/etc/systemd/network -- cp -rfv network/* /package/etc/systemd/network diff --git a/packages/system/init-svc/systemd-defaults/network/definition.yaml b/packages/system/init-svc/systemd-defaults/network/definition.yaml deleted file mode 100644 index 0689218eb..000000000 --- a/packages/system/init-svc/systemd-defaults/network/definition.yaml +++ /dev/null @@ -1,3 +0,0 @@ -name: "network" -category: "systemd-default" -version: "1.0" \ No newline at end of file diff --git a/packages/system/init-svc/systemd/build.yaml b/packages/system/init-svc/systemd/build.yaml index bcf3ec214..78eae2a2e 100644 --- a/packages/system/init-svc/systemd/build.yaml +++ b/packages/system/init-svc/systemd/build.yaml @@ -1,5 +1,6 @@ image: "alpine" steps: - mkdir -p /etc/systemd/system -- cp -rfv *.service /etc/systemd/system -- cp -rfv *.timer /etc/systemd/system +- mkdir -p /etc/systemd/network +- cp -rfv services/* /etc/systemd/system +- cp -rfv network/* /etc/systemd/network diff --git a/packages/system/init-svc/systemd/definition.yaml b/packages/system/init-svc/systemd/definition.yaml index 2c6e345b2..a65bafb29 100644 --- a/packages/system/init-svc/systemd/definition.yaml +++ b/packages/system/init-svc/systemd/definition.yaml @@ -1,3 +1,3 @@ name: systemd category: init-svc -version: 0.8.0 +version: 0.9.0 diff --git a/packages/system/init-svc/systemd-defaults/network/network/20-dhcp-legacy.network b/packages/system/init-svc/systemd/network/20-dhcp-legacy.network similarity index 100% rename from packages/system/init-svc/systemd-defaults/network/network/20-dhcp-legacy.network rename to packages/system/init-svc/systemd/network/20-dhcp-legacy.network diff --git a/packages/system/init-svc/systemd-defaults/network/network/20-dhcp.network b/packages/system/init-svc/systemd/network/20-dhcp.network similarity index 100% rename from packages/system/init-svc/systemd-defaults/network/network/20-dhcp.network rename to packages/system/init-svc/systemd/network/20-dhcp.network diff --git a/packages/system/init-svc/systemd/cos-setup-boot.service b/packages/system/init-svc/systemd/services/cos-setup-boot.service similarity index 100% rename from packages/system/init-svc/systemd/cos-setup-boot.service rename to packages/system/init-svc/systemd/services/cos-setup-boot.service diff --git a/packages/system/init-svc/systemd/cos-setup-fs.service b/packages/system/init-svc/systemd/services/cos-setup-fs.service similarity index 100% rename from packages/system/init-svc/systemd/cos-setup-fs.service rename to packages/system/init-svc/systemd/services/cos-setup-fs.service diff --git a/packages/system/init-svc/systemd/cos-setup-network.service b/packages/system/init-svc/systemd/services/cos-setup-network.service similarity index 100% rename from packages/system/init-svc/systemd/cos-setup-network.service rename to packages/system/init-svc/systemd/services/cos-setup-network.service diff --git a/packages/system/init-svc/systemd/cos-setup-reconcile.service b/packages/system/init-svc/systemd/services/cos-setup-reconcile.service similarity index 100% rename from packages/system/init-svc/systemd/cos-setup-reconcile.service rename to packages/system/init-svc/systemd/services/cos-setup-reconcile.service diff --git a/packages/system/init-svc/systemd/cos-setup-reconcile.timer b/packages/system/init-svc/systemd/services/cos-setup-reconcile.timer similarity index 100% rename from packages/system/init-svc/systemd/cos-setup-reconcile.timer rename to packages/system/init-svc/systemd/services/cos-setup-reconcile.timer diff --git a/packages/system/shim/build.yaml b/packages/system/shim/build.yaml deleted file mode 100644 index b5f169dcb..000000000 --- a/packages/system/shim/build.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# This is only for amd64 -{{ if .Values.arch }} - {{ if eq .Values.arch "amd64" }} -image: registry.opensuse.org/opensuse/leap:15.3 - -prelude: -- zypper ref -steps: -- zypper in -y shim - -includes: -- usr/share/efi/.*/*.efi -excludes: -# This is shipped by system/grub2-efi -- usr/share/efi/.*/grub.efi - {{end}} -{{end}} \ No newline at end of file diff --git a/packages/system/shim/definition.yaml b/packages/system/shim/definition.yaml deleted file mode 100644 index b0cb9763b..000000000 --- a/packages/system/shim/definition.yaml +++ /dev/null @@ -1,4 +0,0 @@ -name: "shim" -category: "system" -version: "2.06-150401" -license: "GPL-3.0-or-later"