1#!/bin/sh 2# 3# SPDX-License-Identifier: BSD-2-Clause 4# 5# Copyright (c) 2024 The FreeBSD Foundation 6# 7# This software was developed by Cybermancer Infosec <bofh@FreeBSD.org> 8# under sponsorship from the FreeBSD Foundation. 9# 10# Set to a list of third-party software to enable in rc.conf(5). 11export VM_RC_LIST="auditd freebsdci" 12 13if [ "${CITYPE}" != "smoke" ]; then 14export VM_EXTRA_PACKAGES="coreutils devel/py-pytest gdb jq ksh93 net/py-dpkt net/scapy nist-kat nmap perl5 python python3 sudo tcptestsuite" 15 16 if [ "${TARGET}" = "amd64" ]; then 17 export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} linux-c7-ltp" 18 fi 19fi 20 21vm_extra_pre_umount() { 22cat << EOF >> ${DESTDIR}/boot/loader.conf 23autoboot_delay=1 24beastie_disable="YES" 25loader_logo="none" 26console="comconsole,vidconsole" 27net.fibs=3 28net.inet.ip.fw.default_to_accept=1 29mac_bsdextended_load="YES" 30vfs.zfs.arc_max=4294967296 31kern.vty=sc 32EOF 33cat << EOF >> ${DESTDIR}/etc/kyua/kyua.conf 34test_suites.FreeBSD.ci = 'true' 35test_suites.FreeBSD.fibs = '1 2' 36test_suites.FreeBSD.allow_sysctl_side_effects = '1' 37test_suites.FreeBSD.cam_test_device = '/dev/ada0' 38test_suites.FreeBSD.disks = '/dev/vtbd2 /dev/vtbd3 /dev/vtbd4 /dev/vtbd5 /dev/vtbd6' 39EOF 40cat << EOF >> ${DESTDIR}/etc/rc.conf 41kld_list="" # Load modules needed by tests 42kld_list="${kld_list} blake2" # sys/opencrypto 43kld_list="${kld_list} cryptodev" # sys/opencrypto 44kld_list="${kld_list} fusefs" # sys/fs/fusefs 45kld_list="${kld_list} ipsec" # sys/netipsec 46kld_list="${kld_list} mac_portacl" # sys/mac/portacl 47kld_list="${kld_list} mqueuefs" # sys/kern/mqueue_test 48kld_list="${kld_list} pfsync" # sys/netpfil/pf (loads pf) 49kld_list="${kld_list} pflog" # sys/netpfil/pf 50kld_list="${kld_list} ipl" # sys/sbin/ipf (loads ipfilter) 51kld_list="${kld_list} ipfw" # sys/netpfil/ipfw (loads ipfw) 52kld_list="${kld_list} ipfw_nat" # sys/netpfil/ipfw (loads ipfw_nat) 53kld_list="${kld_list} ipdivert" # sys/netinet (loads ipdivert) 54kld_list="${kld_list} dummynet" # sys/netpfil/common 55kld_list="${kld_list} carp" # sys/netinet/carp 56kld_list="${kld_list} if_stf" # sys/net/if_stf 57background_fsck="NO" 58sendmail_enable="NONE" 59cron_enable="NO" 60syslogd_enable="NO" 61newsyslog_enable="NO" 62EOF 63if [ "${CITYPE}" = "smoke" ]; then 64cat << EOF >> ${DESTDIR}/etc/rc.conf 65freebsdci_type="smoke" 66EOF 67fi 68cat << EOF >> ${DESTDIR}/etc/sysctl.conf 69kern.cryptodevallowsoft=1 70kern.ipc.tls.enable=1 71net.add_addr_allfibs=0 72security.mac.bsdextended.enabled=0 73vfs.aio.enable_unsafe=1 74vfs.usermount=1 75EOF 76cat << EOF >> ${DESTDIR}/etc/fstab 77fdesc /dev/fd fdescfs rw 0 0 78EOF 79 mkdir -p ${DESTDIR}/usr/local/etc/rc.d 80 echo $scriptdir 81 cp -p ${scriptdir}/../../tests/ci/tools/freebsdci ${DESTDIR}/usr/local/etc/rc.d/ 82 touch ${DESTDIR}/firstboot 83 84 return 0 85} 86 87vm_extra_pkg_rmcache() { 88 if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then 89 mount -t devfs devfs ${DESTDIR}/dev 90 chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ 91 /usr/local/sbin/pkg clean -a 92 umount_loop ${DESTDIR}/dev 93 fi 94 95 return 0 96} 97