Fixes the k3s install to allow VHDX integration. (#3412)

* Fixes the k3s install to allow VHDX integration.

* Updates install patch file to fix local build

Co-authored-by: Lior Lustgarten <lilustg@microsoft.com>
This commit is contained in:
Lior Lustgarten 2022-07-29 13:25:58 -04:00 коммит произвёл GitHub
Родитель 7e3e070147
Коммит f18729c397
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 61 добавлений и 1 удалений

57
SPECS/k3s/install.patch Normal file
Просмотреть файл

@ -0,0 +1,57 @@
From bd240e73ab1f815dcd2aac4b1bcd5d022c581aa9 Mon Sep 17 00:00:00 2001
From: Lior Lustgarten <lilustg@microsoft.com>
Date: Fri, 22 Jul 2022 05:39:08 -0700
Subject: [PATCH] fix for install while building VHDX
---
package/rpm/install.sh | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/package/rpm/install.sh b/package/rpm/install.sh
index bd3a459d97..73f65c9b19 100755
--- a/package/rpm/install.sh
+++ b/package/rpm/install.sh
@@ -43,12 +43,8 @@ set -e
# Commit of k3s to download from temporary cloud storage.
# * (for developer & QA use)
#
-# - INSTALL_K3S_BIN_DIR
-# Directory to install k3s binary, links, and uninstall script to, or use
-# /usr/local/bin as the default
-#
# - INSTALL_K3S_BIN_DIR_READ_ONLY
-# If set to true will not write files to INSTALL_K3S_BIN_DIR, forces
+# If set to true will not write files to BIN_DIR, forces
# setting INSTALL_K3S_SKIP_DOWNLOAD=true
#
# - INSTALL_K3S_SYSTEMD_DIR
@@ -114,15 +110,8 @@ fatal()
# --- fatal if no systemd or openrc ---
verify_system() {
- if [ -x /sbin/openrc-run ]; then
- HAS_OPENRC=true
- return
- fi
- if [ -d /run/systemd ]; then
- HAS_SYSTEMD=true
- return
- fi
- fatal 'Can not find systemd or openrc to use as a process supervisor for k3s'
+ HAS_SYSTEMD=true
+ return
}
# --- add quotes to command arguments ---
@@ -219,7 +208,7 @@ setup_env() {
fi
# --- use binary install directory if defined or create default ---
- BIN_DIR=${INSTALL_K3S_BIN_DIR:-/usr/local/bin}
+ BIN_DIR=/usr/local/bin
DATA_DIR=/var/lib/rancher/k3s
# --- set related files from system name ---
--
2.17.1

Просмотреть файл

@ -7,7 +7,7 @@
Name: k3s
Version: 1.23.6
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Lightweight Kubernetes
Group: System Environment/Base
@ -30,6 +30,7 @@ Source0: https://github.com/k3s-io/%{name}/archive/refs/tags/v%{version}+k3s1.ta
# 10. tar -cf %%{name}-%%{version}-vendor.tar.gz vendor
Source1: %{name}-%{version}-vendor.tar.gz
Patch0: vendor_build.patch
Patch1: install.patch
# K3s on Mariner is supported on x86_64 only:
ExclusiveArch: x86_64
@ -82,6 +83,8 @@ exit 0
%{install_sh}
%changelog
* Thu Jul 21 2022 Lior Lustgarten <lilustga@microsoft.com> 1.23.6-3
- Fixes the install section. Allows integration of k3s at runtime in the Mariner build environment.
* Wed Jun 29 2022 Lior Lustgarten <lilustga@microsoft.com> 1.23.6-2
- Fixed uninstall path
- Added exclusivity for x86_64