From b0d370ee30c0f0bbe3fb0555e59a90a59142a5c4 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Fri, 2 Aug 2024 21:05:34 +0200 Subject: [PATCH] build: modify Signed-off-by: AuxXxilium --- .github/workflows/autobuild.yml | 74 +-------------------------------- .github/workflows/build.yml | 4 +- Taskfile.yaml | 5 +++ img-gen-s.sh | 63 ++++++++++++++++++++++++++++ img-gen.sh | 49 +--------------------- scripts/func.sh | 47 ++++++++++++++------- 6 files changed, 106 insertions(+), 136 deletions(-) create mode 100755 img-gen-s.sh diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 99d7b9d2..c7794ce5 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -73,8 +73,6 @@ jobs: echo "THEMETAG=${TAG}" >> $GITHUB_ENV getBuildroot "latest" "brx" echo "BR_XVERSION=${TAG}" >> $GITHUB_ENV - getBuildroot "latest-s" "brs" - echo "BR_SVERSION=${TAG}" >> $GITHUB_ENV getOffline "files/p3/configs" echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV @@ -137,64 +135,6 @@ jobs: zip -9j update.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/boot/grub/grub.cfg" sha256sum update.zip >checksum.sha256 - # Build incremental - - name: Build Image S - run: | - . scripts/func.sh - - if [ -n "${VERSION}" ]; then - VERSION="${VERSION}-s" - # Modify Source File - echo "${VERSION}" >VERSION - echo "${VERSION}" >files/p1/ARC-VERSION - sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i files/initrd/opt/arc/include/consts.sh - fi - - echo "Create Arc Image" - IMAGE_FILE="arc-s.img" - gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}" - fdisk -l "${IMAGE_FILE}" - - LOOPX=$(sudo losetup -f) - sudo losetup -P "${LOOPX}" "${IMAGE_FILE}" - - echo "Mounting Image File" - mkdir -p "/tmp/p1" - mkdir -p "/tmp/p3" - sudo mount ${LOOPX}p1 "/tmp/p1" - sudo mount ${LOOPX}p3 "/tmp/p3" - - [ ! -f "brs/bzImage-arc" ] || [ ! -f "brs/initrd-arc" ] && return 1 - - echo "Repack initrd" - cp -f "brs/bzImage-arc" "files/p3/bzImage-arc" - repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc" - - echo "Copying files" - sudo cp -Rf "files/p1/"* "/tmp/p1" - sudo cp -Rf "files/p3/"* "/tmp/p3" - sync - - echo "Unmount image file" - sudo umount "/tmp/p1" - sudo umount "/tmp/p3" - rmdir "/tmp/p1" - rmdir "/tmp/p3" - - sudo losetup --detach ${LOOPX} - - echo "Image Converter" - qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-s-dyn.vmdk - qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc-s.vmdk - qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc-s.vhdx - - echo "Create Arc ova" - convertova "${IMAGE_FILE}" "arc-s.ova" - - # Zip update and generate checksum - zip -9j update-s.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/boot/grub/grub.cfg" - sha256sum update-s.zip >checksum-s.sha256 - # Zip image and generate checksum - name: Pack run: | @@ -205,14 +145,7 @@ jobs: zip -9 "arc-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk zip -9 "arc-${{ env.VERSION }}.vhdx.zip" arc.vhdx zip -9 "arc-${{ env.VERSION }}.ova.zip" arc.ova - # SBase - zip -9 "arc-${{ env.VERSION }}-s.img.zip" arc-s.img - zip -9 "arc-${{ env.VERSION }}-s.vmdk-dyn.zip" arc-s-dyn.vmdk - zip -9 "arc-${{ env.VERSION }}-s.vmdk-flat.zip" arc-s.vmdk arc-s-flat.vmdk - zip -9 "arc-${{ env.VERSION }}-s.vhdx.zip" arc-s.vhdx - zip -9 "arc-${{ env.VERSION }}-s.ova.zip" arc-s.ova fi - echo "${{ inputs.update_version }}" >check.update # Publish a release if is a tag - name: Release @@ -241,11 +174,8 @@ jobs: Custom: ${{ env.CUSTOMTAG }} Theme: ${{ env.THEMETAG }} LKM: ${{ env.LKMTAG }} - Buildroot: ${{ env.BR_XVERSION }} | Buildroot S: ${{ env.BR_SVERSION }} + Buildroot: ${{ env.BR_XVERSION }} artifacts: | arc-*.zip update.zip - update-s.zip - checksum.sha256 - checksum-s.sha256 - check.update \ No newline at end of file + checksum.sha256 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1da2a1b..57af88aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,9 +99,9 @@ jobs: echo "CUSTOMTAG=${TAG}" >> $GITHUB_ENV getTheme "files/p1/boot/grub" echo "THEMETAG=${TAG}" >> $GITHUB_ENV - getBuildroot "latest" "brx" + getBuildrootx "latest" "brx" echo "BR_XVERSION=${TAG}" >> $GITHUB_ENV - getBuildroot "latest-s" "brs" + getBuildroots "latest" "brs" echo "BR_SVERSION=${TAG}" >> $GITHUB_ENV getOffline "files/p3/configs" echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV diff --git a/Taskfile.yaml b/Taskfile.yaml index e3376727..98be0e3b 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -8,6 +8,11 @@ tasks: - git pull - ./img-gen.sh + build-img-s: + cmds: + - git pull + - ./img-gen-s.sh + compile-kpatch: dir: kpatch cmds: diff --git a/img-gen-s.sh b/img-gen-s.sh new file mode 100755 index 00000000..dcf39da7 --- /dev/null +++ b/img-gen-s.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +set -e + +# Clean cached Files +sudo git clean -fdx + +. scripts/func.sh + +# Get extractor, LKM, addons and Modules +getLKMs "files/p3/lkms" +getAddons "files/p3/addons" +getModules "files/p3/modules" +getConfigs "files/p3/configs" +getPatches "files/p3/patches" +getCustom "files/p3/custom" +getTheme "files/p1/boot/grub" +getOffline "files/p3/configs" +getBuildroots "latest-s" "brs" + +# Sbase +IMAGE_FILE="arc-s.img" +gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}" +fdisk -l "${IMAGE_FILE}" + +LOOPX=$(sudo losetup -f) +sudo losetup -P "${LOOPX}" "${IMAGE_FILE}" + +echo "Mounting Image File" +sudo rm -rf "/tmp/p1" +sudo rm -rf "/tmp/p3" +mkdir -p "/tmp/p1" +mkdir -p "/tmp/p3" +sudo mount ${LOOPX}p1 "/tmp/p1" +sudo mount ${LOOPX}p3 "/tmp/p3" + +[[ ! -f "brs/bzImage-arc" || ! -f "brs/initrd-arc" ]] && return 1 + +VERSION=$(date +'%y.%-m.dev') +echo "${VERSION}-s" >files/p1/ARC-VERSION +echo "${VERSION}-s" >VERSION +sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}-s'"/' -i files/initrd/opt/arc/include/consts.sh + +echo "Repack initrd" +cp -f "brs/bzImage-arc" "files/p3/bzImage-arc" +repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc" + +echo "Copying files" +sudo cp -Rf "files/p1/"* "/tmp/p1" +sudo cp -Rf "files/p3/"* "/tmp/p3" +sync + +echo "Unmount image file" +sudo umount "/tmp/p1" +sudo umount "/tmp/p3" +rmdir "/tmp/p1" +rmdir "/tmp/p3" + +sudo losetup --detach ${LOOPX} + +qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-s-dyn.vmdk +qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc-s.vmdk +qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc-s.vhdx \ No newline at end of file diff --git a/img-gen.sh b/img-gen.sh index dde1fc12..a47bc466 100755 --- a/img-gen.sh +++ b/img-gen.sh @@ -16,8 +16,7 @@ getPatches "files/p3/patches" getCustom "files/p3/custom" getTheme "files/p1/boot/grub" getOffline "files/p3/configs" -getBuildroot "latest" "brx" -getBuildroot "latest-s" "brs" +getBuildrootx "latest" "brx" # Xbase IMAGE_FILE="arc.img" @@ -61,48 +60,4 @@ sudo losetup --detach ${LOOPX} qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk -qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx - -# Sbase -IMAGE_FILE="arc-s.img" -gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}" -fdisk -l "${IMAGE_FILE}" - -LOOPX=$(sudo losetup -f) -sudo losetup -P "${LOOPX}" "${IMAGE_FILE}" - -echo "Mounting Image File" -sudo rm -rf "/tmp/p1" -sudo rm -rf "/tmp/p3" -mkdir -p "/tmp/p1" -mkdir -p "/tmp/p3" -sudo mount ${LOOPX}p1 "/tmp/p1" -sudo mount ${LOOPX}p3 "/tmp/p3" - -[[ ! -f "brs/bzImage-arc" || ! -f "brs/initrd-arc" ]] && return 1 - -VERSION=$(date +'%y.%-m.dev') -echo "${VERSION}-s" >files/p1/ARC-VERSION -echo "${VERSION}-s" >VERSION -sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}-s'"/' -i files/initrd/opt/arc/include/consts.sh - -echo "Repack initrd" -cp -f "brs/bzImage-arc" "files/p3/bzImage-arc" -repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc" - -echo "Copying files" -sudo cp -Rf "files/p1/"* "/tmp/p1" -sudo cp -Rf "files/p3/"* "/tmp/p3" -sync - -echo "Unmount image file" -sudo umount "/tmp/p1" -sudo umount "/tmp/p3" -rmdir "/tmp/p1" -rmdir "/tmp/p3" - -sudo losetup --detach ${LOOPX} - -qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-s-dyn.vmdk -qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc-s.vmdk -qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc-s.vhdx \ No newline at end of file +qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx \ No newline at end of file diff --git a/scripts/func.sh b/scripts/func.sh index 56749962..e55d6d39 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -221,37 +221,54 @@ function getTheme() { echo "Getting Theme end - ${TAG}" } -# Get latest Buildroot +# Get latest Buildroot-X # $1 TAG # $2 path -function getBuildroot() { - echo "Getting Buildroot begin" +function getBuildrootx() { + echo "Getting Buildroot-X begin" TAG="${1:-latest}" local DEST_PATH="${2:-brx}" if [ "${TAG}" = "latest" ]; then - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" fi [ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}" rm -f "${DEST_PATH}/bzImage-arc" - if [ "${TAG}" = "latest-s" ]; then - STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot/releases/download/${TAG}-s/bzImage" -o "${DEST_PATH}/bzImage-arc") - else - STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-arc") - fi + STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot-x/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-arc") echo "TAG=${TAG}; Status=${STATUS}" [ ${STATUS} -ne 200 ] && exit 1 rm -f "${DEST_PATH}/initrd-arc" - if [ "${TAG}" = "latest-s" ]; then - STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot/releases/download/${TAG}-s/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-arc") - else - STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-arc") - fi + STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot-x/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-arc") echo "TAG=${TAG}; Status=${STATUS}" [ ${STATUS} -ne 200 ] && exit 1 - echo "Getting Buildroot end - ${TAG}" + echo "Getting Buildroot-X end - ${TAG}" +} + +# Get latest Buildroot-S +# $1 TAG +# $2 path +function getBuildroots() { + echo "Getting Buildroot-S begin" + TAG="${1:-latest}" + local DEST_PATH="${2:-brs}" + + if [ "${TAG}" = "latest" ]; then + TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + fi + [ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}" + rm -f "${DEST_PATH}/bzImage-arc" + STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot-s/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-arc") + echo "TAG=${TAG}; Status=${STATUS}" + [ ${STATUS} -ne 200 ] && exit 1 + + rm -f "${DEST_PATH}/initrd-arc" + STATUS=$(curl -w "%{http_code}" -L "https://github.com/AuxXxilium/arc-buildroot-s/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-arc") + echo "TAG=${TAG}; Status=${STATUS}" + [ ${STATUS} -ne 200 ] && exit 1 + + echo "Getting Buildroot-S end - ${TAG}" } # Get latest Offline