Skip to content

Commit faf5fb9

Browse files
committed
testing: Add gentoo
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
1 parent 3464888 commit faf5fb9

File tree

5 files changed

+360
-68
lines changed

5 files changed

+360
-68
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,76 +10,13 @@ on:
1010
schedule:
1111
- cron: "0 0 * * MON"
1212
jobs:
13-
verify:
14-
name: "Verify"
15-
runs-on: ubuntu-24.04
16-
steps:
17-
- name: "Checkout Repository"
18-
uses: actions/checkout@v4
19-
20-
- name: "Checkout Submodules"
21-
run: |
22-
git submodule set-url external/busybox/upstream https://github.com/mirror/busybox
23-
git submodule update --init --recursive
24-
25-
- name: "Setup host"
26-
run: |
27-
sudo sysctl -w kernel.unprivileged_userns_clone=1 ||:
28-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 ||:
29-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 ||:
30-
31-
- name: "Install Tools"
32-
run: |
33-
sudo apt-get -qq -y update
34-
sudo apt-get -y -qq install \
35-
gcc make automake autoconf pkg-config udev scdoc \
36-
libkmod-dev libz-dev libbz2-dev liblzma-dev libzstd-dev libelf-dev libtirpc-dev libcrypt-dev
37-
sudo apt-get -y -qq install astyle
38-
sudo apt-get -y -qq install shellcheck
39-
40-
- name: "Configure"
41-
run: |
42-
./autogen.sh
43-
./configure --enable-local-build
44-
45-
- name: "Build Sources"
46-
run: |
47-
make
48-
49-
- name: "Prepare Gittree"
50-
run: |
51-
git config --global user.email "ci@example.com"
52-
git config --global user.name "GitHubCI commiter"
53-
git commit -a -m 'CI: update git tree'
54-
55-
- name: "Indent-c"
56-
run: |
57-
make indent-c && git diff --exit-code
58-
59-
- name: "ShellCheck"
60-
run: |
61-
make verify
62-
63-
- name: "Check services"
64-
run: |
65-
export PATH="$PWD/external/libshell/upstream:$PATH"
66-
make check-services
67-
68-
- name: "Unit Tests"
69-
run: |
70-
export PATH="$PWD/external/libshell/upstream:$PATH"
71-
make check-unit
72-
7313
e2e-images:
7414
name: "prepare: ${{ matrix.name }}"
7515
runs-on: ubuntu-latest
76-
needs: [ verify ]
7716
strategy:
7817
matrix:
7918
name: [
80-
"altlinux",
81-
"fedora",
82-
"ubuntu",
19+
"gentoo",
8320
]
8421
fail-fast: true
8522
steps:
@@ -114,9 +51,7 @@ jobs:
11451
strategy:
11552
matrix:
11653
name: [
117-
"altlinux",
118-
"fedora",
119-
"ubuntu",
54+
"gentoo",
12055
]
12156
testcase: [
12257
"btrfs-subvol",
@@ -150,6 +85,9 @@ jobs:
15085
- name: altlinux
15186
testcase: zfs-partition
15287

88+
- name: gentoo
89+
testcase: zfs-partition
90+
15391
fail-fast: false
15492
steps:
15593
- name: "Prepare Node"

testing/ks-gentoo-initrd.cfg

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
%post --erroronfail
2+
set -xefu
3+
4+
export PATH="/srv/.build/dest/usr/sbin:/srv/.build/dest/usr/bin:$PATH"
5+
kver="$(find /lib/modules -mindepth 1 -maxdepth 1 -printf '%f\n' -quit)"
6+
7+
mkdir -p /proc /sys /dev
8+
9+
mount -t proc proc /proc
10+
mount -t sysfs sysfs /sys
11+
mount -t devtmpfs devfs /dev
12+
13+
! blkid -L "EFI" >/dev/null ||
14+
mount -t efivarfs none /sys/firmware/efi/efivars
15+
16+
blkid
17+
findmnt
18+
19+
tee /etc/initrd.mk <<-EOF
20+
IMAGEFILE = /boot/initramfs-\$(KERNEL)\$(IMAGE_SUFFIX).img
21+
AUTODETECT = all
22+
`[ ! -f /etc/initrd.mk.addon ] || cat /etc/initrd.mk.addon`
23+
EOF
24+
25+
tee /sbin/init.once <<-EOF
26+
#!/bin/sh
27+
printf '\n\n\n%s\n\n\n' 'IT WORKS!'
28+
exec systemctl reboot
29+
EOF
30+
chmod +x /sbin/init.once
31+
32+
tee -a /usr/lib/systemd/system/init-once.service <<-EOF
33+
[Unit]
34+
Description=Make-initrd target
35+
DefaultDependencies=no
36+
After=systemd-user-sessions.service plymouth-quit-wait.service
37+
Before=system-getty.slice
38+
[Service]
39+
Type=oneshot
40+
ExecStart=/sbin/init.once
41+
RemainAfterExit=yes
42+
StandardOutput=tty
43+
[Install]
44+
WantedBy=sysinit.target
45+
EOF
46+
47+
systemctl enable init-once
48+
49+
env -i PATH="$PATH" \
50+
/srv/.build/dest/usr/sbin/make-initrd -k "$kver"
51+
52+
cp -vLf -- "/lib/modules/$kver/vmlinuz" "/boot/vmlinuz-$kver"
53+
54+
if blkid -L "EFI" >/dev/null; then
55+
bootctl install
56+
57+
bootdir="$(bootctl --print-esp-path)"
58+
59+
mkdir -p -- "$bootdir"/loader/entries
60+
mv -f -- \
61+
"/boot/vmlinuz-$kver" \
62+
"/boot/initramfs-$kver.img" \
63+
"$bootdir"
64+
65+
tee "$bootdir"/loader/loader.conf <<-EOF
66+
default default-kernel
67+
timeout 0
68+
EOF
69+
70+
tee "$bootdir"/loader/entries/default-kernel.conf <<-EOF
71+
title Default Linux
72+
linux /vmlinuz-$kver
73+
initrd /initramfs-$kver.img
74+
options console=ttyS0,115200n8 @CMDLINE@
75+
EOF
76+
77+
bootctl --no-pager
78+
else
79+
grub_install="$( for f in grub-install grub2-install; do type -P "$f" && break; done )"
80+
grub_mkconfig="$( for f in grub-mkconfig grub2-mkconfig; do type -P "$f" && break; done )"
81+
grub_params="/etc/default/grub"
82+
83+
tee -a "$grub_params" <<-EOF
84+
GRUB_CMDLINE_LINUX_DEFAULT='console=ttyS0,115200n8 @CMDLINE@'
85+
GRUB_DEFAULT=0
86+
GRUB_TIMEOUT=3
87+
GRUB_TERMINAL_INPUT='serial console'
88+
GRUB_TERMINAL_OUTPUT='serial console'
89+
GRUB_SERIAL_COMMAND='serial --unit=0 --speed=115200'
90+
GRUB_DISABLE_LINUX_UUID=true
91+
GRUB_DISABLE_LINUX_PARTUUID=true
92+
GRUB_ENABLE_BLSCFG=false
93+
GRUB_DEVICE=root=LABEL=ROOT
94+
EOF
95+
96+
bootdev=$(findmnt -k -no SOURCE -T /boot)
97+
syspath="$(readlink -ev "/sys/class/block/${bootdev#/dev/}")"
98+
syspath="${syspath%/*}/uevent"
99+
bootdev="$(sed -n -e 's,^DEVNAME=,/dev/,p' "$syspath")"
100+
101+
"$grub_install" "$bootdev"
102+
103+
grub_bootdir="$( find /boot -type d \( -name 'grub' -o -name 'grub2' \) )"
104+
105+
"$grub_mkconfig" -o "$grub_bootdir/grub.cfg"
106+
107+
cat "$grub_params"
108+
fi
109+
110+
{
111+
find /boot \! -type d -printf '%M %p\n'
112+
find /boot -type l -printf '%M %p -> %l\n'
113+
} | sort -t\ -k1,1
114+
115+
umount /proc /sys /dev
116+
%end

testing/packages-gentoo

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
MAKE_INITRD_PACKAGES="app-alternatives/cpio app-arch/tar dev-build/make"
5+
MAKE_INITRD_PACKAGES+=" dev-libs/elfutils net-libs/libtirpc sys-apps/coreutils"
6+
MAKE_INITRD_PACKAGES+=" sys-apps/findutils sys-apps/grep sys-apps/kmod sys-apps/util-linux"
7+
MAKE_INITRD_PACKAGES+=" virtual/libcrypt:= virtual/udev app-arch/bzip2 app-arch/xz-utils"
8+
MAKE_INITRD_PACKAGES+=" app-text/scdoc sys-libs/zlib app-arch/zstd dev-libs/json-c"
9+
10+
MAKE_INITRD_PACKAGES_DEVEL="$MAKE_INITRD_PACKAGES dev-build/autoconf dev-build/automake"
11+
MAKE_INITRD_PACKAGES_DEVEL+=" dev-util/intltool sys-devel/bison sys-devel/flex"
12+
MAKE_INITRD_PACKAGES_DEVEL+=" virtual/pkgconfig"
13+
14+
KERNEL_PACKAGES="sys-kernel/gentoo-kernel-bin"
15+
16+
INIT_PACKAGES="sys-apps/systemd"
17+
18+
#ZFS_PACKAGES="sys-fs/zfs sys-fs/zfs-kmod"
19+
ZFS_PACKAGES=""
20+
21+
SYSIMAGE_PACKAGES="$MAKE_INITRD_PACKAGES $INIT_PACKAGES"
22+
SYSIMAGE_PACKAGES+=" app-admin/pwgen sys-fs/mdadm sys-fs/lvm2 sys-fs/cryptsetup"
23+
SYSIMAGE_PACKAGES+=" sys-fs/btrfs-progs sys-fs/e2fsprogs sys-fs/xfsprogs sys-fs/dosfstools"
24+
SYSIMAGE_PACKAGES+=" sys-boot/grub"
25+
SYSIMAGE_PACKAGES+=" $ZFS_PACKAGES"
26+
27+
KICKSTART_PACKAGES="$MAKE_INITRD_PACKAGES_DEVEL $INIT_PACKAGES"
28+
KICKSTART_PACKAGES+=" sys-fs/e2fsprogs sys-fs/btrfs-progs sys-fs/xfsprogs sys-fs/dosfstools"
29+
KICKSTART_PACKAGES+=" sys-fs/cryptsetup sys-fs/lvm2 sys-fs/mdadm sys-apps/util-linux"
30+
KICKSTART_PACKAGES+=" net-misc/rsync net-misc/wget app-arch/unzip app-arch/tar"
31+
KICKSTART_PACKAGES+=" app-arch/cpio app-admin/pwgen app-arch/zstd sys-fs/f2fs-tools"
32+
KICKSTART_PACKAGES+=" $ZFS_PACKAGES"

testing/sh-functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pack_sysimage()
6666
#!/bin/bash -efux
6767
6868
bytes=\$(du -sb /image |cut -f1)
69-
bytes=\$(( \$bytes + ( ( \$bytes * 30 ) / 100 ) ))
69+
bytes=\$(( \$bytes * 2 ))
7070
7171
dd count=1 bs=\$bytes if=/dev/zero of=/host/$workdir/sysimage.img
7272
/sbin/mke2fs -t ext3 -L SYSIMAGE -d /image /host/$workdir/sysimage.img

0 commit comments

Comments
 (0)