!44 KubeOS:update to 1.0.3-1
From: @li-yuanrong Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
da0d197b21
@ -1,479 +0,0 @@
|
|||||||
From 236b8ddeb3bc7f35eb817769f117ecd68a59335c Mon Sep 17 00:00:00 2001
|
|
||||||
From: stedylan <836671668@qq.com>
|
|
||||||
Date: Sun, 7 Aug 2022 01:47:14 +0800
|
|
||||||
Subject: [PATCH] Write a tool to support KubeOS deployment on physical
|
|
||||||
machines.
|
|
||||||
|
|
||||||
This tool uses dracut module to make partitions and formatting, set network infomation, get rootfs and set boot options in initramfs before switch to the real root.
|
|
||||||
|
|
||||||
Signed-off-by: stedylan <836671668@qq.com>
|
|
||||||
---
|
|
||||||
scripts/00bootup/Global.cfg | 12 ++
|
|
||||||
scripts/00bootup/module-setup.sh | 28 +++
|
|
||||||
scripts/00bootup/mount.sh | 332 +++++++++++++++++++++++++++++++
|
|
||||||
scripts/create/imageCreate.sh | 4 +-
|
|
||||||
scripts/create/rootfsCreate.sh | 1 +
|
|
||||||
scripts/rpmlist | 10 +-
|
|
||||||
scripts/set_in_chroot.sh | 3 +
|
|
||||||
7 files changed, 387 insertions(+), 3 deletions(-)
|
|
||||||
create mode 100644 scripts/00bootup/Global.cfg
|
|
||||||
create mode 100644 scripts/00bootup/module-setup.sh
|
|
||||||
create mode 100644 scripts/00bootup/mount.sh
|
|
||||||
|
|
||||||
diff --git a/scripts/00bootup/Global.cfg b/scripts/00bootup/Global.cfg
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..cad4e33
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/scripts/00bootup/Global.cfg
|
|
||||||
@@ -0,0 +1,12 @@
|
|
||||||
+# rootfs file name
|
|
||||||
+rootfs_name=kubeos.tar
|
|
||||||
+
|
|
||||||
+# select the target disk to install kubeOS
|
|
||||||
+disk=/dev/sda
|
|
||||||
+
|
|
||||||
+# address where stores the rootfs on the http server
|
|
||||||
+server_ip=192.168.1.50
|
|
||||||
+
|
|
||||||
+local_ip=192.168.1.100
|
|
||||||
+
|
|
||||||
+route_ip=192.168.1.1
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/scripts/00bootup/module-setup.sh b/scripts/00bootup/module-setup.sh
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..5460b2b
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/scripts/00bootup/module-setup.sh
|
|
||||||
@@ -0,0 +1,28 @@
|
|
||||||
+#!/bin/bash
|
|
||||||
+
|
|
||||||
+check() {
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+depends() {
|
|
||||||
+ echo systemd
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+install() {
|
|
||||||
+ inst_multiple -o grub2-mkimage mkfs.ext4 mkfs.vfat lsblk tar cpio gunzip lspci parted dhclient ifconfig curl hwinfo head tee arch df awk route
|
|
||||||
+ inst_hook mount 00 "$moddir/mount.sh"
|
|
||||||
+ inst_simple "$moddir/mount.sh" "/mount.sh"
|
|
||||||
+ inst_simple "$moddir/Global.cfg" "/Global.cfg"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+installkernel() {
|
|
||||||
+ hostonly='' \
|
|
||||||
+ instmods \
|
|
||||||
+ =drivers/ata \
|
|
||||||
+ =drivers/nvme \
|
|
||||||
+ =drivers/scsi \
|
|
||||||
+ =drivers/net \
|
|
||||||
+ =fs/fat \
|
|
||||||
+ =fs/nls
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
diff --git a/scripts/00bootup/mount.sh b/scripts/00bootup/mount.sh
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..a04a364
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/scripts/00bootup/mount.sh
|
|
||||||
@@ -0,0 +1,332 @@
|
|
||||||
+#!/bin/bash
|
|
||||||
+arch=$(arch)
|
|
||||||
+min_size=8
|
|
||||||
+log=/install.log
|
|
||||||
+
|
|
||||||
+source /Global.cfg
|
|
||||||
+
|
|
||||||
+function CheckSpace() {
|
|
||||||
+ local disk_ava="$(parted -l | grep ${disk} | awk '{print $3}')"
|
|
||||||
+ if echo "${disk_ava}" | grep [GT]B$; then
|
|
||||||
+ if echo "${disk_ava}" | grep GB$; then
|
|
||||||
+ disk_ava="$(echo ${disk_ava} | awk -F G '{print $1}' | awk -F . '{print $1}')"
|
|
||||||
+ if [ "${disk_ava}" -lt ${min_size} ]; then
|
|
||||||
+ echo "The available disk space is not enough, at least ${min_size}GB." | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ echo "The available disk space is not enough, at least ${min_size}G." | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function GetDisk() {
|
|
||||||
+ disks=$(hwinfo --disk --short | grep -vi "^disk" | awk '{print $1}')
|
|
||||||
+ if [ ! -z ${disks} ]; then
|
|
||||||
+ if [ ! -z ${disk} ] && echo "${disks[@]}" | grep -wq "${disk}" ; then
|
|
||||||
+ echo "${disk} exists, start partition" | tee -a ${log}
|
|
||||||
+ else
|
|
||||||
+ echo "disk not exist, choose default disk" | tee -a ${log}
|
|
||||||
+ disk=$(echo ${disks[0]})
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ echo "no disk found" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ CheckSpace
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "no enough space on ${disk}" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function PartitionAndFormatting() {
|
|
||||||
+ echo "Partitioning and formatting disk $disk..."
|
|
||||||
+ # partition and format
|
|
||||||
+ parted ${disk} -s mklabel gpt >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "partition failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ parted ${disk} -s mkpart primary fat16 1M 100M >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "partition failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ parted ${disk} -s mkpart primary ext4 100M 2600M >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "partition failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ parted ${disk} -s mkpart primary ext4 2600M 5100M >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "partition failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ parted ${disk} -s mkpart primary ext4 5100M 100% >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "partition failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ parted ${disk} -s set 1 boot on >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "partition failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ mkfs.vfat -n "BOOT" ${disk}1 >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "format failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ mkfs.ext4 -L "ROOT-A" ${disk}2 >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "format failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ mkfs.ext4 -L "ROOT-B" ${disk}3 >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "format failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ mkfs.ext4 -L "PERSIST" ${disk}4 >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "format failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function InitNetwork() {
|
|
||||||
+ echo "Initializing network..."
|
|
||||||
+ # 获取网卡信息,默认只有一个网卡
|
|
||||||
+ net_name=`ifconfig -a | awk '{print $1}' | grep : | grep '^e' | awk -F: '{print $1}'`
|
|
||||||
+ # dhclient --timeout 60 >> ${log} 2>&1
|
|
||||||
+
|
|
||||||
+ ifconfig ${net_name} up
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "load net card failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ sleep 3
|
|
||||||
+
|
|
||||||
+ ifconfig ${net_name} ${local_ip} netmask 255.255.255.0 >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "ip set failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ sleep 3
|
|
||||||
+
|
|
||||||
+ route add default gw ${route_ip} >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "add route failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ sleep 3
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function MountRoot() {
|
|
||||||
+ echo "Mounting rootfs..."
|
|
||||||
+ # mount rootfs
|
|
||||||
+ mount ${disk}2 /sysroot >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "mount rootfs failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function MountPersist() {
|
|
||||||
+ echo "Mounting persist"
|
|
||||||
+ mkdir /persist
|
|
||||||
+ mount ${disk}4 /persist >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "mount persist failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ mkdir /persist/{var,etc,etcwork}
|
|
||||||
+ mkdir -p /persist/etc/KubeOS/certs
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function MountBoot() {
|
|
||||||
+ echo "Mounting boot"
|
|
||||||
+ mkdir -p /sysroot/boot/efi
|
|
||||||
+ mount ${disk}1 /sysroot/boot/efi >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "mount boot failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function GetRootfs() {
|
|
||||||
+ echo "Downloading rootfs..."
|
|
||||||
+
|
|
||||||
+ curl -o /persist/${rootfs_name} http://${server_ip}/${rootfs_name}
|
|
||||||
+ if [ ! -e "/persist/${rootfs_name}" ]; then
|
|
||||||
+ echo "download rootfs failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ tar -xvf /persist/${rootfs_name} -C /sysroot
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "decompose rootfs failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ rm -rf /persist/${rootfs_name}
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function Inst_Grub2_x86() {
|
|
||||||
+ # copy the files that boot need
|
|
||||||
+ cp -r /sysroot/usr/lib/grub/x86_64-efi /sysroot/boot/efi/EFI/openEuler
|
|
||||||
+ eval "grub2-mkimage -d /sysroot/usr/lib/grub/x86_64-efi -O x86_64-efi --output=/sysroot/boot/efi/EFI/openEuler/grubx64.efi '--prefix=(,gpt1)/EFI/openEuler' fat part_gpt part_msdos linux" >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "grub2-mkimage on x86 failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ mkdir -p /sysroot/boot/efi/EFI/BOOT/
|
|
||||||
+ cp -f /sysroot/boot/efi/EFI/openEuler/grubx64.efi /sysroot/boot/efi/EFI/BOOT/BOOTX64.EFI
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function Inst_Grub2_aarch64() {
|
|
||||||
+ cp -r /sysroot/usr/lib/grub/arm64-efi /sysroot/boot/efi/EFI/openEuler/
|
|
||||||
+ eval "grub2-mkimage -d /sysroot/usr/lib/grub/arm64-efi -O arm64-efi --output=/sysroot/boot/efi/EFI/openEuler/grubaa64.efi '--prefix=(,gpt1)/EFI/openEuler' fat part_gpt part_msdos linux" >> ${log} 2>&1
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "grub2-mkimage on aarch64 failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ mkdir -p /sysroot/boot/efi/EFI/BOOT/
|
|
||||||
+ cp -f /sysroot/boot/efi/EFI/openEuler/grubaa64.efi /sysroot/boot/efi/EFI/BOOT/BOOTAA64.EFI
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function SetBoot() {
|
|
||||||
+ # mount boot
|
|
||||||
+ echo "Setting boot"
|
|
||||||
+
|
|
||||||
+ if [ $arch == "x86_64" ]; then
|
|
||||||
+ Inst_Grub2_x86
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "install grub on x86 failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ if [ $arch == "aarch64" ]; then
|
|
||||||
+ Inst_Grub2_aarch64
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "install grub on aarch64 failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function Bootup_Main() {
|
|
||||||
+ # get disk
|
|
||||||
+ echo "Checking disk info..." | tee -a ${log}
|
|
||||||
+ GetDisk
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Checking disk info failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # partition and format disk
|
|
||||||
+ echo "Partion and formatting..." | tee -a ${log}
|
|
||||||
+ PartitionAndFormatting
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Partition and formatting disk failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # init network
|
|
||||||
+ echo "Initializing network..." | tee -a ${log}
|
|
||||||
+ InitNetwork
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Initializing network failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # mount partitions
|
|
||||||
+ echo "Mounting root..." | tee -a ${log}
|
|
||||||
+ MountRoot
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Mounting root failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # mount persist
|
|
||||||
+ echo "Mounting persisst..." | tee -a ${log}
|
|
||||||
+ MountPersist
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Mounting persist failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # mount boot
|
|
||||||
+ echo "Mounting boot..." | tee -a ${log}
|
|
||||||
+ MountBoot
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Mounting boot failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # download rootfs
|
|
||||||
+ echo "Downloading rootfs..." | tee -a ${log}
|
|
||||||
+ GetRootfs
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Downloading rootfs failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ # set boot
|
|
||||||
+ echo "Setting boot..." | tee -a ${log}
|
|
||||||
+ SetBoot
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Setting boot failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
+
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+Bootup_Main
|
|
||||||
+ret=$?
|
|
||||||
+if [ ${ret} -eq 0 ]; then
|
|
||||||
+ echo "kubeOS install success! switch to root" | tee -a ${log}
|
|
||||||
+ cp ${log} /persist
|
|
||||||
+else
|
|
||||||
+ echo "kubeOS install failed, see install.log" | tee -a ${log}
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
diff --git a/scripts/create/imageCreate.sh b/scripts/create/imageCreate.sh
|
|
||||||
index f8dafbe..95ebcde 100644
|
|
||||||
--- a/scripts/create/imageCreate.sh
|
|
||||||
+++ b/scripts/create/imageCreate.sh
|
|
||||||
@@ -62,12 +62,12 @@ function create_pxe_img() {
|
|
||||||
case $opt in
|
|
||||||
"repo")
|
|
||||||
create_os_tar_from_repo "$@"
|
|
||||||
- tar -xvf os.tar ./boot/initramfs.img
|
|
||||||
+ tar -xvf os.tar ./initramfs.img
|
|
||||||
tar -xvf os.tar ./boot/vmlinuz
|
|
||||||
;;
|
|
||||||
"docker")
|
|
||||||
create_os_tar_from_docker "$@"
|
|
||||||
- tar -xvf os.tar boot/initramfs.img
|
|
||||||
+ tar -xvf os.tar initramfs.img
|
|
||||||
tar -xvf os.tar boot/vmlinuz
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
diff --git a/scripts/create/rootfsCreate.sh b/scripts/create/rootfsCreate.sh
|
|
||||||
index 8049f09..e5c53d5 100644
|
|
||||||
--- a/scripts/create/rootfsCreate.sh
|
|
||||||
+++ b/scripts/create/rootfsCreate.sh
|
|
||||||
@@ -61,6 +61,7 @@ EOF
|
|
||||||
mv "${RPM_ROOT}"/boot/initramfs* "${RPM_ROOT}/boot/initramfs.img"
|
|
||||||
cp grub.cfg "${RPM_ROOT}"/boot/grub2
|
|
||||||
cp grub.cfg "${RPM_ROOT}"/boot/efi/EFI/openEuler
|
|
||||||
+ cp -r ./00bootup ${RPM_ROOT}/usr/lib/dracut/modules.d/
|
|
||||||
cp set_in_chroot.sh "${RPM_ROOT}"
|
|
||||||
ROOT_PWD="${PASSWD}" chroot "${RPM_ROOT}" bash /set_in_chroot.sh
|
|
||||||
rm "${RPM_ROOT}/set_in_chroot.sh"
|
|
||||||
diff --git a/scripts/rpmlist b/scripts/rpmlist
|
|
||||||
index 7a9adfa..077a164 100644
|
|
||||||
--- a/scripts/rpmlist
|
|
||||||
+++ b/scripts/rpmlist
|
|
||||||
@@ -13,4 +13,12 @@ socat
|
|
||||||
conntrack-tools
|
|
||||||
ebtables
|
|
||||||
ethtool
|
|
||||||
-rsyslog
|
|
||||||
\ No newline at end of file
|
|
||||||
+rsyslog
|
|
||||||
+vi
|
|
||||||
+net-tools
|
|
||||||
+hwinfo
|
|
||||||
+dracut
|
|
||||||
+coreutils
|
|
||||||
+gawk
|
|
||||||
+parted
|
|
||||||
+dosfstools
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/scripts/set_in_chroot.sh b/scripts/set_in_chroot.sh
|
|
||||||
index bacef78..4b061df 100644
|
|
||||||
--- a/scripts/set_in_chroot.sh
|
|
||||||
+++ b/scripts/set_in_chroot.sh
|
|
||||||
@@ -11,3 +11,6 @@ sed -i '/^root:/d' /etc/shadow_bak
|
|
||||||
echo "root:"${ROOT_PWD}${str:1} > /etc/shadow
|
|
||||||
cat /etc/shadow_bak >> /etc/shadow
|
|
||||||
rm -rf /etc/shadow_bak
|
|
||||||
+
|
|
||||||
+dracut -f -v --add bootup /initramfs.img --kver `ls /lib/modules`
|
|
||||||
+rm -rf /usr/lib/dracut/modules.d/00bootup
|
|
||||||
\ No newline at end of file
|
|
||||||
--
|
|
||||||
2.33.0.windows.2
|
|
||||||
|
|
||||||
@ -1,341 +0,0 @@
|
|||||||
From f64c9587a20cc44036b0f622105501ff142729d7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
Date: Tue, 23 Aug 2022 15:32:36 +0800
|
|
||||||
Subject: [PATCH] KubeOS:fix the kbimg.sh exception and pxe installation
|
|
||||||
problem.
|
|
||||||
|
|
||||||
Fixed the issue of abnormal usage printing of the kbimg.sh parameter,
|
|
||||||
no verification of the -b parameter, and environment clearance in
|
|
||||||
the concurrent scenario.
|
|
||||||
Fix the problem that disks and network adapters cannot be found
|
|
||||||
due to disk and network adapter verification during PXE installation.
|
|
||||||
Fix the problem that os-proxy does not transfer imagetype and dockerimage
|
|
||||||
to the os-agent.
|
|
||||||
|
|
||||||
Signed-off-by: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
---
|
|
||||||
cmd/proxy/controllers/os_controller.go | 16 ++++++------
|
|
||||||
scripts/00bootup/Global.cfg | 12 ++++++---
|
|
||||||
scripts/00bootup/mount.sh | 35 ++++++++++++++------------
|
|
||||||
scripts/common/utils.sh | 7 ++++++
|
|
||||||
scripts/create/imageCreate.sh | 4 +--
|
|
||||||
scripts/kbimg.sh | 30 +++++++++++++---------
|
|
||||||
6 files changed, 62 insertions(+), 42 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmd/proxy/controllers/os_controller.go b/cmd/proxy/controllers/os_controller.go
|
|
||||||
index f73c750..09e58f9 100644
|
|
||||||
--- a/cmd/proxy/controllers/os_controller.go
|
|
||||||
+++ b/cmd/proxy/controllers/os_controller.go
|
|
||||||
@@ -106,13 +106,15 @@ func (r *OSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Re
|
|
||||||
case "upgrade":
|
|
||||||
version := osVersionSpec
|
|
||||||
downloadInfo := &agentclient.DownloadInfo{
|
|
||||||
- ImageURL: osInstance.Spec.ImageURL,
|
|
||||||
- FlagSafe: osInstance.Spec.FlagSafe,
|
|
||||||
- CheckSum: osInstance.Spec.CheckSum,
|
|
||||||
- CaCert: osInstance.Spec.CaCert,
|
|
||||||
- ClientCert: osInstance.Spec.ClientCert,
|
|
||||||
- ClientKey: osInstance.Spec.ClientKey,
|
|
||||||
- MTLS: osInstance.Spec.MTLS,
|
|
||||||
+ ImageURL: osInstance.Spec.ImageURL,
|
|
||||||
+ FlagSafe: osInstance.Spec.FlagSafe,
|
|
||||||
+ CheckSum: osInstance.Spec.CheckSum,
|
|
||||||
+ CaCert: osInstance.Spec.CaCert,
|
|
||||||
+ ClientCert: osInstance.Spec.ClientCert,
|
|
||||||
+ ClientKey: osInstance.Spec.ClientKey,
|
|
||||||
+ MTLS: osInstance.Spec.MTLS,
|
|
||||||
+ ImageType: osInstance.Spec.ImageType,
|
|
||||||
+ DockerImage: osInstance.Spec.DockerImage,
|
|
||||||
}
|
|
||||||
if err := r.Connection.UpdateSpec(version, downloadInfo); err != nil {
|
|
||||||
return values.RequeueNow, err
|
|
||||||
diff --git a/scripts/00bootup/Global.cfg b/scripts/00bootup/Global.cfg
|
|
||||||
index cad4e33..dd78617 100644
|
|
||||||
--- a/scripts/00bootup/Global.cfg
|
|
||||||
+++ b/scripts/00bootup/Global.cfg
|
|
||||||
@@ -4,9 +4,13 @@ rootfs_name=kubeos.tar
|
|
||||||
# select the target disk to install kubeOS
|
|
||||||
disk=/dev/sda
|
|
||||||
|
|
||||||
-# address where stores the rootfs on the http server
|
|
||||||
+# pxe server ip address where stores the rootfs on the http server
|
|
||||||
server_ip=192.168.1.50
|
|
||||||
-
|
|
||||||
+# target machine ip
|
|
||||||
local_ip=192.168.1.100
|
|
||||||
-
|
|
||||||
-route_ip=192.168.1.1
|
|
||||||
\ No newline at end of file
|
|
||||||
+# target machine route
|
|
||||||
+route_ip=192.168.1.1
|
|
||||||
+# target machine netmask
|
|
||||||
+netmask=255.255.255.0
|
|
||||||
+# target machine netDevice name
|
|
||||||
+net_name=eth0
|
|
||||||
diff --git a/scripts/00bootup/mount.sh b/scripts/00bootup/mount.sh
|
|
||||||
index a04a364..1bc83ff 100644
|
|
||||||
--- a/scripts/00bootup/mount.sh
|
|
||||||
+++ b/scripts/00bootup/mount.sh
|
|
||||||
@@ -24,20 +24,17 @@ function CheckSpace() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetDisk() {
|
|
||||||
- disks=$(hwinfo --disk --short | grep -vi "^disk" | awk '{print $1}')
|
|
||||||
- if [ ! -z ${disks} ]; then
|
|
||||||
- if [ ! -z ${disk} ] && echo "${disks[@]}" | grep -wq "${disk}" ; then
|
|
||||||
+ disks=(`hwinfo --disk --short 2>&1 | grep -vi "^disk" | awk '{print $1}'`)
|
|
||||||
+ if [ ${#disks[*]} -gt 0 ]; then
|
|
||||||
+ if [ -n "${disk}" ] && echo "${disks[@]}" | grep -wq "${disk}" ; then
|
|
||||||
echo "${disk} exists, start partition" | tee -a ${log}
|
|
||||||
else
|
|
||||||
- echo "disk not exist, choose default disk" | tee -a ${log}
|
|
||||||
- disk=$(echo ${disks[0]})
|
|
||||||
+ echo "disk not exist, please choose correct disk" | tee -a ${log}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "no disk found" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
-
|
|
||||||
-
|
|
||||||
CheckSpace
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "no enough space on ${disk}" | tee -a ${log}
|
|
||||||
@@ -115,9 +112,18 @@ function PartitionAndFormatting() {
|
|
||||||
|
|
||||||
function InitNetwork() {
|
|
||||||
echo "Initializing network..."
|
|
||||||
- # 获取网卡信息,默认只有一个网卡
|
|
||||||
- net_name=`ifconfig -a | awk '{print $1}' | grep : | grep '^e' | awk -F: '{print $1}'`
|
|
||||||
- # dhclient --timeout 60 >> ${log} 2>&1
|
|
||||||
+ netNames=(`ifconfig -a | awk '{print $1}' | grep : | grep '^e' | awk -F: '{print $1}'`)
|
|
||||||
+ if [ ${#netNames[*]} -gt 0 ]; then
|
|
||||||
+ if [ -n "${net_name}" ] && echo "${netNames[@]}" | grep -wq "${net_name}" ; then
|
|
||||||
+ echo "${net_name} exists, start set ip" | tee -a ${log}
|
|
||||||
+ else
|
|
||||||
+ echo "net_name not exist, choose default net" | tee -a ${log}
|
|
||||||
+ net_name=${netNames[0]}
|
|
||||||
+ fi
|
|
||||||
+ else
|
|
||||||
+ echo "no net Device found" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
|
|
||||||
ifconfig ${net_name} up
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
@@ -126,7 +132,7 @@ function InitNetwork() {
|
|
||||||
fi
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
- ifconfig ${net_name} ${local_ip} netmask 255.255.255.0 >> ${log} 2>&1
|
|
||||||
+ ifconfig ${net_name} ${local_ip} netmask ${netmask} >> ${log} 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "ip set failed" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
@@ -139,9 +145,6 @@ function InitNetwork() {
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
sleep 3
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -249,6 +252,7 @@ function SetBoot() {
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
+ sed -i 's#/dev/sda#'${disk}'#g' /sysroot/boot/efi/EFI/openEuler/grub.cfg
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
@@ -328,5 +332,4 @@ if [ ${ret} -eq 0 ]; then
|
|
||||||
cp ${log} /persist
|
|
||||||
else
|
|
||||||
echo "kubeOS install failed, see install.log" | tee -a ${log}
|
|
||||||
-fi
|
|
||||||
-
|
|
||||||
+fi
|
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/scripts/common/utils.sh b/scripts/common/utils.sh
|
|
||||||
index 902a6ae..3546c8c 100644
|
|
||||||
--- a/scripts/common/utils.sh
|
|
||||||
+++ b/scripts/common/utils.sh
|
|
||||||
@@ -87,6 +87,13 @@ function delete_file() {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
+function check_binary_exist() {
|
|
||||||
+ if [ ! -f "$1" ];then
|
|
||||||
+ log_error_print "binary path is invalid."
|
|
||||||
+ exit 3
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
function check_repo_path() {
|
|
||||||
if [ ! -f "$1" ];then
|
|
||||||
log_error_print "REPO path is invalid."
|
|
||||||
diff --git a/scripts/create/imageCreate.sh b/scripts/create/imageCreate.sh
|
|
||||||
index 95ebcde..564c740 100644
|
|
||||||
--- a/scripts/create/imageCreate.sh
|
|
||||||
+++ b/scripts/create/imageCreate.sh
|
|
||||||
@@ -56,19 +56,17 @@ function create_img() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_pxe_img() {
|
|
||||||
- rm -rf boot/ kubeos.tar
|
|
||||||
+ rm -rf initramfs.img kubeos.tar
|
|
||||||
local opt=$1
|
|
||||||
shift
|
|
||||||
case $opt in
|
|
||||||
"repo")
|
|
||||||
create_os_tar_from_repo "$@"
|
|
||||||
tar -xvf os.tar ./initramfs.img
|
|
||||||
- tar -xvf os.tar ./boot/vmlinuz
|
|
||||||
;;
|
|
||||||
"docker")
|
|
||||||
create_os_tar_from_docker "$@"
|
|
||||||
tar -xvf os.tar initramfs.img
|
|
||||||
- tar -xvf os.tar boot/vmlinuz
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
mv os.tar kubeos.tar
|
|
||||||
diff --git a/scripts/kbimg.sh b/scripts/kbimg.sh
|
|
||||||
index 1268700..a77d62e 100644
|
|
||||||
--- a/scripts/kbimg.sh
|
|
||||||
+++ b/scripts/kbimg.sh
|
|
||||||
@@ -72,12 +72,12 @@ options:
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
-function show_vm_image_usage() {
|
|
||||||
+function show_vm_pxe_image_usage() {
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
-Usage : kbimg create vm-image -p iso-path -v os-version -b os-agent-dir -e os-password
|
|
||||||
+Usage : kbimg create [vm-image|pxe-image] -p iso-path -v os-version -b os-agent-dir -e os-password
|
|
||||||
or
|
|
||||||
- kbimg create vm-image -d repository/name:tag
|
|
||||||
+ kbimg create [vm-image|pxe-image] -d repository/name:tag
|
|
||||||
|
|
||||||
options:
|
|
||||||
-p repo path
|
|
||||||
@@ -130,7 +130,7 @@ function clean_space() {
|
|
||||||
function clean_img() {
|
|
||||||
delete_file system.img
|
|
||||||
delete_file update.img
|
|
||||||
- delete_dir boot
|
|
||||||
+ delete_file initramfs.img
|
|
||||||
delete_file kubeos.tar
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -170,6 +170,7 @@ function verify_upgrade_image_input() {
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
log_error_print "option $opt not found"
|
|
||||||
+ show_upgrade_image_usage
|
|
||||||
exit 3
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -183,6 +184,7 @@ function verify_repo_input() {
|
|
||||||
echo "$@" | grep -q "\-$i "
|
|
||||||
if [ "$?" -ne 0 ];then
|
|
||||||
log_error_print "option -$i is mandatory, please check input"
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -208,6 +210,7 @@ function verify_repo_input() {
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
log_error_print "option $opt not found"
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 3
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -215,7 +218,8 @@ function verify_repo_input() {
|
|
||||||
}
|
|
||||||
function verify_docker_input() {
|
|
||||||
if [ $1 != "-d" ]; then
|
|
||||||
- log_error_print "option $opt not found"
|
|
||||||
+ log_error_print "option $1 not found"
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
check_param $2
|
|
||||||
@@ -242,13 +246,14 @@ function verify_create_input() {
|
|
||||||
check_disk_space "docker"
|
|
||||||
verify_upgrade_image_input "$@"
|
|
||||||
check_repo_path "${REPO}"
|
|
||||||
+ check_binary_exist "${AGENT_PATH}"
|
|
||||||
create_docker_image "${REPO}" "${VERSION}" "${AGENT_PATH}" "${PASSWD}" "${DOCKER_IMG}"
|
|
||||||
;;
|
|
||||||
"vm-image")
|
|
||||||
shift
|
|
||||||
if [ $# -eq 1 ]; then
|
|
||||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
|
||||||
- show_vm_image_usage
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -256,6 +261,7 @@ function verify_create_input() {
|
|
||||||
if [ $# -eq 8 ]; then
|
|
||||||
verify_repo_input "$@"
|
|
||||||
check_repo_path "${REPO}"
|
|
||||||
+ check_binary_exist "${AGENT_PATH}"
|
|
||||||
create_vm_img "repo" "${REPO}" "${VERSION}" "${AGENT_PATH}" "${PASSWD}"
|
|
||||||
elif [ $# -eq 2 ]; then
|
|
||||||
verify_docker_input "$@"
|
|
||||||
@@ -263,7 +269,7 @@ function verify_create_input() {
|
|
||||||
create_vm_img "docker" "${DOCKER_IMG}"
|
|
||||||
else
|
|
||||||
log_error_print "the number of parameters is incorrect, please check it."
|
|
||||||
- show_vm_image_usage
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
@@ -271,7 +277,7 @@ function verify_create_input() {
|
|
||||||
shift
|
|
||||||
if [ $# -eq 1 ]; then
|
|
||||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
|
||||||
- show_pxe_image_usage
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@@ -279,6 +285,7 @@ function verify_create_input() {
|
|
||||||
if [ $# -eq 8 ]; then
|
|
||||||
verify_repo_input "$@"
|
|
||||||
check_repo_path "${REPO}"
|
|
||||||
+ check_binary_exist "${AGENT_PATH}"
|
|
||||||
create_pxe_img "repo" "${REPO}" "${VERSION}" "${AGENT_PATH}" "${PASSWD}"
|
|
||||||
elif [ $# -eq 2 ]; then
|
|
||||||
verify_docker_input "$@"
|
|
||||||
@@ -286,7 +293,7 @@ function verify_create_input() {
|
|
||||||
create_pxe_img "docker" "${DOCKER_IMG}"
|
|
||||||
else
|
|
||||||
log_error_print "the number of parameters is incorrect, please check it."
|
|
||||||
- show_pxe_image_usage
|
|
||||||
+ show_vm_pxe_image_usage
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
@@ -327,9 +334,8 @@ function kubeos_image_main() {
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
+test_lock
|
|
||||||
trap clean_space EXIT
|
|
||||||
trap clean_img ERR
|
|
||||||
|
|
||||||
-test_lock
|
|
||||||
-kubeos_image_main "$@"
|
|
||||||
-
|
|
||||||
+kubeos_image_main "$@"
|
|
||||||
\ No newline at end of file
|
|
||||||
--
|
|
||||||
2.33.0.windows.2
|
|
||||||
|
|
||||||
@ -1,300 +0,0 @@
|
|||||||
From fd5b3f24446c8c5dfc2fb271431ed296618eccc1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
Date: Sat, 27 Aug 2022 16:22:56 +0800
|
|
||||||
Subject: [PATCH] KubeOS: fixed the issue of VMs images and add check of
|
|
||||||
Global.cfg.
|
|
||||||
|
|
||||||
Modify the docker image creation method to fix the problem that /etc/hosts is
|
|
||||||
empty in the VM created using the docker image and that the /sys directory is
|
|
||||||
mounted abnormally.
|
|
||||||
Add checks whether configuration in the Global.cfg file are empty and whether
|
|
||||||
the IP address is valid.
|
|
||||||
|
|
||||||
Signed-off-by: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
---
|
|
||||||
api/v1alpha1/os_types.go | 15 +++---
|
|
||||||
cmd/agent/server/docker_image.go | 27 +++++++----
|
|
||||||
.../config/crd/upgrade.openeuler.org_os.yaml | 1 -
|
|
||||||
scripts/Dockerfile | 2 +-
|
|
||||||
scripts/common/utils.sh | 48 ++++++++++++++++---
|
|
||||||
scripts/create/imageCreate.sh | 3 +-
|
|
||||||
scripts/create/rootfsCreate.sh | 12 ++---
|
|
||||||
scripts/kbimg.sh | 19 +-------
|
|
||||||
8 files changed, 74 insertions(+), 53 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/api/v1alpha1/os_types.go b/api/v1alpha1/os_types.go
|
|
||||||
index 5acb97a..862d408 100644
|
|
||||||
--- a/api/v1alpha1/os_types.go
|
|
||||||
+++ b/api/v1alpha1/os_types.go
|
|
||||||
@@ -23,14 +23,13 @@ type OSSpec struct {
|
|
||||||
MaxUnavailable int `json:"maxunavailable"`
|
|
||||||
CheckSum string `json:"checksum"`
|
|
||||||
FlagSafe bool `json:"flagSafe"`
|
|
||||||
- // +kubebuilder:default=true
|
|
||||||
- MTLS bool `json:"mtls"`
|
|
||||||
- ImageType string `json:"imagetype"`
|
|
||||||
- DockerImage string `json:"dockerimage"`
|
|
||||||
- OpsType string `json:"opstype"`
|
|
||||||
- CaCert string `json:"cacert"`
|
|
||||||
- ClientCert string `json:"clientcert"`
|
|
||||||
- ClientKey string `json:"clientkey"`
|
|
||||||
+ MTLS bool `json:"mtls"`
|
|
||||||
+ ImageType string `json:"imagetype"`
|
|
||||||
+ DockerImage string `json:"dockerimage"`
|
|
||||||
+ OpsType string `json:"opstype"`
|
|
||||||
+ CaCert string `json:"cacert"`
|
|
||||||
+ ClientCert string `json:"clientcert"`
|
|
||||||
+ ClientKey string `json:"clientkey"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +kubebuilder:subresource:status
|
|
||||||
diff --git a/cmd/agent/server/docker_image.go b/cmd/agent/server/docker_image.go
|
|
||||||
index c5ed640..11b21aa 100644
|
|
||||||
--- a/cmd/agent/server/docker_image.go
|
|
||||||
+++ b/cmd/agent/server/docker_image.go
|
|
||||||
@@ -54,7 +54,7 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer cli.ContainerRemove(ctx, info.ID, types.ContainerRemoveOptions{})
|
|
||||||
- tarStream, stat, err := cli.CopyFromContainer(ctx, info.ID, "/")
|
|
||||||
+ tarStream, stat, err := cli.CopyFromContainer(ctx, info.ID, "/os.tar")
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
@@ -71,6 +71,15 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
return "", fmt.Errorf("space is not enough for downloaing")
|
|
||||||
}
|
|
||||||
|
|
||||||
+ srcInfo := archive.CopyInfo{
|
|
||||||
+ Path: "/",
|
|
||||||
+ Exists: true,
|
|
||||||
+ IsDir: stat.Mode.IsDir(),
|
|
||||||
+ }
|
|
||||||
+ if err = archive.CopyTo(tarStream, srcInfo, PersistDir); err != nil {
|
|
||||||
+ return "", err
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
tmpMountPath := filepath.Join(PersistDir, "/kubeos-update")
|
|
||||||
if err = os.Mkdir(tmpMountPath, imgPermission); err != nil {
|
|
||||||
return "", err
|
|
||||||
@@ -80,25 +89,23 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
if err = runCommand("dd", "if=/dev/zero", "of="+imagePath, "bs=2M", "count=1024"); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
- if err = runCommand("mkfs.ext4", imagePath); err != nil {
|
|
||||||
+ _, next, err := getNextPart(partA, partB)
|
|
||||||
+ if err = runCommand("mkfs.ext4", "-L", "ROOT-"+next, imagePath); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if err = runCommand("mount", "-o", "loop", imagePath, tmpMountPath); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
- runCommand("losetup", "-D")
|
|
||||||
syscall.Unmount(tmpMountPath, 0)
|
|
||||||
-
|
|
||||||
+ runCommand("losetup", "-D")
|
|
||||||
}()
|
|
||||||
- srcInfo := archive.CopyInfo{
|
|
||||||
- Path: "/",
|
|
||||||
- Exists: true,
|
|
||||||
- IsDir: stat.Mode.IsDir(),
|
|
||||||
- }
|
|
||||||
+
|
|
||||||
logrus.Infoln("downloading to file " + imagePath)
|
|
||||||
- if err = archive.CopyTo(tarStream, srcInfo, tmpMountPath); err != nil {
|
|
||||||
+ tmpTarPath := filepath.Join(PersistDir, "/os.tar")
|
|
||||||
+ if err = runCommand("tar", "-xvf", tmpTarPath, "-C", tmpMountPath); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
+ defer os.Remove(tmpTarPath)
|
|
||||||
return imagePath, nil
|
|
||||||
}
|
|
||||||
diff --git a/docs/example/config/crd/upgrade.openeuler.org_os.yaml b/docs/example/config/crd/upgrade.openeuler.org_os.yaml
|
|
||||||
index 465e803..f240b8d 100644
|
|
||||||
--- a/docs/example/config/crd/upgrade.openeuler.org_os.yaml
|
|
||||||
+++ b/docs/example/config/crd/upgrade.openeuler.org_os.yaml
|
|
||||||
@@ -51,7 +51,6 @@ spec:
|
|
||||||
maxunavailable:
|
|
||||||
type: integer
|
|
||||||
mtls:
|
|
||||||
- default: true
|
|
||||||
type: boolean
|
|
||||||
opstype:
|
|
||||||
type: string
|
|
||||||
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
|
|
||||||
index 6a616f5..3da4708 100644
|
|
||||||
--- a/scripts/Dockerfile
|
|
||||||
+++ b/scripts/Dockerfile
|
|
||||||
@@ -1,3 +1,3 @@
|
|
||||||
FROM scratch
|
|
||||||
-ADD os.tar /
|
|
||||||
+COPY os.tar /
|
|
||||||
CMD ["/bin/sh"]
|
|
||||||
diff --git a/scripts/common/utils.sh b/scripts/common/utils.sh
|
|
||||||
index 3546c8c..cf9441b 100644
|
|
||||||
--- a/scripts/common/utils.sh
|
|
||||||
+++ b/scripts/common/utils.sh
|
|
||||||
@@ -87,19 +87,53 @@ function delete_file() {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
-function check_binary_exist() {
|
|
||||||
- if [ ! -f "$1" ];then
|
|
||||||
- log_error_print "binary path is invalid."
|
|
||||||
+function check_file_valid() {
|
|
||||||
+ local file="$1"
|
|
||||||
+ local mesg="$2"
|
|
||||||
+ if [ ! -e "${file}" ]; then
|
|
||||||
+ log_error_print "${mesg} is not exist."
|
|
||||||
+ exit 3
|
|
||||||
+ fi
|
|
||||||
+ if [ ! -f "${file}" ];then
|
|
||||||
+ log_error_print "${mesg} is not a file."
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
-function check_repo_path() {
|
|
||||||
- if [ ! -f "$1" ];then
|
|
||||||
- log_error_print "REPO path is invalid."
|
|
||||||
+function check_conf_valid() {
|
|
||||||
+ local conf_path="${PWD}/00bootup/Global.cfg"
|
|
||||||
+ check_file_valid ${conf_path} "Globab.cfg"
|
|
||||||
+ if [ $# != 7 ];then
|
|
||||||
+ log_error_print "configure configured in Global.cfg is empty."
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
+ for addr in ${server_ip} ${local_ip} ${route_ip} ${netmask}; do
|
|
||||||
+ check_ip_valid $addr
|
|
||||||
+ done
|
|
||||||
+}
|
|
||||||
|
|
||||||
+function check_ip_valid() {
|
|
||||||
+ local ipaddr="$1";
|
|
||||||
+ if [[ ! $ipaddr =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] ; then
|
|
||||||
+ log_error_print "ip address configured in Global.cfg is not valid."
|
|
||||||
+ exit 3;
|
|
||||||
+ fi
|
|
||||||
+ for quad in $(echo "${ipaddr//./ }"); do
|
|
||||||
+ if [ $quad -ge 0 ] && [ $quad -le 255 ];then
|
|
||||||
+ continue
|
|
||||||
+ fi
|
|
||||||
+ log_error_print "ip address configured in Global.cfg is not valid."
|
|
||||||
+ exit 3;
|
|
||||||
+ done
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function check_binary_exist() {
|
|
||||||
+ check_file_valid "$1" "os-agent binary"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function check_repo_path() {
|
|
||||||
+ check_file_valid $1 "REPO file"
|
|
||||||
if [ -d "${RPM_ROOT}" ]; then
|
|
||||||
log_error_print "there is a rootfs folder. please confirm if rootfs is being used, if not, please remove ${RPM_ROOT} first."
|
|
||||||
exit 5
|
|
||||||
@@ -117,7 +151,7 @@ function check_disk_space() {
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
vm)
|
|
||||||
- local maxsize=$((5*1024*1024))
|
|
||||||
+ local maxsize=$((25*1024*1024))
|
|
||||||
if [ "${disk_ava}" -lt "${maxsize}" ]; then
|
|
||||||
log_error_print "The available disk space is not enough, at least 25GiB."
|
|
||||||
exit 6
|
|
||||||
diff --git a/scripts/create/imageCreate.sh b/scripts/create/imageCreate.sh
|
|
||||||
index 564c740..9689f62 100644
|
|
||||||
--- a/scripts/create/imageCreate.sh
|
|
||||||
+++ b/scripts/create/imageCreate.sh
|
|
||||||
@@ -62,13 +62,12 @@ function create_pxe_img() {
|
|
||||||
case $opt in
|
|
||||||
"repo")
|
|
||||||
create_os_tar_from_repo "$@"
|
|
||||||
- tar -xvf os.tar ./initramfs.img
|
|
||||||
;;
|
|
||||||
"docker")
|
|
||||||
create_os_tar_from_docker "$@"
|
|
||||||
- tar -xvf os.tar initramfs.img
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
+ tar -xvf os.tar ./initramfs.img
|
|
||||||
mv os.tar kubeos.tar
|
|
||||||
}
|
|
||||||
function create_docker_image() {
|
|
||||||
diff --git a/scripts/create/rootfsCreate.sh b/scripts/create/rootfsCreate.sh
|
|
||||||
index e5c53d5..4c02c35 100644
|
|
||||||
--- a/scripts/create/rootfsCreate.sh
|
|
||||||
+++ b/scripts/create/rootfsCreate.sh
|
|
||||||
@@ -65,8 +65,6 @@ EOF
|
|
||||||
cp set_in_chroot.sh "${RPM_ROOT}"
|
|
||||||
ROOT_PWD="${PASSWD}" chroot "${RPM_ROOT}" bash /set_in_chroot.sh
|
|
||||||
rm "${RPM_ROOT}/set_in_chroot.sh"
|
|
||||||
-
|
|
||||||
- #todo:chroot create initramfs.img to include install-scripts for PXE install
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_os_tar_from_repo() {
|
|
||||||
@@ -80,9 +78,9 @@ function create_os_tar_from_repo() {
|
|
||||||
tar -C "$RPM_ROOT" -cf ./os.tar .
|
|
||||||
}
|
|
||||||
function create_os_tar_from_docker() {
|
|
||||||
- local DOCKER_IMG=$1
|
|
||||||
- container_id=$(docker create ${DOCKER_IMG})
|
|
||||||
- echo "$container_id"
|
|
||||||
- docker export $container_id > os.tar
|
|
||||||
- docker rm $container_id
|
|
||||||
+ local DOCKER_IMG=$1
|
|
||||||
+ container_id=$(docker create ${DOCKER_IMG})
|
|
||||||
+ echo "$container_id"
|
|
||||||
+ docker cp $container_id:/os.tar ./
|
|
||||||
+ docker rm $container_id
|
|
||||||
}
|
|
||||||
diff --git a/scripts/kbimg.sh b/scripts/kbimg.sh
|
|
||||||
index a77d62e..a623e3d 100644
|
|
||||||
--- a/scripts/kbimg.sh
|
|
||||||
+++ b/scripts/kbimg.sh
|
|
||||||
@@ -24,6 +24,7 @@ source common/log.sh &>/dev/null
|
|
||||||
source common/utils.sh &>/dev/null
|
|
||||||
source create/rootfsCreate.sh &>/dev/null
|
|
||||||
source create/imageCreate.sh &>/dev/null
|
|
||||||
+source 00bootup/Global.cfg &>/dev/null
|
|
||||||
|
|
||||||
function show_options() {
|
|
||||||
cat << EOF
|
|
||||||
@@ -89,23 +90,6 @@ options:
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
-function show_pxe_image_usage() {
|
|
||||||
- cat << EOF
|
|
||||||
-
|
|
||||||
-Usage : kbimg create pxe-image -p iso-path -v os-version -b os-agent-dir -e os-password
|
|
||||||
- or
|
|
||||||
- kbimg create pxe-image -d repository/name:tag
|
|
||||||
-
|
|
||||||
-options:
|
|
||||||
- -p repo path
|
|
||||||
- -v KubeOS version
|
|
||||||
- -b directory of os-agent binary
|
|
||||||
- -e os encrypted password
|
|
||||||
- -d docker image like repository/name:tag
|
|
||||||
- -h,--help show help information
|
|
||||||
-EOF
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
function file_lock() {
|
|
||||||
local lock_file=$1
|
|
||||||
exec {lock_fd}>"${lock_file}"
|
|
||||||
@@ -282,6 +266,7 @@ function verify_create_input() {
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
check_disk_space "pxe"
|
|
||||||
+ check_conf_valid ${rootfs_name} ${disk} ${server_ip} ${local_ip} ${route_ip} ${netmask} ${net_name}
|
|
||||||
if [ $# -eq 8 ]; then
|
|
||||||
verify_repo_input "$@"
|
|
||||||
check_repo_path "${REPO}"
|
|
||||||
--
|
|
||||||
2.33.0.windows.2
|
|
||||||
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
From 54d0a0304a0f76a0e619a8adac370eb3866f52b1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
Date: Wed, 31 Aug 2022 18:06:28 +0800
|
|
||||||
Subject: [PATCH] KubeOS:add the clearing of space before the upgrade and
|
|
||||||
rectifying the rollback failure.
|
|
||||||
|
|
||||||
The pre-upgrade space clearance function is added to resolve the problem that the upgrade
|
|
||||||
fails due to residual resources when the upgrade is performed again after a power failure.
|
|
||||||
Fix the rollback failure when the upgrade fails due to the upgrade using different architectures.
|
|
||||||
|
|
||||||
Signed-off-by: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
---
|
|
||||||
cmd/agent/server/docker_image.go | 91 ++++++++++++++++++++++++++++----
|
|
||||||
scripts/grub.cfg | 10 ----
|
|
||||||
2 files changed, 81 insertions(+), 20 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmd/agent/server/docker_image.go b/cmd/agent/server/docker_image.go
|
|
||||||
index 11b21aa..4f9edc1 100644
|
|
||||||
--- a/cmd/agent/server/docker_image.go
|
|
||||||
+++ b/cmd/agent/server/docker_image.go
|
|
||||||
@@ -15,6 +15,7 @@ package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
+ "errors"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
@@ -47,9 +48,18 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
+ containerName := "kubeos-temp"
|
|
||||||
+ containers, err := cli.ContainerList(ctx, types.ContainerListOptions{All: true})
|
|
||||||
+ for _, container := range containers {
|
|
||||||
+ if container.Names[0] == "/"+containerName {
|
|
||||||
+ if err = cli.ContainerRemove(ctx, container.ID, types.ContainerRemoveOptions{}); err != nil {
|
|
||||||
+ return "", err
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
info, err := cli.ContainerCreate(ctx, &container.Config{
|
|
||||||
Image: imageName,
|
|
||||||
- }, nil, nil, "kubeos-temp")
|
|
||||||
+ }, nil, nil, containerName)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
@@ -71,22 +81,31 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
return "", fmt.Errorf("space is not enough for downloaing")
|
|
||||||
}
|
|
||||||
|
|
||||||
+ tmpUpdatePath := filepath.Join(PersistDir, "/KubeOS-Update")
|
|
||||||
+ tmpMountPath := filepath.Join(tmpUpdatePath, "/kubeos-update")
|
|
||||||
+ tmpTarPath := filepath.Join(tmpUpdatePath, "/os.tar")
|
|
||||||
+ imagePath := filepath.Join(PersistDir, "/update.img")
|
|
||||||
+
|
|
||||||
+ if err = cleanSpace(tmpUpdatePath, tmpMountPath, imagePath); err != nil {
|
|
||||||
+ return "", err
|
|
||||||
+ }
|
|
||||||
+ if err = os.MkdirAll(tmpMountPath, imgPermission); err != nil {
|
|
||||||
+ return "", err
|
|
||||||
+ }
|
|
||||||
+ defer os.RemoveAll(tmpUpdatePath)
|
|
||||||
+
|
|
||||||
srcInfo := archive.CopyInfo{
|
|
||||||
Path: "/",
|
|
||||||
Exists: true,
|
|
||||||
IsDir: stat.Mode.IsDir(),
|
|
||||||
}
|
|
||||||
- if err = archive.CopyTo(tarStream, srcInfo, PersistDir); err != nil {
|
|
||||||
+ if err = archive.CopyTo(tarStream, srcInfo, tmpUpdatePath); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
-
|
|
||||||
- tmpMountPath := filepath.Join(PersistDir, "/kubeos-update")
|
|
||||||
- if err = os.Mkdir(tmpMountPath, imgPermission); err != nil {
|
|
||||||
+ if err = runCommand("dd", "if=/dev/zero", "of="+imagePath, "bs=2M", "count=1024"); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
- defer os.Remove(tmpMountPath)
|
|
||||||
- imagePath := filepath.Join(PersistDir, "/update.img")
|
|
||||||
- if err = runCommand("dd", "if=/dev/zero", "of="+imagePath, "bs=2M", "count=1024"); err != nil {
|
|
||||||
+ if err = os.Chmod(imagePath, imgPermission); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
_, next, err := getNextPart(partA, partB)
|
|
||||||
@@ -102,10 +121,62 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
}()
|
|
||||||
|
|
||||||
logrus.Infoln("downloading to file " + imagePath)
|
|
||||||
- tmpTarPath := filepath.Join(PersistDir, "/os.tar")
|
|
||||||
if err = runCommand("tar", "-xvf", tmpTarPath, "-C", tmpMountPath); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
- defer os.Remove(tmpTarPath)
|
|
||||||
return imagePath, nil
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+func cleanSpace(updatePath, mountPath, imagePath string) error {
|
|
||||||
+ isFileExist, err := checkFileExist(mountPath)
|
|
||||||
+ if err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ if isFileExist {
|
|
||||||
+ var st syscall.Stat_t
|
|
||||||
+ if err := syscall.Lstat(mountPath, &st); err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ dev := st.Dev
|
|
||||||
+ parent := filepath.Dir(mountPath)
|
|
||||||
+ if err := syscall.Lstat(parent, &st); err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ if dev != st.Dev {
|
|
||||||
+ if err := syscall.Unmount(mountPath, 0); err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if err = deleteFile(updatePath); err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if err = deleteFile(imagePath); err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ return nil
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+func deleteFile(path string) error {
|
|
||||||
+ isFileExist, err := checkFileExist(path)
|
|
||||||
+ if err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ if isFileExist {
|
|
||||||
+ if err = os.RemoveAll(path); err != nil {
|
|
||||||
+ return err
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return nil
|
|
||||||
+}
|
|
||||||
+func checkFileExist(path string) (bool, error) {
|
|
||||||
+ if _, err := os.Stat(path); err == nil {
|
|
||||||
+ return true, nil
|
|
||||||
+ } else if errors.Is(err, os.ErrNotExist) {
|
|
||||||
+ return false, nil
|
|
||||||
+ } else {
|
|
||||||
+ return false, err
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/scripts/grub.cfg b/scripts/grub.cfg
|
|
||||||
index d10e4cf..c1a2641 100644
|
|
||||||
--- a/scripts/grub.cfg
|
|
||||||
+++ b/scripts/grub.cfg
|
|
||||||
@@ -91,11 +91,6 @@ menuentry 'A' --class KubeOS --class gnu-linux --class gnu --class os --unrestri
|
|
||||||
insmod part_msdos
|
|
||||||
insmod ext2
|
|
||||||
set root='hd0,msdos2'
|
|
||||||
- if [ x$feature_platform_search_hint = xy ]; then
|
|
||||||
- search --no-floppy --file --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 /boot/vmlinuz
|
|
||||||
- else
|
|
||||||
- search --no-floppy --file --set=root /boot/vmlinuz
|
|
||||||
- fi
|
|
||||||
linux /boot/vmlinuz root=/dev/sda2 ro rootfstype=ext4 nomodeset quiet oops=panic softlockup_panic=1 nmi_watchdog=1 rd.shell=0 selinux=0 crashkernel=256M panic=3
|
|
||||||
initrd /boot/initramfs.img
|
|
||||||
}
|
|
||||||
@@ -107,11 +102,6 @@ menuentry 'B' --class KubeOS --class gnu-linux --class gnu --class os --unrestri
|
|
||||||
insmod part_msdos
|
|
||||||
insmod ext2
|
|
||||||
set root='hd0,msdos3'
|
|
||||||
- if [ x$feature_platform_search_hint = xy ]; then
|
|
||||||
- search --no-floppy --file --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 /boot/vmlinuz
|
|
||||||
- else
|
|
||||||
- search --no-floppy --file --set=root /boot/vmlinuz
|
|
||||||
- fi
|
|
||||||
linux /boot/vmlinuz root=/dev/sda3 ro rootfstype=ext4 nomodeset quiet oops=panic softlockup_panic=1 nmi_watchdog=1 rd.shell=0 selinux=0 crashkernel=256M panic=3
|
|
||||||
initrd /boot/initramfs.img
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.33.0.windows.2
|
|
||||||
|
|
||||||
@ -1,254 +0,0 @@
|
|||||||
From a1bf179490d33c25dd49fe6c363eec5e0e8fe532 Mon Sep 17 00:00:00 2001
|
|
||||||
From: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
Date: Sat, 3 Sep 2022 14:21:54 +0800
|
|
||||||
Subject: [PATCH] KubeOS:add the configuration of /etc/resolv.conf and change
|
|
||||||
the VM disk to gpt.
|
|
||||||
|
|
||||||
Add the user-defined /etc/resolv.conf file and change the VM disk to gpt
|
|
||||||
to be the same as that on the physical machine.
|
|
||||||
|
|
||||||
Signed-off-by: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
---
|
|
||||||
cmd/agent/server/docker_image.go | 3 +-
|
|
||||||
scripts/00bootup/mount.sh | 50 ++++++++++++++++++--------------
|
|
||||||
scripts/bootloader.sh | 4 +--
|
|
||||||
scripts/create/imageCreate.sh | 12 ++++----
|
|
||||||
scripts/create/rootfsCreate.sh | 4 +++
|
|
||||||
scripts/grub.cfg | 8 ++---
|
|
||||||
6 files changed, 45 insertions(+), 36 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmd/agent/server/docker_image.go b/cmd/agent/server/docker_image.go
|
|
||||||
index 4f9edc1..735ace0 100644
|
|
||||||
--- a/cmd/agent/server/docker_image.go
|
|
||||||
+++ b/cmd/agent/server/docker_image.go
|
|
||||||
@@ -108,8 +108,7 @@ func pullOSImage(req *pb.UpdateRequest) (string, error) {
|
|
||||||
if err = os.Chmod(imagePath, imgPermission); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
- _, next, err := getNextPart(partA, partB)
|
|
||||||
- if err = runCommand("mkfs.ext4", "-L", "ROOT-"+next, imagePath); err != nil {
|
|
||||||
+ if err = runCommand("mkfs.ext4", "-L", "ROOT-A", imagePath); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if err = runCommand("mount", "-o", "loop", imagePath, tmpMountPath); err != nil {
|
|
||||||
diff --git a/scripts/00bootup/mount.sh b/scripts/00bootup/mount.sh
|
|
||||||
index 1bc83ff..7f00fd6 100644
|
|
||||||
--- a/scripts/00bootup/mount.sh
|
|
||||||
+++ b/scripts/00bootup/mount.sh
|
|
||||||
@@ -23,6 +23,14 @@ function CheckSpace() {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
+function mount_proc_dev_sys() {
|
|
||||||
+ local tmp_root=$1
|
|
||||||
+ mount -t proc none "${tmp_root}/proc"
|
|
||||||
+ mount --bind /dev "${tmp_root}/dev"
|
|
||||||
+ mount --bind /dev/pts "${tmp_root}/dev/pts"
|
|
||||||
+ mount -t sysfs none "${tmp_root}/sys"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
function GetDisk() {
|
|
||||||
disks=(`hwinfo --disk --short 2>&1 | grep -vi "^disk" | awk '{print $1}'`)
|
|
||||||
if [ ${#disks[*]} -gt 0 ]; then
|
|
||||||
@@ -162,14 +170,13 @@ function MountRoot() {
|
|
||||||
|
|
||||||
function MountPersist() {
|
|
||||||
echo "Mounting persist"
|
|
||||||
- mkdir /persist
|
|
||||||
- mount ${disk}4 /persist >> ${log} 2>&1
|
|
||||||
+ mount ${disk}4 /sysroot/persist >> ${log} 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "mount persist failed" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
- mkdir /persist/{var,etc,etcwork}
|
|
||||||
- mkdir -p /persist/etc/KubeOS/certs
|
|
||||||
+ mkdir /sysroot/persist/{var,etc,etcwork}
|
|
||||||
+ mkdir -p /sysroot/persist/etc/KubeOS/certs
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -187,20 +194,20 @@ function MountBoot() {
|
|
||||||
function GetRootfs() {
|
|
||||||
echo "Downloading rootfs..."
|
|
||||||
|
|
||||||
- curl -o /persist/${rootfs_name} http://${server_ip}/${rootfs_name}
|
|
||||||
- if [ ! -e "/persist/${rootfs_name}" ]; then
|
|
||||||
+ curl -o /${rootfs_name} http://${server_ip}/${rootfs_name}
|
|
||||||
+ if [ ! -e "/${rootfs_name}" ]; then
|
|
||||||
echo "download rootfs failed" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- tar -xvf /persist/${rootfs_name} -C /sysroot
|
|
||||||
+ tar -xf /${rootfs_name} -C /sysroot
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "decompose rootfs failed" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- rm -rf /persist/${rootfs_name}
|
|
||||||
-
|
|
||||||
+ rm -rf /${rootfs_name}
|
|
||||||
+ mount -o remount,ro ${disk}2 /sysroot >> ${log} 2>&1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -283,6 +290,8 @@ function Bootup_Main() {
|
|
||||||
fi
|
|
||||||
|
|
||||||
# mount partitions
|
|
||||||
+
|
|
||||||
+ # mount boot
|
|
||||||
echo "Mounting root..." | tee -a ${log}
|
|
||||||
MountRoot
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
@@ -290,15 +299,6 @@ function Bootup_Main() {
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- # mount persist
|
|
||||||
- echo "Mounting persisst..." | tee -a ${log}
|
|
||||||
- MountPersist
|
|
||||||
- if [ $? -ne 0 ]; then
|
|
||||||
- echo "Mounting persist failed" | tee -a ${log}
|
|
||||||
- return 1
|
|
||||||
- fi
|
|
||||||
-
|
|
||||||
- # mount boot
|
|
||||||
echo "Mounting boot..." | tee -a ${log}
|
|
||||||
MountBoot
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
@@ -313,7 +313,7 @@ function Bootup_Main() {
|
|
||||||
echo "Downloading rootfs failed" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
-
|
|
||||||
+ mount_proc_dev_sys /sysroot
|
|
||||||
# set boot
|
|
||||||
echo "Setting boot..." | tee -a ${log}
|
|
||||||
SetBoot
|
|
||||||
@@ -321,7 +321,13 @@ function Bootup_Main() {
|
|
||||||
echo "Setting boot failed" | tee -a ${log}
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
-
|
|
||||||
+ # mount persist
|
|
||||||
+ echo "Mounting persist..." | tee -a ${log}
|
|
||||||
+ MountPersist
|
|
||||||
+ if [ $? -ne 0 ]; then
|
|
||||||
+ echo "Mounting persist failed" | tee -a ${log}
|
|
||||||
+ return 1
|
|
||||||
+ fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -329,7 +335,7 @@ Bootup_Main
|
|
||||||
ret=$?
|
|
||||||
if [ ${ret} -eq 0 ]; then
|
|
||||||
echo "kubeOS install success! switch to root" | tee -a ${log}
|
|
||||||
- cp ${log} /persist
|
|
||||||
+ cp ${log} /sysroot/persist
|
|
||||||
else
|
|
||||||
echo "kubeOS install failed, see install.log" | tee -a ${log}
|
|
||||||
-fi
|
|
||||||
\ No newline at end of file
|
|
||||||
+fi
|
|
||||||
diff --git a/scripts/bootloader.sh b/scripts/bootloader.sh
|
|
||||||
index 0f906d4..5760f3d 100644
|
|
||||||
--- a/scripts/bootloader.sh
|
|
||||||
+++ b/scripts/bootloader.sh
|
|
||||||
@@ -16,7 +16,7 @@ function install_grub2_x86 ()
|
|
||||||
|
|
||||||
# make efi file, and save in FAT16 partition, to support UEFI boot mode
|
|
||||||
cp -r /usr/lib/grub/x86_64-efi boot/efi/EFI/openEuler
|
|
||||||
- eval "grub2-mkimage -d /usr/lib/grub/x86_64-efi -O x86_64-efi --output=/boot/efi/EFI/openEuler/grubx64.efi '--prefix=(,msdos1)/EFI/openEuler' fat part_gpt part_msdos linux"
|
|
||||||
+ eval "grub2-mkimage -d /usr/lib/grub/x86_64-efi -O x86_64-efi --output=/boot/efi/EFI/openEuler/grubx64.efi '--prefix=(,gpt1)/EFI/openEuler' fat part_gpt part_msdos linux"
|
|
||||||
|
|
||||||
mkdir -p /boot/EFI/BOOT/
|
|
||||||
cp -f /boot/efi/EFI/openEuler/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
|
|
||||||
@@ -25,7 +25,7 @@ function install_grub2_x86 ()
|
|
||||||
function install_grub2_efi ()
|
|
||||||
{
|
|
||||||
cp -r /usr/lib/grub/arm64-efi /boot/efi/EFI/openEuler/
|
|
||||||
- eval "grub2-mkimage -d /usr/lib/grub/arm64-efi -O arm64-efi --output=/boot/efi/EFI/openEuler/grubaa64.efi '--prefix=(,msdos1)/EFI/openEuler' fat part_gpt part_msdos linux"
|
|
||||||
+ eval "grub2-mkimage -d /usr/lib/grub/arm64-efi -O arm64-efi --output=/boot/efi/EFI/openEuler/grubaa64.efi '--prefix=(,gpt1)/EFI/openEuler' fat part_gpt part_msdos linux"
|
|
||||||
|
|
||||||
mkdir -p /boot/EFI/BOOT/
|
|
||||||
cp -f /boot/efi/EFI/openEuler/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI
|
|
||||||
diff --git a/scripts/create/imageCreate.sh b/scripts/create/imageCreate.sh
|
|
||||||
index 9689f62..e615d5f 100644
|
|
||||||
--- a/scripts/create/imageCreate.sh
|
|
||||||
+++ b/scripts/create/imageCreate.sh
|
|
||||||
@@ -16,12 +16,12 @@ PWD="$(pwd)"
|
|
||||||
function create_img() {
|
|
||||||
rm -f system.img update.img
|
|
||||||
qemu-img create system.img ${IMG_SIZE}G
|
|
||||||
- parted system.img -- mklabel msdos
|
|
||||||
- parted system.img -- mkpart primary fat16 1MiB 60MiB
|
|
||||||
- parted system.img -- mkpart primary ext4 60MiB 2160MiB
|
|
||||||
- parted system.img -- mkpart primary ext4 2160MiB 4260MiB
|
|
||||||
- parted system.img -- mkpart primary ext4 4260MiB 100%
|
|
||||||
-
|
|
||||||
+ parted system.img -s mklabel gpt
|
|
||||||
+ parted system.img -s mkpart primary fat32 1MiB 60MiB
|
|
||||||
+ parted system.img -s mkpart primary ext4 60MiB 2160MiB
|
|
||||||
+ parted system.img -s mkpart primary ext4 2160MiB 4260MiB
|
|
||||||
+ parted system.img -s mkpart primary ext4 4260MiB 100%
|
|
||||||
+ parted system.img -s set 1 boot on
|
|
||||||
local device=$(losetup -f)
|
|
||||||
losetup "${device}" system.img
|
|
||||||
|
|
||||||
diff --git a/scripts/create/rootfsCreate.sh b/scripts/create/rootfsCreate.sh
|
|
||||||
index 4c02c35..29f2762 100644
|
|
||||||
--- a/scripts/create/rootfsCreate.sh
|
|
||||||
+++ b/scripts/create/rootfsCreate.sh
|
|
||||||
@@ -46,6 +46,7 @@ function install_misc() {
|
|
||||||
local VERSION=$1
|
|
||||||
local AGENT_PATH=$2
|
|
||||||
local PASSWD=$3
|
|
||||||
+ local DNS_CONF="${PWD}/resolv.conf"
|
|
||||||
cp ../files/*mount ../files/os-agent.service "${RPM_ROOT}/usr/lib/systemd/system/"
|
|
||||||
cp ../files/os-release "${RPM_ROOT}/usr/lib/"
|
|
||||||
cp "${AGENT_PATH}" "${RPM_ROOT}/usr/bin"
|
|
||||||
@@ -65,6 +66,9 @@ EOF
|
|
||||||
cp set_in_chroot.sh "${RPM_ROOT}"
|
|
||||||
ROOT_PWD="${PASSWD}" chroot "${RPM_ROOT}" bash /set_in_chroot.sh
|
|
||||||
rm "${RPM_ROOT}/set_in_chroot.sh"
|
|
||||||
+ if [ -e "${DNS_CONF}" ]; then
|
|
||||||
+ cp "${DNS_CONF}" "${RPM_ROOT}/etc/resolv.conf"
|
|
||||||
+ fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_os_tar_from_repo() {
|
|
||||||
diff --git a/scripts/grub.cfg b/scripts/grub.cfg
|
|
||||||
index c1a2641..984b161 100644
|
|
||||||
--- a/scripts/grub.cfg
|
|
||||||
+++ b/scripts/grub.cfg
|
|
||||||
@@ -88,9 +88,9 @@ menuentry 'A' --class KubeOS --class gnu-linux --class gnu --class os --unrestri
|
|
||||||
load_video
|
|
||||||
set gfxpayload=keep
|
|
||||||
insmod gzio
|
|
||||||
- insmod part_msdos
|
|
||||||
+ insmod part_gpt
|
|
||||||
insmod ext2
|
|
||||||
- set root='hd0,msdos2'
|
|
||||||
+ set root='hd0,gpt2'
|
|
||||||
linux /boot/vmlinuz root=/dev/sda2 ro rootfstype=ext4 nomodeset quiet oops=panic softlockup_panic=1 nmi_watchdog=1 rd.shell=0 selinux=0 crashkernel=256M panic=3
|
|
||||||
initrd /boot/initramfs.img
|
|
||||||
}
|
|
||||||
@@ -99,9 +99,9 @@ menuentry 'B' --class KubeOS --class gnu-linux --class gnu --class os --unrestri
|
|
||||||
load_video
|
|
||||||
set gfxpayload=keep
|
|
||||||
insmod gzio
|
|
||||||
- insmod part_msdos
|
|
||||||
+ insmod part_gpt
|
|
||||||
insmod ext2
|
|
||||||
- set root='hd0,msdos3'
|
|
||||||
+ set root='hd0,gpt3'
|
|
||||||
linux /boot/vmlinuz root=/dev/sda3 ro rootfstype=ext4 nomodeset quiet oops=panic softlockup_panic=1 nmi_watchdog=1 rd.shell=0 selinux=0 crashkernel=256M panic=3
|
|
||||||
initrd /boot/initramfs.img
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.33.0.windows.2
|
|
||||||
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
From d638f26cdf8f22b258e97baec83a261a2de315ee Mon Sep 17 00:00:00 2001
|
|
||||||
From: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
Date: Tue, 29 Nov 2022 16:39:20 +0800
|
|
||||||
Subject: [PATCH] KubeOS: remove grub2 legacy install, add error handling for
|
|
||||||
opstype and add entry for unit test in Makefile
|
|
||||||
|
|
||||||
Remove grub2 install for legacy setup to fix failure of x86
|
|
||||||
vm images building. Add the error handling of the abnormal value
|
|
||||||
of the opstype. Add an entry for unit testing in Makefile.
|
|
||||||
|
|
||||||
Signed-off-by: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
---
|
|
||||||
Makefile | 3 +++
|
|
||||||
cmd/agent/server/docker_image_test.go | 21 ---------------------
|
|
||||||
cmd/proxy/controllers/os_controller.go | 3 +++
|
|
||||||
scripts/bootloader.sh | 8 --------
|
|
||||||
4 files changed, 6 insertions(+), 29 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 38cc2ce..9d9fbea 100644
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -50,6 +50,9 @@ agent:
|
|
||||||
${ENV} ${GO_BUILD} -tags "osusergo netgo static_build" -ldflags '$(LDFLAGS)' $(BUILDFLAGS) -o bin/os-agent cmd/agent/main.go
|
|
||||||
strip bin/os-agent
|
|
||||||
|
|
||||||
+test:
|
|
||||||
+ $(GO) test $(shell go list ./... ) -race -cover -count=1 -timeout=300s
|
|
||||||
+
|
|
||||||
# Install CRDs into a cluster
|
|
||||||
install: manifests
|
|
||||||
kubectl apply -f confg/crd
|
|
||||||
diff --git a/cmd/agent/server/docker_image_test.go b/cmd/agent/server/docker_image_test.go
|
|
||||||
index cc77a2b..9987939 100644
|
|
||||||
--- a/cmd/agent/server/docker_image_test.go
|
|
||||||
+++ b/cmd/agent/server/docker_image_test.go
|
|
||||||
@@ -52,24 +52,3 @@ func TestpullOSImage(t *testing.T) {
|
|
||||||
}
|
|
||||||
defer os.RemoveAll("/persist")
|
|
||||||
}
|
|
||||||
-
|
|
||||||
-func TestrandStringBytesRmndr(t *testing.T) {
|
|
||||||
- type args struct {
|
|
||||||
- n int
|
|
||||||
- }
|
|
||||||
- tests := []struct {
|
|
||||||
- name string
|
|
||||||
- args args
|
|
||||||
- want string
|
|
||||||
- }{
|
|
||||||
- {name: "normal", args: args{n: 6}, want: ""},
|
|
||||||
- }
|
|
||||||
- for _, tt := range tests {
|
|
||||||
- t.Run(tt.name, func(t *testing.T) {
|
|
||||||
- if got := randStringBytesRmndr(tt.args.n); got == "" {
|
|
||||||
- t.Errorf("randStringBytesRmndr() not generatre random string")
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- })
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
diff --git a/cmd/proxy/controllers/os_controller.go b/cmd/proxy/controllers/os_controller.go
|
|
||||||
index 09e58f9..fdd31ea 100644
|
|
||||||
--- a/cmd/proxy/controllers/os_controller.go
|
|
||||||
+++ b/cmd/proxy/controllers/os_controller.go
|
|
||||||
@@ -15,6 +15,7 @@ package controllers
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
+ "fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
|
||||||
@@ -123,6 +124,8 @@ func (r *OSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Re
|
|
||||||
if err := r.Connection.RollbackSpec(); err != nil {
|
|
||||||
return values.RequeueNow, err
|
|
||||||
}
|
|
||||||
+ default:
|
|
||||||
+ return values.RequeueNow, fmt.Errorf("operation %s cannot be recognized", opsType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return values.Requeue, nil
|
|
||||||
diff --git a/scripts/bootloader.sh b/scripts/bootloader.sh
|
|
||||||
index 5760f3d..16c5713 100644
|
|
||||||
--- a/scripts/bootloader.sh
|
|
||||||
+++ b/scripts/bootloader.sh
|
|
||||||
@@ -6,14 +6,6 @@ ARCH=`arch`
|
|
||||||
|
|
||||||
function install_grub2_x86 ()
|
|
||||||
{
|
|
||||||
- # make boot.img/core.img and setup, to support legacy boot mode
|
|
||||||
- GRUBNAME=$(which grub2-install)
|
|
||||||
- echo "Installing GRUB2..."
|
|
||||||
- GRUB_OPTS=${GRUB_OPTS:-"--force"}
|
|
||||||
- GRUB_OPTS="$GRUB_OPTS --target=i386-pc"
|
|
||||||
-
|
|
||||||
- $GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $DEVICE
|
|
||||||
-
|
|
||||||
# make efi file, and save in FAT16 partition, to support UEFI boot mode
|
|
||||||
cp -r /usr/lib/grub/x86_64-efi boot/efi/EFI/openEuler
|
|
||||||
eval "grub2-mkimage -d /usr/lib/grub/x86_64-efi -O x86_64-efi --output=/boot/efi/EFI/openEuler/grubx64.efi '--prefix=(,gpt1)/EFI/openEuler' fat part_gpt part_msdos linux"
|
|
||||||
--
|
|
||||||
2.37.1.windows.1
|
|
||||||
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
From 20f66b28ea95e262f54cad1a9b65d564f91b8d12 Mon Sep 17 00:00:00 2001
|
|
||||||
From: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
Date: Thu, 8 Dec 2022 15:08:52 +0800
|
|
||||||
Subject: [PATCH] KubeOS:fix usage does not print when an error occurs in the
|
|
||||||
upgrade image creation
|
|
||||||
|
|
||||||
Fix the bug that the usage does not print
|
|
||||||
when the upgrade image has parameter errors
|
|
||||||
|
|
||||||
Signed-off-by: liyuanr <liyuanrong1@huawei.com>
|
|
||||||
---
|
|
||||||
scripts/kbimg.sh | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/scripts/kbimg.sh b/scripts/kbimg.sh
|
|
||||||
index a623e3d..a860c06 100644
|
|
||||||
--- a/scripts/kbimg.sh
|
|
||||||
+++ b/scripts/kbimg.sh
|
|
||||||
@@ -125,6 +125,7 @@ function verify_upgrade_image_input() {
|
|
||||||
echo "$@" | grep -q "\-$i "
|
|
||||||
if [ "$?" -ne 0 ];then
|
|
||||||
log_error_print "option -$i is mandatory, please check input"
|
|
||||||
+ show_upgrade_image_usage
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
--
|
|
||||||
2.33.0.windows.2
|
|
||||||
|
|
||||||
17
KubeOS.spec
17
KubeOS.spec
@ -1,18 +1,11 @@
|
|||||||
# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
|
# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
|
||||||
|
|
||||||
Name: KubeOS
|
Name: KubeOS
|
||||||
Version: 1.0.2
|
Version: 1.0.3
|
||||||
Release: 8
|
Release: 1
|
||||||
Summary: O&M platform used to update the whole OS as an entirety
|
Summary: O&M platform used to update the whole OS as an entirety
|
||||||
License: Mulan PSL v2
|
License: Mulan PSL v2
|
||||||
Source0: https://gitee.com/openeuler/KubeOS/repository/archive/v%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/KubeOS/repository/archive/v%{version}.tar.gz
|
||||||
Patch1: 0001-Write-a-tool-to-support-KubeOS-deployment-on-physica.patch
|
|
||||||
Patch2: 0002-KubeOS-fix-the-kbimg.sh-exception-and-pxe-installati.patch
|
|
||||||
Patch3: 0003-KubeOS-fixed-the-issue-of-VMs-images-and-add-check-o.patch
|
|
||||||
Patch4: 0004-KubeOS-add-the-clearing-of-space-before-the-upgrade-.patch
|
|
||||||
Patch5: 0005-KubeOS-add-the-configuration-of-etc-resolv.conf-and-.patch
|
|
||||||
Patch6: 0006-KubeOS-remove-grub2-legacy-install-add-error-handlin.patch
|
|
||||||
Patch7: 0007-KubeOS-fix-usage-does-not-print-when-an-error-occurs.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
BuildRequires: golang >= 1.13
|
BuildRequires: golang >= 1.13
|
||||||
@ -113,6 +106,12 @@ install -p -m 0600 ./files/os-release %{buildroot}/opt/kubeOS/files
|
|||||||
rm -rfv %{buildroot}
|
rm -rfv %{buildroot}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 16 2023 liyuanrong<liyuanrong1@huawei.com> - 1.0.3-1
|
||||||
|
- Type:requirement
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:restart
|
||||||
|
- DESC:update to 1.0.3-1
|
||||||
|
|
||||||
* Thu Dec 08 2022 liyuanrong<liyuanrong1@huawei.com> - 1.0.2-8
|
* Thu Dec 08 2022 liyuanrong<liyuanrong1@huawei.com> - 1.0.2-8
|
||||||
- Type:requirement
|
- Type:requirement
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
BIN
v1.0.2.tar.gz
BIN
v1.0.2.tar.gz
Binary file not shown.
BIN
v1.0.3.tar.gz
Normal file
BIN
v1.0.3.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user