11#! /bin/bash
22# Run GNU SMACK/ROOTFS tests in QEMU with SMACK-enabled kernel
33# Usage: run-gnu-tests-smack-ci.sh [GNU_DIR] [OUTPUT_DIR]
4- # spell-checker:ignore rootfs zstd unzstd cpio newc nographic smackfs devtmpfs tmpfs poweroff libm libgcc libpthread libdl librt sysfs rwxat setuidgid
4+ # spell-checker:ignore commoncap rootfs zstd unzstd cpio newc nographic smackfs devtmpfs tmpfs poweroff libm libgcc libpthread libdl librt sysfs rwxat setuidgid
55set -e
66
77: ${PROFILE:= release-small}
@@ -15,18 +15,10 @@ echo "Setting up SMACK/ROOTFS test environment..."
1515rm -rf " $QEMU_DIR "
1616mkdir -p " $QEMU_DIR " /{rootfs/{bin,lib64,proc,sys,dev,tmp,etc,gnu},kernel}
1717
18- # Download Arch Linux kernel (has SMACK built-in)
19- if [ ! -f /tmp/arch-vmlinuz ]; then
20- echo " Downloading Arch Linux kernel..."
21- curl -sL --retry 5 --retry-delay 2 --retry-all-errors \
22- -o /tmp/arch-kernel.pkg.tar.zst " https://archlinux.org/packages/core/x86_64/linux/download/"
23- zstd -d /tmp/arch-kernel.pkg.tar.zst -o /tmp/arch-kernel.pkg.tar 2> /dev/null || unzstd /tmp/arch-kernel.pkg.tar.zst -o /tmp/arch-kernel.pkg.tar
24- VMLINUZ_PATH=$( tar -tf /tmp/arch-kernel.pkg.tar | grep ' vmlinuz$' | head -1)
25- tar -xf /tmp/arch-kernel.pkg.tar -C /tmp " $VMLINUZ_PATH "
26- mv " /tmp/$VMLINUZ_PATH " /tmp/arch-vmlinuz
27- rm -rf /tmp/usr /tmp/arch-kernel.pkg.tar /tmp/arch-kernel.pkg.tar.zst
28- fi
29- cp /tmp/arch-vmlinuz " $QEMU_DIR /kernel/vmlinuz"
18+ # Copy Ubuntu kernel
19+ sudo apt-get update || :
20+ sudo apt-get install -y linux-image-generic
21+ sudo install -Dvm644 $( ls -1 /boot/vmlinuz-* -generic | head -n 1) " $QEMU_DIR /kernel/vmlinuz"
3022
3123# Setup busybox
3224BUSYBOX=/tmp/busybox
@@ -129,7 +121,7 @@ for TEST_PATH in $QEMU_TESTS; do
129121 OUTPUT=$( timeout 120 qemu-system-x86_64 \
130122 -kernel " $QEMU_DIR /kernel/vmlinuz" \
131123 -initrd " $WORK .gz" \
132- -append " console=ttyS0 quiet panic=-1 security= smack lsm =smack" \
124+ -append " console=ttyS0 quiet panic=-1 lsm=capability, smack,commoncap security =smack apparmor=0 " \
133125 -nographic -m 256M -no-reboot 2>&1 ) || true
134126
135127 # Determine result
0 commit comments