From 7cf37c209d8012a405561e1f43412fdc3c4c4ca0 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Sat, 27 Jan 2024 23:07:48 -0500 Subject: [PATCH] rename build.sh to build-helper.sh & have build.sh launch build-helper.sh for the actual build process for git updates --- build-helper.sh | 36 ++++++++++++++++++++++++++++++++++++ build.sh | 38 +++++--------------------------------- 2 files changed, 41 insertions(+), 33 deletions(-) create mode 100755 build-helper.sh diff --git a/build-helper.sh b/build-helper.sh new file mode 100755 index 0000000..90c32c9 --- /dev/null +++ b/build-helper.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +kernel_version="6.7.2" +zen_version="zen1" +source_url="https://github.com/zen-kernel/zen-kernel/archive/refs/tags/v${kernel_version}-${zen_version}.tar.gz" +source_file="v${kernel_version}-${zen_version}.tar.gz" + +is_package_installed() { + dnf list installed "$1" &> /dev/null + return $? +} + +if [ -f "SOURCES/${source_file}" ]; then + rm -f "SOURCES/${source_file}" +fi + +for dir in BUILD BUILDROOT RPMS SOURCES SPECS SRPMS; do + if [ ! -d "$dir" ]; then + mkdir "$dir" + fi +done + +required_packages=(gcc make flex bison ncurses-devel elfutils-libelf-devel openssl-devel clang llvm rpm-build redhat-rpm-config rpmdevtools dwarves) + +for package in "${required_packages[@]}"; do + if ! is_package_installed "$package"; then + sudo dnf install -y "$package" + fi +done + +if [ ! -f "SOURCES/${source_file}" ]; then + wget -P SOURCES/ "${source_url}" +fi + +rpmbuild -ba --define "_topdir $PWD" SPECS/linux-zen.spec + diff --git a/build.sh b/build.sh index 90c32c9..936a2f0 100755 --- a/build.sh +++ b/build.sh @@ -1,36 +1,8 @@ -#!/bin/bash +git pull -kernel_version="6.7.2" -zen_version="zen1" -source_url="https://github.com/zen-kernel/zen-kernel/archive/refs/tags/v${kernel_version}-${zen_version}.tar.gz" -source_file="v${kernel_version}-${zen_version}.tar.gz" - -is_package_installed() { - dnf list installed "$1" &> /dev/null - return $? -} - -if [ -f "SOURCES/${source_file}" ]; then - rm -f "SOURCES/${source_file}" +if [ ! -x "build-helper.sh" ]; then + echo "build-helper.sh not found or not executable. Making it executable..." + chmod +x build-helper.sh fi -for dir in BUILD BUILDROOT RPMS SOURCES SPECS SRPMS; do - if [ ! -d "$dir" ]; then - mkdir "$dir" - fi -done - -required_packages=(gcc make flex bison ncurses-devel elfutils-libelf-devel openssl-devel clang llvm rpm-build redhat-rpm-config rpmdevtools dwarves) - -for package in "${required_packages[@]}"; do - if ! is_package_installed "$package"; then - sudo dnf install -y "$package" - fi -done - -if [ ! -f "SOURCES/${source_file}" ]; then - wget -P SOURCES/ "${source_url}" -fi - -rpmbuild -ba --define "_topdir $PWD" SPECS/linux-zen.spec - +./build-helper.sh