custom: cleanup

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2024-10-14 19:38:47 +02:00
parent 91a9406b19
commit e84cbce7a0
3 changed files with 43 additions and 174 deletions

View File

@@ -34,11 +34,16 @@ jobs:
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y build-essential libtool pkgconf libzstd-dev liblzma-dev libssl-dev # kmodule dependencies
sudo apt install -y build-essential libtool pkgconf libzstd-dev liblzma-dev libssl-dev busybox dialog curl xz-utils cpio sed qemu-utils
- name: Get Release Data for Arc
YQ=$(command -v yq)
if [ -z "${YQ}" ] || ! ${YQ} --version 2>/dev/null | grep -q "v4."; then
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O "${YQ:-"/usr/bin/yq"}" && chmod +x "${YQ:-"/usr/bin/yq"}"
fi
- name: Get Addon Data for Arc
run: |
REPO="${{ github.server_url }}/${{ github.repository }}"
REPO="https://github.com/AuxXxilium/arc-addons"
PRERELEASE="true"
TAG=""
@@ -49,28 +54,53 @@ jobs:
TAG="${LATESTURL##*/}"
fi
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
rm -f arc-${TAG}.img.zip
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/arc-${TAG}.img.zip" -o "arc-${TAG}.img.zip")
rm -f addons.zip
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/addons.zip" -o "addons.zip")
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
echo "Download failed"
exit 1
fi
unzip arc-${TAG}.img.zip -d "arc"
mkdir -p "mnt/p3/addons"
unzip addons.zip -d "mnt/p3/addons"
for i in $(find "mnt/p3/addons" -type f -name "*.addon"); do
if [ -f "${i}" ]; then
mkdir -p "mnt/p3/addons/$(basename "${i}" .addon)"
tar -xaf "${i}" -C "mnt/p3/addons/$(basename "${i}" .addon)"
fi
done
rm -f addons.zip
sudo ./localbuild.sh create arc/ws arc/arc.img
if [ $? -ne 0 ]; then
echo "create failed"
- name: Get Config Data for Arc
run: |
REPO="https://github.com/AuxXxilium/arc-configs"
PRERELEASE="true"
TAG=""
if [ "${PRERELEASE}" = "true" ]; then
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)"
else
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
TAG="${LATESTURL##*/}"
fi
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
rm -f configs.zip
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/configs.zip" -o "configs.zip")
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
echo "Download failed"
exit 1
fi
mkdir -p "mnt/p3/configs"
unzip configs.zip -d "mnt/p3/configs"
rm -f configs.zip
- name: Get data
run: |
pip install -r scripts/requirements.txt
python scripts/func.py getmodels -w "arc/ws" -j "docs/models.json"
python scripts/func.py getaddons -w "arc/ws" -j "docs/addons.json"
python scripts/func.py getmodules -w "arc/ws" -j "docs/modules.json"
python scripts/func.py getpats -w "arc/ws" -j "docs/pats.json"
python scripts/func.py getmodels -w "." -j "docs/models.json"
python scripts/func.py getaddons -w "." -j "docs/addons.json"
python scripts/func.py getpats -w "." -j "docs/pats.json"
- name: Upload to Artifacts
if: success()

View File

