mirror of
https://github.com/kairos-io/packages.git
synced 2025-08-03 01:05:38 +00:00
Add and enable openrc/systemd service via yip files (#505)
This commit is contained in:
parent
9e8d950515
commit
c6ec9b53d9
@ -1,7 +1,7 @@
|
|||||||
packages:
|
packages:
|
||||||
- name: "alpine"
|
- name: "alpine"
|
||||||
category: "initrd"
|
category: "initrd"
|
||||||
version: "3.8.1+1"
|
version: "3.8.1+2"
|
||||||
description: "Provides custom initrd scripts for alpine"
|
description: "Provides custom initrd scripts for alpine"
|
||||||
# This syncs with the alpine version at https://gitlab.alpinelinux.org/alpine/mkinitfs/-/blob/master/initramfs-init.in?ref_type=heads
|
# This syncs with the alpine version at https://gitlab.alpinelinux.org/alpine/mkinitfs/-/blob/master/initramfs-init.in?ref_type=heads
|
||||||
# any changes to the initramfs-init.in file should be looked at and backported if necessary
|
# any changes to the initramfs-init.in file should be looked at and backported if necessary
|
@ -435,11 +435,13 @@ if grep -q cdroot /proc/cmdline || grep -q netboot /proc/cmdline;then
|
|||||||
mount -t overlay -o lowerdir=/run/rootfsbase,upperdir=/media/root-rw/root,workdir=/media/root-rw/work overlayfs $sysroot
|
mount -t overlay -o lowerdir=/run/rootfsbase,upperdir=/media/root-rw/root,workdir=/media/root-rw/work overlayfs $sysroot
|
||||||
eend $?
|
eend $?
|
||||||
sync
|
sync
|
||||||
|
rd_break pre-immucore
|
||||||
# immucore to run the initramfs and rootfs stages
|
# immucore to run the initramfs and rootfs stages
|
||||||
ebegin "Run immucore"
|
ebegin "Run immucore"
|
||||||
immucore
|
immucore
|
||||||
eend $?
|
eend $?
|
||||||
# Move current mounts into sysroot mounts
|
rd_break post-immucore
|
||||||
|
# Move current mounts into sysroot mounts
|
||||||
# shellcheck disable=SC2002
|
# shellcheck disable=SC2002
|
||||||
cat "$ROOT"/proc/mounts 2>/dev/null | while read DEV DIR TYPE OPTS ; do
|
cat "$ROOT"/proc/mounts 2>/dev/null | while read DEV DIR TYPE OPTS ; do
|
||||||
# shellcheck disable=SC2166
|
# shellcheck disable=SC2166
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
packages:
|
packages:
|
||||||
- name: "kairos-overlay-files"
|
- name: "kairos-overlay-files"
|
||||||
category: "static"
|
category: "static"
|
||||||
version: "1.1.6"
|
version: "1.1.7"
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
/dev/null
|
@ -1,10 +1,61 @@
|
|||||||
name: "Create openrc services"
|
name: "Create openrc services"
|
||||||
stages:
|
stages:
|
||||||
initramfs:
|
initramfs:
|
||||||
- name: "Create files"
|
- name: "Create OpenRC services"
|
||||||
if: |
|
if: |
|
||||||
grep -i alpine "/etc/os-release"
|
[ -f "/sbin/openrc" ]
|
||||||
files:
|
files:
|
||||||
|
- path: /etc/init.d/cos-setup-boot
|
||||||
|
permissions: 0755
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
provide cos-setup-boot
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
kairos-agent run-stage boot
|
||||||
|
eend 0
|
||||||
|
}
|
||||||
|
- path: /etc/init.d/cos-setup-network
|
||||||
|
permissions: 0755
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after net
|
||||||
|
provide cos-setup-network
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
kairos-agent run-stage network
|
||||||
|
eend 0
|
||||||
|
}
|
||||||
|
- path: /etc/init.d/cos-setup-reconcile
|
||||||
|
permissions: 0755
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
provide cos-setup-reconcile
|
||||||
|
}
|
||||||
|
|
||||||
|
supervisor=supervise-daemon
|
||||||
|
name="cos-setup-reconcile"
|
||||||
|
command="cos-setup-reconcile"
|
||||||
|
supervise_daemon_args="--stdout /var/log/cos-setup-reconcile.log --stderr /var/log/cos-setup-reconcile.log"
|
||||||
|
pidfile="/run/cos-setup-reconcile.pid"
|
||||||
|
respawn_delay=360
|
||||||
|
set -o allexport
|
||||||
|
if [ -f /etc/environment ]; then source /etc/environment; fi
|
||||||
|
set +o allexport
|
||||||
- path: /etc/init.d/kairos-agent
|
- path: /etc/init.d/kairos-agent
|
||||||
content: |
|
content: |
|
||||||
#!/sbin/openrc-run
|
#!/sbin/openrc-run
|
||||||
@ -45,7 +96,6 @@ stages:
|
|||||||
set -o allexport
|
set -o allexport
|
||||||
if [ -f /etc/environment ]; then source /etc/environment; fi
|
if [ -f /etc/environment ]; then source /etc/environment; fi
|
||||||
set +o allexport
|
set +o allexport
|
||||||
|
|
||||||
permissions: 0755
|
permissions: 0755
|
||||||
owner: 0
|
owner: 0
|
||||||
group: 0
|
group: 0
|
||||||
@ -66,3 +116,12 @@ stages:
|
|||||||
permissions: 0755
|
permissions: 0755
|
||||||
owner: 0
|
owner: 0
|
||||||
group: 0
|
group: 0
|
||||||
|
- name: "Enable OpenRC services"
|
||||||
|
if: |
|
||||||
|
[ -f "/sbin/openrc" ]
|
||||||
|
commands:
|
||||||
|
- mkdir -p /etc/runlevels/default
|
||||||
|
- ln -sf ../../init.d/cos-setup-boot /etc/runlevels/default/cos-setup-boot
|
||||||
|
- ln -sf ../../init.d/cos-setup-network /etc/runlevels/default/cos-setup-network
|
||||||
|
- ln -sf ../../init.d/cos-setup-reconcile /etc/runlevels/default/cos-setup-reconcile
|
||||||
|
- ln -sf ../../init.d/kairos-agent /etc/runlevels/default/kairos-agent
|
@ -1,33 +0,0 @@
|
|||||||
# Rootfs Kairos OEM configuration file
|
|
||||||
#
|
|
||||||
# This file is part of Kairos and will get reset during upgrades.
|
|
||||||
|
|
||||||
name: "Default config"
|
|
||||||
stages:
|
|
||||||
boot:
|
|
||||||
- name: "Default sysctl settings"
|
|
||||||
sysctl:
|
|
||||||
net.core.rmem_max: 2500000
|
|
||||||
vm.max_map_count: 262144
|
|
||||||
initramfs:
|
|
||||||
- name: "Default systemd config"
|
|
||||||
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
|
|
||||||
systemctl:
|
|
||||||
enable:
|
|
||||||
- multi-user.target
|
|
||||||
- getty@tty1
|
|
||||||
- iscsid
|
|
||||||
- systemd-timesyncd
|
|
||||||
- nohang
|
|
||||||
- nohang-desktop
|
|
||||||
- fail2ban
|
|
||||||
- logrotate.timer
|
|
||||||
- sshd
|
|
||||||
mask:
|
|
||||||
- purge-kernels
|
|
||||||
commands:
|
|
||||||
- systemctl set-default multi-user.target
|
|
||||||
- name: "Generate host keys"
|
|
||||||
# Make sure the host always has available keys
|
|
||||||
commands:
|
|
||||||
- ssh-keygen -A
|
|
@ -0,0 +1,129 @@
|
|||||||
|
# Rootfs Kairos OEM configuration file
|
||||||
|
#
|
||||||
|
# This file is part of Kairos and will get reset during upgrades.
|
||||||
|
|
||||||
|
name: "Default config"
|
||||||
|
stages:
|
||||||
|
boot:
|
||||||
|
- name: "Default sysctl settings"
|
||||||
|
sysctl:
|
||||||
|
net.core.rmem_max: 2500000
|
||||||
|
vm.max_map_count: 262144
|
||||||
|
initramfs:
|
||||||
|
- name: "Default systemd config"
|
||||||
|
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
|
||||||
|
systemctl:
|
||||||
|
enable:
|
||||||
|
- multi-user.target
|
||||||
|
- getty@tty1
|
||||||
|
- iscsid
|
||||||
|
- systemd-timesyncd
|
||||||
|
- nohang
|
||||||
|
- nohang-desktop
|
||||||
|
- fail2ban
|
||||||
|
- logrotate.timer
|
||||||
|
- sshd
|
||||||
|
mask:
|
||||||
|
- purge-kernels
|
||||||
|
commands:
|
||||||
|
- systemctl set-default multi-user.target
|
||||||
|
- name: "Generate host keys"
|
||||||
|
# Make sure the host always has available keys
|
||||||
|
commands:
|
||||||
|
- ssh-keygen -A
|
||||||
|
- name: "Create systemd services"
|
||||||
|
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
|
||||||
|
files:
|
||||||
|
- path: /etc/systemd/system/cos-setup-boot.service
|
||||||
|
permissions: 0644
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=cOS system configuration
|
||||||
|
Before=getty.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/kairos-agent run-stage boot
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
- path: /etc/systemd/system/cos-setup-fs.service
|
||||||
|
permissions: 0644
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=cOS system after FS setup
|
||||||
|
DefaultDependencies=no
|
||||||
|
After=local-fs.target
|
||||||
|
Wants=local-fs.target
|
||||||
|
Before=sysinit.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/kairos-agent run-stage fs
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
||||||
|
- path: /etc/systemd/system/cos-setup-network.service
|
||||||
|
permissions: 0644
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=cOS setup after network
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/kairos-agent run-stage network
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
- path: /etc/systemd/system/cos-setup-reconcile.service
|
||||||
|
permissions: 0644
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=cOS setup reconciler
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Nice=19
|
||||||
|
IOSchedulingClass=2
|
||||||
|
IOSchedulingPriority=7
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/bin/bash -c "systemd-inhibit /usr/bin/kairos-agent run-stage reconcile"
|
||||||
|
TimeoutStopSec=180
|
||||||
|
KillMode=process
|
||||||
|
KillSignal=SIGINT
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
- path: /etc/systemd/system/cos-setup-reconcile.timer
|
||||||
|
permissions: 0644
|
||||||
|
owner: 0
|
||||||
|
group: 0
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=cOS setup reconciler
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=5min
|
||||||
|
OnUnitActiveSec=60min
|
||||||
|
Unit=cos-setup-reconcile.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
- name: "Enable systemd services"
|
||||||
|
if: '[ -e "/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ] || [ -e "/usr/sbin/systemctl" ] || [ -e "/usr/bin/systemctl" ]'
|
||||||
|
commands:
|
||||||
|
- ln -sf /etc/systemd/system/cos-setup-reconcile.timer /etc/systemd/system/multi-user.target.wants/cos-setup-reconcile.timer
|
||||||
|
- ln -sf /etc/systemd/system/cos-setup-fs.service /etc/systemd/system/sysinit.target.wants/cos-setup-fs.service
|
||||||
|
- ln -sf /etc/systemd/system/cos-setup-boot.service /etc/systemd/system/multi-user.target.wants/cos-setup-boot.service
|
||||||
|
- ln -sf /etc/systemd/system/cos-setup-network.service /etc/systemd/system/multi-user.target.wants/cos-setup-network.service
|
@ -1,6 +0,0 @@
|
|||||||
image: "alpine"
|
|
||||||
package_dir: "/package"
|
|
||||||
steps:
|
|
||||||
- mkdir /package
|
|
||||||
- cp -rfv files/* /package
|
|
||||||
- chmod +x /package/usr/bin/cos-setup-reconcile
|
|
@ -1,4 +0,0 @@
|
|||||||
name: openrc
|
|
||||||
category: init-svc
|
|
||||||
version: 0.3.0
|
|
||||||
description: "Experimental package for openrc support"
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
provide cos-setup-boot
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
kairos-agent run-stage boot
|
|
||||||
eend 0
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
after net
|
|
||||||
provide cos-setup-network
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
kairos-agent run-stage network
|
|
||||||
eend 0
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
provide cos-setup-reconcile
|
|
||||||
}
|
|
||||||
|
|
||||||
supervisor=supervise-daemon
|
|
||||||
name="cos-setup-reconcile"
|
|
||||||
command="cos-setup-reconcile"
|
|
||||||
supervise_daemon_args="--stdout /var/log/cos-setup-reconcile.log --stderr /var/log/cos-setup-reconcile.log"
|
|
||||||
pidfile="/run/cos-setup-reconcile.pid"
|
|
||||||
respawn_delay=5
|
|
||||||
set -o allexport
|
|
||||||
if [ -f /etc/environment ]; then source /etc/environment; fi
|
|
||||||
set +o allexport
|
|
@ -1,6 +0,0 @@
|
|||||||
image: "alpine"
|
|
||||||
steps:
|
|
||||||
- mkdir -p /etc/systemd/system
|
|
||||||
- mkdir -p /etc/systemd/network
|
|
||||||
- cp -rfv services/* /etc/systemd/system
|
|
||||||
- cp -rfv network/* /etc/systemd/network
|
|
@ -1,3 +0,0 @@
|
|||||||
name: systemd
|
|
||||||
category: init-svc
|
|
||||||
version: 0.9.0
|
|
@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=cOS system configuration
|
|
||||||
Before=getty.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/bin/kairos-agent run-stage boot
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,14 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=cOS system after FS setup
|
|
||||||
DefaultDependencies=no
|
|
||||||
After=local-fs.target
|
|
||||||
Wants=local-fs.target
|
|
||||||
Before=sysinit.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/bin/kairos-agent run-stage fs
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sysinit.target
|
|
@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=cOS setup after network
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/bin/kairos-agent run-stage network
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,15 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=cOS setup reconciler
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Nice=19
|
|
||||||
IOSchedulingClass=2
|
|
||||||
IOSchedulingPriority=7
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/bin/bash -c "systemd-inhibit /usr/bin/kairos-agent run-stage reconcile"
|
|
||||||
TimeoutStopSec=180
|
|
||||||
KillMode=process
|
|
||||||
KillSignal=SIGINT
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=cOS setup reconciler
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=5min
|
|
||||||
OnUnitActiveSec=60min
|
|
||||||
Unit=cos-setup-reconcile.service
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
Loading…
Reference in New Issue
Block a user