代码拉取完成,页面将自动刷新
同步操作将从 mxh/nestos-assembler_1 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env bash
set -euo pipefail
# Keep this script idempotent for local development rebuild use cases:
# any consecutive runs should produce the same result.
arch=$(uname -m)
if [ $# -gt 1 ]; then
echo Usage: "build.sh [CMD]"
echo "Supported commands:"
echo " configure_user"
echo " configure_yum_repos"
echo " install_rpms"
echo " make_and_makeinstall"
exit 1
fi
set -x
srcdir=$(pwd)
configure_yum_repos() {
local version_id
version_id=$(. /etc/os-release && echo ${VERSION_ID})
# Add continuous tag for latest build tools and mark as required so we
# can depend on those latest tools being available in all container
# builds.
#echo -e "[${version_id}-nestos]\nenabled=1\nmetadata_expire=1m\nbaseurl=http://10.1.110.88/nestos-assembler/\ngpgcheck=0\nskip_if_unavailable=False\n" > /etc/yum.repos.d/nestos.repo
rm -rf /etc/yum.repos.d/*
# openeuler 22.03-LTS
echo -e "[${version_id}]\nenabled=1\nmetadata_expire=1m\nbaseurl=http://119.3.219.20:82/openEuler:/22.03:/LTS/standard_$arch/\ngpgcheck=0\npriority=1\nskip_if_unavailable=False\n" > /etc/yum.repos.d/nestos-LTS.repo
echo -e "[${version_id}-Next]\nenabled=1\nmetadata_expire=1m\nbaseurl=http://119.3.219.20:82/openEuler:/22.03:/LTS:/Epol/standard_$arch/\ngpgcheck=0\npriority=1\nskip_if_unavailable=False\n" > /etc/yum.repos.d/nestos-EPOL.repo
echo -e "[${version_id}-SP1]\nenabled=1\nmetadata_expire=1m\nbaseurl=http://119.3.219.20:82/openEuler:/22.03:/LTS:/SP1/standard_$arch/\ngpgcheck=0\npriority=2\nskip_if_unavailable=False\n" > /etc/yum.repos.d/nestos-SP1.repo
echo -e "[${version_id}-SP1-epol]\nenabled=1\nmetadata_expire=1m\nbaseurl=http://119.3.219.20:82/openEuler:/22.03:/LTS:/SP1:/Epol/standard_$arch/\ngpgcheck=0\npriority=2\nskip_if_unavailable=False\n" > /etc/yum.repos.d/nestos-sp1-epol.repo
}
install_rpms() {
local builddeps
local frozendeps
# freeze kernel due to https://github.com/coreos/nestos-assembler/issues/2707
#frozendeps=$(echo kernel-5.10.0-60.41.0.73.oe2203)
yum install -y qemu-img qemu-block-iscsi qemu-block-curl qemu-hw-usb-host qemu-system-x86_64 qemu liburing-devel glib2-devel
arch=$(uname -m)
case $arch in
"x86_64") rpm -iUh qemu-*.x86_64.rpm libslirp-*.x86_64.rpm;;
"aarch64") rpm -iUh qemu-*.aarch64.rpm libslirp-*.aarch64.rpm;;
*) fatal "Architecture ${arch} not supported"
esac
yum install -y grubby initscripts iptables nftables python3-setuptools linux-firmware bubblewrap json-c ostree json-glib polkit-libs ostree-devel dnf-plugins-core container-selinux oci-runtime
arch=$(uname -m)
case $arch in
"x86_64") rpm -iUh kernel-5.10.0-60.41.0.73.oe2203.x86_64.rpm kernel-headers-5.10.0-60.41.0.73.oe2203.x86_64.rpm buildah-1.26.1-1.x86_64.rpm butane-0.14.0-1.oe2203.x86_64.rpm dumb-init-1.2.5-4.oe2203.x86_64.rpm python3-semver-2.10.2-2.oe2203.noarch.rpm containers-common-1-1.oe2203.noarch.rpm netavark-1.0.2-1.x86_64.rpm rpm-ostree-2022.8-3.oe2203.x86_64.rpm rpm-ostree-devel-2022.8-3.oe2203.x86_64.rpm supermin-5.3.2-1.x86_64.rpm;;
"aarch64") rpm -iUh kernel-5.10.0-118.0.0.64.oe2203.aarch64.rpm kernel-headers-5.10.0-118.0.0.64.oe2203.aarch64.rpm buildah-1.26.1-1.oe2203.aarch64.rpm butane-0.14.0-2.oe2203.aarch64.rpm dumb-init-1.2.5-1.oe2203.aarch64.rpm python3-semver-2.10.2-2.oe2203.noarch.rpm containers-common-1-1.oe2203.noarch.rpm netavark-1.0.2-1.oe2203.aarch64.rpm rpm-ostree-2022.8-3.oe2203.aarch64.rpm rpm-ostree-devel-2022.8-3.oe2203.aarch64.rpm supermin-5.3.2-1.oe2203.aarch64.rpm;;
*) fatal "Architecture ${arch} not supported"
esac
# First, a general update; this is best practice. We also hit an issue recently
# where qemu implicitly depended on an updated libusbx but didn't have a versioned
# requires https://bugzilla.redhat.com/show_bug.cgi?id=1625641
#yum -y distro-sync
# xargs is part of findutils, which may not be installed
yum -y install /usr/bin/xargs
# These are only used to build things in here. Today
# we ship these in the container too to make it easier
# to use the container as a development environment for itself.
# Down the line we may strip these out, or have a separate
# development version.
builddeps=$(grep -v '^#' "${srcdir}"/src/build-deps.txt)
# Process our base dependencies + build dependencies and install
#(echo "${builddeps}" && echo "${frozendeps}" && "${srcdir}"/src/print-dependencies.sh) | xargs yum -y install
(echo "${builddeps}" && "${srcdir}"/src/print-dependencies.sh) | xargs yum -y install
# Add fast-tracked packages here. We don't want to wait on bodhi for rpm-ostree
# as we want to enable fast iteration there.
#yum --enablerepo=updates-testing upgrade rpm-ostree
# Allow Kerberos Auth to work from a keytab. The keyring is not
# available in a Container.
sed -e "s/^.*default_ccache_name/# default_ccache_name/g" -i /etc/krb5.conf
# Open up permissions on /boot/efi files so we can copy them
# for our ISO installer image, skip if not present
if [ -e /boot/efi ]; then
chmod -R a+rX /boot/efi
fi
# Similarly for kernel data and SELinux policy, which we want to inject into supermin
chmod -R a+rX /usr/lib/modules /usr/share/selinux/targeted
# Further cleanup
yum clean all
}
make_and_makeinstall() {
make && make install
rm -rf /root/.cache/go-build
}
configure_user(){
# modify Time Zone
rm -f /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# /dev/kvm might be bound in, but will have the gid from the host, and not all distros
# a+rw permissions on /dev/kvm. create groups for all the common kvm gids and then add
# builder to them.
# systemd defaults to 0666 but other packages like qemu sometimes override this with 0660.
# Adding the user to the kvm group should always work.
# fedora uses gid 36 for kvm
getent group kvm78 || groupadd -g 78 -o -r kvm78 # arch, gentoo
getent group kvm124 || groupadd -g 124 -o -r kvm124 # debian
getent group kvm232 || groupadd -g 232 -o -r kvm232 # ubuntu
# We want to run what builds we can as an unprivileged user;
# running as non-root is much better for the libvirt stack in particular
# for the cases where we have --privileged in the container run for other reasons.
# At some point we may make this the default.
getent passwd builder || useradd builder --uid 1000 -G wheel,kvm,kvm78,kvm124,kvm232
echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel-nopasswd
# Contents of /etc/sudoers.d need not to be world writable
chmod 600 /etc/sudoers.d/wheel-nopasswd
}
write_archive_info() {
cp -f ./packages /usr/lib64/guestfs/supermin.d/packages
#head -n -1 /etc/bashrc > ./bashrc
#mv -f ./bashrc /etc/bashrc
head -n -1 /etc/bashrc
echo "TMOUT=32400" >> /etc/bashrc
#source /etc/bashrc
# shellcheck source=src/cmdlib.sh
. "${srcdir}/src/cmdlib.sh"
mkdir -p /cosa /lib/coreos-assembler
touch -f /lib/coreos-assembler/.clean
prepare_git_artifacts "${srcdir}" /cosa/coreos-assembler-git.tar.gz /cosa/coreos-assembler-git.json
}
if [ $# -ne 0 ]; then
# Run the function specified by the calling script
${1}
else
# Otherwise, just run all the steps
configure_yum_repos
install_rpms
write_archive_info
make_and_makeinstall
configure_user
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。