@@ -494,21 +494,6 @@
"r1000": true,
"epyc7002": true
},
"sanmanager-repair": {
"system": false,
"description": "Repair SAN Manager in DSM (Only use if you have a broken SAN Manager)",
"apollolake": true,
"broadwell": true,
"broadwellnk": true,
"broadwellnkv2": true,
"broadwellntbap": true,
"denverton": true,
"geminilake": true,
"purley": true,
"v1000": true,
"r1000": true,
"epyc7002": true
},
"sensors": {
"system": false,
"description": "Install sensors package to monitor temperature of CPU and other components",

View File

@@ -1,146 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
PROMPT=$(sudo -nv 2>&1)
if [ $? -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
function help() {
echo "Usage: $0 <command> [args]"
echo "Commands:"
echo " create [workspace] [arc.img] - Create the workspace"
echo " pack [arc.img] - Pack to arc.img"
echo " help - Show this help"
exit 1
}
function create() {
WORKSPACE="$(realpath ${1:-"workspace"})"
ARCIMGPATH="$(realpath ${2:-"arc.img"})"
if [ ! -f "${ARCIMGPATH}" ]; then
echo "File not found: ${ARCIMGPATH}"
exit 1
fi
sudo apt update
sudo apt install -y busybox dialog curl xz-utils cpio sed qemu-utils
YQ=$(command -v yq)
if [ -z "${YQ}" ] || ! ${YQ} --version 2>/dev/null | grep -q "v4."; then
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O "${YQ:-"/usr/bin/yq"}" && chmod +x "${YQ:-"/usr/bin/yq"}"
fi
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${ARCIMGPATH}"
echo "Mounting image file"
rm -rf "/tmp/mnt/p1"
rm -rf "/tmp/mnt/p2"
rm -rf "/tmp/mnt/p3"
mkdir -p "/tmp/mnt/p1"
mkdir -p "/tmp/mnt/p2"
mkdir -p "/tmp/mnt/p3"
sudo mount ${LOOPX}p1 "/tmp/mnt/p1" || (
echo -e "Can't mount ${LOOPX}p1."
exit 1
)
sudo mount ${LOOPX}p2 "/tmp/mnt/p2" || (
echo -e "Can't mount ${LOOPX}p2."
exit 1
)
sudo mount ${LOOPX}p3 "/tmp/mnt/p3" || (
echo -e "Can't mount ${LOOPX}p3."
exit 1
)
echo "Create WORKSPACE"
rm -rf "${WORKSPACE}"
mkdir -p "${WORKSPACE}/mnt"
mkdir -p "${WORKSPACE}/tmp"
mkdir -p "${WORKSPACE}/initrd"
cp -rf "/tmp/mnt/p1" "${WORKSPACE}/mnt/p1"
cp -rf "/tmp/mnt/p2" "${WORKSPACE}/mnt/p2"
cp -rf "/tmp/mnt/p3" "${WORKSPACE}/mnt/p3"
sudo sync
sudo umount "/tmp/mnt/p1"
sudo umount "/tmp/mnt/p2"
sudo umount "/tmp/mnt/p3"
rm -rf "/tmp/mnt/p1"
rm -rf "/tmp/mnt/p2"
rm -rf "/tmp/mnt/p3"
sudo losetup --detach ${LOOPX}
rm -f $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/arc.env
echo "OK."
}
function pack() {
if [ ! -f $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/arc.env ]; then
echo "Please run init first"
exit 1
fi
. $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/arc.env
ARCIMGPATH="$(realpath ${1:-"arc.img"})"
if [ ! -f "${ARCIMGPATH}" ]; then
gzip -dc "${CHROOT_PATH}/initrd/opt/arc/grub.img.gz" >"${ARCIMGPATH}"
fi
fdisk -l "${ARCIMGPATH}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${ARCIMGPATH}"
echo "Mounting image file"
rm -rf "/tmp/mnt/p1"
rm -rf "/tmp/mnt/p2"
rm -rf "/tmp/mnt/p3"
mkdir -p "/tmp/mnt/p1"
mkdir -p "/tmp/mnt/p2"
mkdir -p "/tmp/mnt/p3"
sudo mount ${LOOPX}p1 "/tmp/mnt/p1" || (
echo -e "Can't mount ${LOOPX}p1."
exit 1
)
sudo mount ${LOOPX}p2 "/tmp/mnt/p2" || (
echo -e "Can't mount ${LOOPX}p2."
exit 1
)
sudo mount ${LOOPX}p3 "/tmp/mnt/p3" || (
echo -e "Can't mount ${LOOPX}p3."
exit 1
)
echo "Pack image file"
sudo cp -rf "${CHROOT_PATH}/mnt/p1/"* "/tmp/mnt/p1" || (
echo -e "Can't cp ${LOOPX}p1."
exit 1
)
sudo cp -rf "${CHROOT_PATH}/mnt/p2/"* "/tmp/mnt/p2" || (
echo -e "Can't cp ${LOOPX}p2."
exit 1
)
sudo cp -rf "${CHROOT_PATH}/mnt/p3/"* "/tmp/mnt/p3" || (
echo -e "Can't cp ${LOOPX}p3."
exit 1
)
sudo sync
sudo umount "/tmp/mnt/p1"
sudo umount "/tmp/mnt/p2"
sudo umount "/tmp/mnt/p3"
rm -rf "/tmp/mnt/p1"
rm -rf "/tmp/mnt/p2"
rm -rf "/tmp/mnt/p3"
sudo losetup --detach ${LOOPX}
echo "OK."
}
$@