Compare commits

..

46 Commits
1.5.5 ... 1.4.1

Author SHA1 Message Date
AuxXxilium
5c4a706f5e Merge pull request #5563 from AuxXxilium/dev
Dev
2025-01-05 15:00:36 +01:00
AuxXxilium
1b0ff6be81 Merge pull request #5489 from AuxXxilium/dev
build: cleanup files
2025-01-01 20:44:40 +01:00
AuxXxilium
7c65ca476a Merge pull request #5486 from AuxXxilium/dev
arc-functions: remove empty line in sysinfo
2025-01-01 19:44:24 +01:00
AuxXxilium
6ba66a0647 Merge pull request #5485 from AuxXxilium/dev
Dev
2025-01-01 19:02:28 +01:00
AuxXxilium
b181a360e4 Merge pull request #5483 from AuxXxilium/dev
grub: update
2025-01-01 17:39:43 +01:00
AuxXxilium
40dc71a8ef Merge pull request #5482 from AuxXxilium/dev
Dev
2025-01-01 17:03:35 +01:00
AuxXxilium
acd61976fc Merge pull request #5458 from AuxXxilium/dev
Dev
2024-12-31 04:54:23 +01:00
AuxXxilium
dd2c1f2341 Merge pull request #5449 from AuxXxilium/dev
Dev
2024-12-30 18:44:57 +01:00
AuxXxilium
e21c1ac334 Merge pull request #5447 from AuxXxilium/dev
Dev
2024-12-30 17:50:14 +01:00
AuxXxilium
fc1577bb43 Merge pull request #5424 from AuxXxilium/dev
build: update more
2024-12-29 16:24:19 +01:00
AuxXxilium
80cd767a75 Merge pull request #5423 from AuxXxilium/dev
build: fix
2024-12-29 15:04:50 +01:00
AuxXxilium
700183ff64 Merge pull request #5409 from AuxXxilium/dev
func: fix dual build
2024-12-28 19:21:13 +01:00
AuxXxilium
adba4d3421 Merge pull request #5406 from AuxXxilium/dev
build: fix
2024-12-28 17:06:54 +01:00
AuxXxilium
1026800376 Merge pull request #5405 from AuxXxilium/dev
bootscreen: fix config
2024-12-28 16:48:53 +01:00
AuxXxilium
6d07ffcaad Merge pull request #5404 from AuxXxilium/dev
arc: fix logic
2024-12-28 16:09:53 +01:00
AuxXxilium
af62a307e5 Merge pull request #5403 from AuxXxilium/dev
Dev
2024-12-28 13:43:54 +01:00
AuxXxilium
ce7ea49481 Merge pull request #5395 from AuxXxilium/dev
Dev
2024-12-27 23:47:59 +01:00
AuxXxilium
f742fc599a Merge pull request #5373 from AuxXxilium/dev
func: update
2024-12-27 00:30:52 +01:00
AuxXxilium
09ee2325b3 Merge pull request #5354 from AuxXxilium/dev
boot: fix styling
2024-12-26 00:18:18 +01:00
AuxXxilium
08111df903 Merge pull request #5342 from AuxXxilium/dev
build: update more
2024-12-24 21:10:32 +01:00
AuxXxilium
8935cb0ac5 Merge pull request #5340 from AuxXxilium/dev
build: fix
2024-12-24 17:06:31 +01:00
AuxXxilium
6a198d8930 Merge pull request #5339 from AuxXxilium/dev
Dev
2024-12-24 17:02:52 +01:00
AuxXxilium
8ae235c6bd Merge pull request #5332 from AuxXxilium/dev
Dev
2024-12-24 02:50:42 +01:00
AuxXxilium
33dab8b349 Merge pull request #5331 from AuxXxilium/dev
arc: fix more
2024-12-24 01:47:17 +01:00
AuxXxilium
b0a626303b Merge pull request #5330 from AuxXxilium/dev
Dev
2024-12-24 01:38:16 +01:00
AuxXxilium
34b3b1d14c Merge pull request #5321 from AuxXxilium/dev
boot: extend message
2024-12-23 17:24:04 +01:00
AuxXxilium
8c322ba04b Merge pull request #5320 from AuxXxilium/dev
Dev
2024-12-23 17:01:39 +01:00
AuxXxilium
6b2fc8b0a5 Merge pull request #5282 from AuxXxilium/dev
Dev
2024-12-20 16:16:24 +01:00
AuxXxilium
8f4cb31962 Merge pull request #5255 from AuxXxilium/dev
Dev
2024-12-18 21:25:18 +01:00
AuxXxilium
80d3118e7d Merge pull request #5231 from AuxXxilium/dev
Dev
2024-12-11 22:21:20 +01:00
AuxXxilium
a4a3c1998b Merge pull request #5133 from AuxXxilium/dev
functions: rewrite text
2024-12-07 18:51:59 +01:00
AuxXxilium
8adb3026f7 Merge pull request #5128 from AuxXxilium/dev
arc: fix port change
2024-12-07 15:25:13 +01:00
AuxXxilium
4902d10167 Merge pull request #5124 from AuxXxilium/dev
Dev
2024-12-07 13:45:34 +01:00
AuxXxilium
fe3430df09 Merge pull request #5093 from AuxXxilium/dev
Dev
2024-12-05 19:38:57 +01:00
AuxXxilium
a40b66063a Merge pull request #5066 from AuxXxilium/dev
Dev
2024-12-03 22:17:06 +01:00
AuxXxilium
04da524e3d Merge pull request #5065 from AuxXxilium/dev
Dev
2024-12-03 22:05:58 +01:00
AuxXxilium
135505bf22 Merge pull request #5046 from AuxXxilium/dev
tree: fix more logic
2024-12-02 23:53:57 +01:00
AuxXxilium
85e636d0e6 Merge pull request #5045 from AuxXxilium/dev
func: fix typo
2024-12-02 23:30:28 +01:00
AuxXxilium
a886046e64 Merge pull request #5044 from AuxXxilium/dev
Dev
2024-12-02 23:12:32 +01:00
AuxXxilium
8d2b2acb62 Merge pull request #5029 from AuxXxilium/dev
arc: update model table
2024-12-01 20:46:09 +01:00
AuxXxilium
0acb2020c8 Merge pull request #5028 from AuxXxilium/dev
tree: rewrite more
2024-12-01 19:19:29 +01:00
AuxXxilium
fb44e027b3 Merge pull request #5027 from AuxXxilium/dev
Dev
2024-12-01 18:12:30 +01:00
AuxXxilium
a3f6d44b52 Merge pull request #5024 from AuxXxilium/dev
Dev
2024-12-01 16:44:44 +01:00
AuxXxilium
4418bfa3f9 Merge pull request #5005 from AuxXxilium/dev
tree: fix automated
2024-11-30 23:27:14 +01:00
AuxXxilium
9a50bf50ea Merge pull request #5003 from AuxXxilium/dev
Dev
2024-11-30 22:16:48 +01:00
AuxXxilium
0cf78e4fbf Merge pull request #5000 from AuxXxilium/dev
Dev
2024-11-30 20:18:33 +01:00
30 changed files with 2084 additions and 2258 deletions

View File

@@ -32,6 +32,14 @@ on:
description: "pre release"
default: false
type: boolean
minimal:
description: "minimal"
default: true
type: boolean
extended:
description: "extended"
default: false
type: boolean
clean:
description: "clean"
default: false
@@ -52,7 +60,7 @@ jobs:
releases_keep_latest: 1
delete_workflows: false
delete_tags: true
gh_token: ${{ secrets.BUILD_TOKEN }}
gh_token: ${{ secrets.GITHUB_TOKEN }}
# Install Dependencies
- name: Install Dependencies
@@ -86,7 +94,8 @@ jobs:
getOffline "files/p3/configs"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getBuildroot "evo" "br"
getBuildrootx "brx"
getBuildroots "brs"
# Export Dependencies Version to env
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
@@ -96,30 +105,32 @@ jobs:
echo "CUSTOMTAG=${CUSTOMTAG}" >> $GITHUB_ENV
echo "LKMTAG=${LKMTAG}" >> $GITHUB_ENV
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
echo "BRTAG=${BRTAG}" >> $GITHUB_ENV
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
# Build incremental
- name: Build Image
- name: Build extended Image
if: ${{ inputs.extended }}
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="$(date +'%y%m%d')"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="evo"
echo "${ARC_BUILD}" > "files/p1/ARC-BUILD"
ARC_BRANCH="extended"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "${ARC_VERSION}" > "files/p1/ARC-VERSION"
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "${ARC_BRANCH}" > "files/p1/ARC-BRANCH"
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc.img"
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
IMAGE_FILE="arc_create.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
@@ -131,11 +142,11 @@ jobs:
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[ ! -f "br/bzImage-arc" ] || [ ! -f "br/initrd-arc" ] && return 1
[ ! -f "brx/bzImage-arc" ] || [ ! -f "brx/initrd-arc" ] && return 1
echo "Repack initrd"
cp -f "br/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "br/initrd-arc" "files/initrd" "files/p3/initrd-arc"
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
@@ -150,7 +161,12 @@ jobs:
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
echo "Image Converter"
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
@@ -162,7 +178,93 @@ jobs:
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack Image
- name: Pack extended Image
if: ${{ inputs.extended }}
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhd.zip" arc.vhd arc.vmc
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.ova.zip" arc.ova
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
sha256sum update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip >"update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.hash"
fi
# Cleanup
- name: Cleanup
run: |
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null
# Build incremental
- name: Build minimal Image
if: ${{ inputs.minimal }}
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="minimal"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc_create.img"
gzip -dc "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"
sudo sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
echo "Image Converter"
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
echo "Create Arc vhd"
createvmc "arc.vmc"
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack minimal Image
if: ${{ inputs.minimal }}
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
@@ -188,9 +290,12 @@ jobs:
- ${{ inputs.notice }}
### Information:
- Discord Account for Arc Patch needed
- Changelog is available in my Discord
- Based on VisionZ Evolution Code Base
- Discord Account for Arc Patch needed
### Versions:
${{ inputs.minimal && '- minimal: Full Image, all dependencies are included (reduced size, faster boot)' || '' }}
${{ inputs.extended && '- extended: Full Image, all dependencies are included (new features to test)' || '' }}
### Dependencies:
- Addons: ${{ env.ADDONTAG }}
@@ -199,7 +304,8 @@ jobs:
- Patches: ${{ env.PATCHTAG }}
- Custom: ${{ env.CUSTOMTAG }}
- LKMs: ${{ env.LKMTAG }}
- Basesystem: ${{ env.BRTAG }}
${{ inputs.minimal && format('- Buildroot minimal: {0}', env.BRSTAG) || '' }}
${{ inputs.extended && format('- Buildroot extended: {0}', env.BRXTAG) || '' }}
### Release
- ${{ env.BUILD_TIME }}

View File

@@ -161,41 +161,64 @@ jobs:
cp -f "${IMAGE_FILE}" "arc.img"
# Zip image and generate checksum
- name: Convert & Pack
run: |
rm -rf arc-*.zip 2>/dev/null
if [ "${{ env.FORMAT }}" = "img" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" arc.img
elif [ "${{ env.FORMAT }}" = "dyn" ]; then
if [ "${{ env.FORMAT }}" = "dyn" ]; then
echo "Image Converter -> dyn"
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,compat6 arc-dyn.vmdk
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
elif [ "${{ env.FORMAT }}" = "flat" ]; then
echo "Image Converter -> flat"
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat,compat6 arc.vmdk
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
echo "Image Converter -> vhdx"
qemu-img convert arc.img -O vhdx -o subformat=dynamic arc.vhdx
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" arc.vhdx
elif [ "${{ env.FORMAT }}" = "ova" ]; then
echo "Image Converter -> ova"
convertova "arc.img" "arc.ova"
fi
# Zip image and generate checksum
- name: Pack
run: |
if [ "${{ env.FORMAT }}" = "img" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" arc.img
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" "https://file.io")"
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
echo "Upload failed"
exit 1
fi
elif [ "${{ env.FORMAT }}" = "dyn" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" "https://file.io")"
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
echo "Upload failed"
exit 1
fi
elif [ "${{ env.FORMAT }}" = "flat" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" "https://file.io")"
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
echo "Upload failed"
exit 1
fi
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" arc.vhdx
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" "https://file.io")"
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
echo "Upload failed"
exit 1
fi
elif [ "${{ env.FORMAT }}" = "ova" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" arc.ova
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" "https://file.io")"
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
echo "Upload failed"
exit 1
fi
fi
EMAIL=$(curl -s -H "Authorization: token ${{ secrets.ACTION }}" "https://api.github.com/users/${{ github.event.issue.user.login }}" | jq -r '.email')
FIOURL="$(echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+')"
echo "EMAIL=${EMAIL}" >> $GITHUB_ENV
# Upload artifact
- name: Upload to Artifacts
uses: actions/upload-artifact@v4
with:
name: arc-${{ env.MODEL }}-${{ env.VERSION }}-${{ github.run_id }}
path: |
arc-*.zip
retention-days: 1
echo "FIOURL=${FIOURL}" >> $GITHUB_ENV
- name: Send mail
if: success() && env.EMAIL != 'null'
@@ -209,12 +232,7 @@ jobs:
to: ${{ env.EMAIL }}
from: ${{ secrets.MAIL_USERNAME }}
body: |
Hi @${{ github.event.issue.user.login }}.
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download:
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
If this isn't working, do not use customized Versions!
----
${{ env.FIOURL }}
- name: Update Comment Success
if: success()
@@ -226,10 +244,10 @@ jobs:
update-mode: replace
body: |
Hi @${{ github.event.issue.user.login }}.
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download:
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download: ${{ env.FIOURL }}
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
If this isn't working, do not use customized Versions!
If this will not work, do not use customized Versions!
----
- name: Update Comment Fail
@@ -242,8 +260,10 @@ jobs:
update-mode: replace
body: |
Hi @${{ github.event.issue.user.login }}.
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again later.
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again.
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
If this will not work, do not use customized Versions!
----
- name: Close Issues

View File

@@ -28,8 +28,8 @@ jobs:
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y autoconf automake autopoint build-essential pkg-config bison flex gettext gawk libtool dosfstools e2fsprogs
sudo apt install -y libfreetype6-dev unifont fonts-dejavu libfuse-dev libzfslinux-dev liblzma-dev libdevmapper-dev
sudo apt install -y autoconf automake autopoint gettext build-essential bison flex libtool dosfstools e2fsprogs
sudo apt install -y libfreetype6-dev unifont fonts-dejavu libfuse-dev liblzma-dev libzfslinux-dev
- name: Make Grub
run: |
@@ -40,7 +40,6 @@ jobs:
if: success() && inputs.push == true
run: |
if [ -f "grub.img.gz" ]; then
mv -f "grub.img.gz" "files/initrd/opt/arc/grub.img.gz"
echo "Git push ..."
git pull
status=$(git status -s | grep -E 'grub.img.gz' | awk '{printf " %s", $2}')

View File

@@ -3,11 +3,17 @@
version: "3"
tasks:
build-evo:
build-ext:
cmds:
- git reset --hard
- git pull
- ./img-gen.sh evo
- ./img-ext.sh
build-min:
cmds:
- git reset --hard
- git pull
- ./img-min.sh
compile-kpatch:
dir: kpatch

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -8,9 +8,14 @@ set -e
# Clear logs for dbgutils addons
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
BUS=$(getBus "${LOADER_DISK}")
FBI=$(cat /sys/class/graphics/fb*/name 2>/dev/null | head -1)
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
# Print Title centralized
@@ -18,14 +23,15 @@ clear
COLUMNS=${COLUMNS:-50}
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
TITLE="Version:"
TITLE+=" ${ARC_VERSION} (${ARC_BUILD}) | Branch: ${ARC_BRANCH}"
TITLE+=" ${ARC_VERSION} (${ARC_BUILD})"
[ -n "${ARC_BRANCH}" ] && TITLE+=" | Branch: ${ARC_BRANCH}"
printf "\033[1;30m%*s\n" ${COLUMNS} ""
printf "\033[1;30m%*s\033[A\n" ${COLUMNS} ""
printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
TITLE="Boot:"
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [BIOS]"
TITLE+=" | Device: [${BUS}] | Mode: [${ARCMODE}]"
TITLE+=" [${BUS}]"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
# Check if DSM zImage/Ramdisk is changed, patch it if necessary, update Files if necessary
ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")"
@@ -53,28 +59,6 @@ DSMINFO="$(readConfigKey "bootscreen.dsminfo" "${USER_CONFIG_FILE}")"
SYSTEMINFO="$(readConfigKey "bootscreen.systeminfo" "${USER_CONFIG_FILE}")"
DISKINFO="$(readConfigKey "bootscreen.diskinfo" "${USER_CONFIG_FILE}")"
HWIDINFO="$(readConfigKey "bootscreen.hwidinfo" "${USER_CONFIG_FILE}")"
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
# Build Sanity Check
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
if [ -z "${MODELID}" ] || [ "${MODELID}" != "${MODEL}" ]; then
die "Loader build not completed! Model mismatch!"
fi
# HardwareID Check
if [ "${ARCPATCH}" = "true" ]; then
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
HWID="$(genHWID)"
if [ "${HARDWAREID}" != "${HWID}" ]; then
echo -e "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
sleep 5
rebootTo "config"
fi
fi
if [ "${DSMINFO}" = "true" ]; then
echo -e "\033[1;37mDSM:\033[0m"
@@ -89,8 +73,6 @@ if [ "${SYSTEMINFO}" = "true" ]; then
echo -e "Vendor: \033[1;37m${VENDOR}\033[0m"
echo -e "CPU: \033[1;37m${CPU}\033[0m"
echo -e "Memory: \033[1;37m${RAMTOTAL}GB\033[0m"
echo -e "Governor: \033[1;37m${GOVERNOR}\033[0m"
[ "${USBMOUNT}" = "true" ] && echo -e "USB Mount: \033[1;37m${USBMOUNT}\033[0m"
echo
fi
if [ "${DISKINFO}" = "true" ]; then
@@ -127,32 +109,34 @@ SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
KERNELPANIC="$(readConfigKey "kernelpanic" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
MODBLACKLIST="$(readConfigKey "modblacklist" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# HardwareID Check
if [ "${ARCPATCH}" = "true" ]; then
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
HWID="$(genHWID)"
if [ "${HARDWAREID}" != "${HWID}" ]; then
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
sleep 5
rebootTo "config"
fi
fi
declare -A CMDLINE
# Automated Cmdline
CMDLINE["syno_hw_version"]="${MODELID}"
CMDLINE["syno_hw_version"]="${MODELID:-${MODEL}}"
CMDLINE["vid"]="${VID:-"0x46f4"}" # Sanity check
CMDLINE["pid"]="${PID:-"0x0001"}" # Sanity check
CMDLINE["sn"]="${SN}"
# NIC Cmdline
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)
ETHN=$(echo "${ETHX}" | wc -w)
ETHM=${ETHM:-${ETHN}}
NIC=0
for N in ${ETHX}; do
MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}" 2>/dev/null)
MAC=${MAC:-$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')}
CMDLINE["mac$((++NIC))"]="${MAC}"
[ ${NIC} -ge ${ETHM} ] && break
done
CMDLINE["netif_num"]="${NIC}"
# Boot Cmdline
if grep -q "force_junior" /proc/cmdline; then
CMDLINE["force_junior"]=""
@@ -175,14 +159,13 @@ if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
SIZE=$((${SZ:-0} * ${SS:-0} / 1024 / 1024 + 10))
# Read SATADoM type
SATADOM="$(readConfigKey "satadom" "${USER_CONFIG_FILE}")"
CMDLINE['synoboot_satadom']="${SATADOM:-2}"
CMDLINE['dom_szmax']="${SIZE}"
CMDLINE["synoboot_satadom"]="${SATADOM:-2}"
CMDLINE["dom_szmax"]="${SIZE}"
fi
CMDLINE["elevator"]="elevator"
CMDLINE['elevator']="elevator"
else
CMDLINE["split_lock_detect"]="off"
fi
if [ "${DT}" = "true" ]; then
CMDLINE["syno_ttyS0"]="serial,0x3f8"
CMDLINE["syno_ttyS1"]="serial,0x2f8"
@@ -194,33 +177,35 @@ fi
CMDLINE["HddHotplug"]="1"
CMDLINE["vender_format_version"]="2"
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
CMDLINE['earlyprintk']=""
CMDLINE['earlycon']="uart8250,io,0x3f8,115200n8"
CMDLINE['console']="ttyS0,115200n8"
CMDLINE['consoleblank']="600"
CMDLINE["skip_vender_mac_interfaces"]="0,1,2,3,4,5,6,7"
CMDLINE["earlyprintk"]=""
CMDLINE["earlycon"]="uart8250,io,0x3f8,115200n8"
CMDLINE["console"]="ttyS0,115200n8"
CMDLINE["consoleblank"]="600"
# CMDLINE['no_console_suspend']="1"
CMDLINE['root']="/dev/md0"
CMDLINE['loglevel']="15"
CMDLINE['log_buf_len']="32M"
CMDLINE['rootwait']=""
CMDLINE["root"]="/dev/md0"
CMDLINE["loglevel"]="15"
CMDLINE["log_buf_len"]="32M"
CMDLINE["rootwait"]=""
CMDLINE['panic']="${KERNELPANIC:-0}"
# CMDLINE['intremap']="off" # workaround for mlx5_core througput issues from linux mailing list (need more testing)
# CMDLINE['amd_iommu_intr']="legacy" # workaround for mlx5_core througput issues from linux mailing list (need more testing)
# CMDLINE['intremap']="off" # no need
# CMDLINE['amd_iommu_intr']="legacy" # no need
# CMDLINE['split_lock_detect']="off" # check KVER
CMDLINE['pcie_aspm']="off"
# CMDLINE['intel_pstate']="disable"
# CMDLINE['amd_pstate']="disable"
# CMDLINE['nox2apic']="" # check platform
# CMDLINE['nomodeset']=""
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
CMDLINE["modprobe.blacklist"]="${MODBLACKLIST}"
if [ "${USBMOUNT}" = "true" ]; then
CMDLINE['usbinternal']=""
fi
if [ -n "${GOVERNOR}" ]; then
CMDLINE['governor']="${GOVERNOR}"
if [ "${GOVERNOR}" = "ondemand" ] || [ "${GOVERNOR}" = "conservative" ] || [ "${GOVERNOR}" = "schedutil" ]; then
CMDLINE["governor"]="${GOVERNOR}"
fi
if [ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ]; then
CMDLINE["intel_pstate"]="disable"
fi
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
CMDLINE["nox2apic"]=""
fi
@@ -234,11 +219,11 @@ fi
# fi
if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "mpt3sas"; then
[ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
CMDLINE['modprobe.blacklist']+="mpt3sas"
[ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE["modprobe.blacklist"]+=","
CMDLINE["modprobe.blacklist"]+="mpt3sas"
fi
#else
# CMDLINE['scsi_mod.scan']="sync" # TODO: redpill panic of vmware scsi? (add to cmdline)
# CMDLINE['scsi_mod.scan']="sync" # TODO: kernel panic caused by vmware scsi? (add to cmdline)
fi
# CMDLINE['kvm.ignore_msrs']="1"
@@ -252,6 +237,20 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
CMDLINE["SASmodel"]="1"
fi
# NIC Cmdline
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)
ETHN=$(echo ${ETHX} | wc -w)
[ -z "${ETHM}" ] && ETHM="${ETHN}"
NIC=0
for N in ${ETHX}; do
MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')" || NIC=$((NIC + 1))
[ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}"
[ ${NIC} -ge ${ETHM} ] && break
done
CMDLINE["netif_num"]="${NIC}"
# Read user network settings
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["network.${KEY}"]="${VALUE}"
@@ -288,17 +287,46 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
IPCON=""
echo
if [ "${ARCPATCH}" = "true" ]; then
echo -e "\033[1;37mDetected ${ETHN} NIC\033[0m | \033[1;34mUsing ${NIC} NIC for Arc Patch:\033[0m"
else
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
fi
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
checkNIC
for N in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
while true; do
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED @ Mac: ${MAC}\033[0m"
break
fi
COUNT=$((COUNT + 1))
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
echo -e "\r${DRIVER} (${SPEED} | ${MAC}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
else
echo -e "\r${DRIVER} (${SPEED} | ${MAC}): \033[1;37m${IP}\033[0m"
[ -z "${IPCON}" ] && IPCON="${IP}"
fi
break
fi
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
echo -e "\r${DRIVER} (${MAC}): \033[1;37mDOWN\033[0m"
break
fi
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
echo -e "\r${DRIVER} (${MAC}): \033[1;37mTIMEOUT\033[0m"
break
fi
sleep 1
done
done
echo
DSMLOGO="$(readConfigKey "bootscreen.dsmlogo" "${USER_CONFIG_FILE}")"
@@ -309,9 +337,6 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
[ -f "${TMP_PATH}/qrcode_boot.png" ] && echo | fbv -acufi "${TMP_PATH}/qrcode_boot.png" >/dev/null 2>/dev/null || true
fi
# Wait for boot interrupt
_bootwait
for T in $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
if [ -w "/dev/${T}" ]; then
[ -n "${IPCON}" ] && echo -e "Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes - Network will be unreachable until DSM boot.\033[0m\n" >"/dev/${T}" 2>/dev/null \
@@ -334,7 +359,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m"
KEXECARGS+=" --noefi"
fi
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE} kexecboot" >"${LOG_FILE}" 2>&1 || dieLog
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
echo -e "\033[1;37mBooting DSM...\033[0m"
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff

View File

@@ -1,239 +0,0 @@
#!/usr/bin/env bash
###############################################################################
# Overlay Init Section
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
. "${ARC_PATH}/include/functions.sh"
. "${ARC_PATH}/arc-functions.sh"
. "${ARC_PATH}/include/addons.sh"
. "${ARC_PATH}/include/modules.sh"
. "${ARC_PATH}/include/update.sh"
# Get Keymap and Timezone and check System
onlineCheck
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
systemCheck
readData
###############################################################################
# Mounts backtitle dynamically
function backtitle() {
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ -n "${ARC_VERSION}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
BACKTITLE+="${MODEL:-(Model)} | "
BACKTITLE+="${PRODUCTVER:-(Version)} | "
BACKTITLE+="${IPCON:-(IP)} | "
BACKTITLE+="Patch: ${ARCPATCH} | "
BACKTITLE+="Config: ${CONFDONE} | "
BACKTITLE+="Build: ${BUILDDONE} | "
BACKTITLE+="${MACHINE}(${BUS}) | "
[ -n "${KEYMAP}" ] && BACKTITLE+="KB: ${KEYMAP}"
[ "${ARCOFFLINE}" = "true" ] && BACKTITLE+=" | Offline"
echo "${BACKTITLE}"
}
###############################################################################
###############################################################################
# Main loop
if [ "${ARCMODE}" = "update" ]; then
if [ "${ARCOFFLINE}" != "true" ]; then
updateLoader
else
dialog --backtitle "$(backtitle)" --title "Arc Update" \
--infobox "Update is not possible in Offline Mode!" 5 40
sleep 3
exec reboot
fi
elif [ "${ARCMODE}" = "automated" ]; then
if [ "${BUILDDONE}" = "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
arcModel
else
make
fi
elif [ "${ARCMODE}" = "config" ]; then
NEXT="1"
while true; do
rm -f "${TMP_PATH}/menu" "${TMP_PATH}/resp" >/dev/null 2>&1 || true
write_menu "=" "\Z4===== Main =====\Zn"
if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then
write_menu_with_color "0" "HardwareID" "${HARDWAREID}"
fi
write_menu_with_color "1" "Model" "${MODEL}"
if [ "${CONFDONE}" = "true" ]; then
write_menu_with_color "e" "Version" "${PRODUCTVER}"
write_menu_with_color "=" "DT" "${DT}"
write_menu_with_color "=" "Platform" "${PLATFORM}"
if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then
write_menu_with_color "p" "Arc Patch" "${ARCPATCH}"
elif [ "${ARCOFFLINE}" = "false" ]; then
write_menu "p" "Arc Patch: \Z4Register HardwareID first\Zn"
else
write_menu "p" "SN/Mac Options"
fi
if [ "${PLATFORM}" = "epyc7002" ]; then
CPUINFO="$(cat /proc/cpuinfo | wc -l)"
if [ ${CPUINFO} -gt 24 ]; then
write_menu "=" "Custom Kernel should be used for this CPU"
fi
write_menu_with_color "K" "Kernel" "${KERNEL}"
fi
write_menu "b" "Addons"
for addon in "cpufreqscaling" "storagepanel" "sequentialio"; do
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "${addon}"; then
case "${addon}" in
"cpufreqscaling") write_menu_with_color "g" "Scaling Governor" "${GOVERNOR}" ;;
"storagepanel") write_menu_with_color "P" "StoragePanel" "${STORAGEPANEL:-auto}" ;;
"sequentialio") write_menu_with_color "Q" "SequentialIO" "${SEQUENTIALIO}" ;;
esac
fi
done
write_menu "d" "Modules"
write_menu_with_color "O" "Official Driver Priority" "${ODP}"
if [ "${DT}" = "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then
write_menu_with_color "S" "PortMap" "${REMAP}"
write_menu_with_color "=" "Mapping" "${PORTMAP}"
fi
if [ "${DT}" = "true" ]; then
write_menu_with_color "H" "Hotplug/SortDrives" "${HDDSORT}"
else
write_menu_with_color "h" "USB as Internal" "${USBMOUNT}"
fi
fi
write_menu_with_color "c" "Offline Mode" "${ARCOFFLINE}"
write_menu "9" "Advanced Options"
write_menu "=" "\Z4===== Diag =====\Zn"
write_menu "a" "Sysinfo"
write_menu "A" "Networkdiag"
write_menu "=" "\Z4===== Misc =====\Zn"
write_menu "x" "Backup/Restore/Recovery"
[ "${ARCOFFLINE}" = "false" ] && write_menu "z" "Update Menu"
write_menu "I" "Power/Service Menu"
write_menu "V" "Credits"
if [ "${CONFDONE}" = "false" ]; then
EXTRA_LABEL="Config"
elif [ "${CONFDONE}" = "true" ]; then
EXTRA_LABEL="Build"
elif [ "${BUILDDONE}" = "true" ]; then
EXTRA_LABEL="Boot"
fi
if [ "$TERM" != "xterm-256color" ]; then
WEBCONFIG="Webconfig: http://${IPCON}${HTTPPORT:+:$HTTPPORT}"
else
WEBCONFIG=""
fi
dialog --clear --default-item ${NEXT} --backtitle "$(backtitle)" --title "Evo UI" --colors \
--cancel-label "Classic" --help-button --help-label "Exit" \
--extra-button --extra-label "${EXTRA_LABEL}" \
--menu "${WEBCONFIG}" 0 0 0 --file "${TMP_PATH}/menu" \
2>"${TMP_PATH}/resp"
RET=$?
case ${RET} in
0)
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return
case ${resp} in
0) genHardwareID; NEXT="0" ;;
1) arcModel; NEXT="2" ;;
b) addonMenu; NEXT="b" ;;
d) modulesMenu; NEXT="d" ;;
e) ONLYVERSION="true" && arcVersion; NEXT="e" ;;
p) ONLYPATCH="true" && checkHardwareID && arcPatch; NEXT="p" ;;
S) storageMenu; NEXT="S" ;;
g) governorMenu; NEXT="g" ;;
P) storagepanelMenu; NEXT="P" ;;
Q) sequentialIOMenu; NEXT="Q" ;;
K) KERNEL=$([ "${KERNEL}" = "official" ] && echo 'custom' || echo 'official')
writeConfigKey "kernel" "${KERNEL}" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "Kernel" \
--infobox "Switching Kernel to ${KERNEL}! Stay patient..." 4 50
if [ "${ODP}" = "true" ]; then
ODP="false"
writeConfigKey "odp" "${ODP}" "${USER_CONFIG_FILE}"
fi
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
mergeConfigModules "$(getAllModules "${PLATFORM}" "${KVERP}" | awk '{print $1}')" "${USER_CONFIG_FILE}"
fi
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="K"
;;
H) [ "${HDDSORT}" = "true" ] && HDDSORT='false' || HDDSORT='true'
writeConfigKey "hddsort" "${HDDSORT}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="H"
;;
h) [ "${USBMOUNT}" = "true" ] && USBMOUNT='false' || USBMOUNT='true'
writeConfigKey "usbmount" "${USBMOUNT}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="h"
;;
O) [ "${ODP}" = "false" ] && ODP='true' || ODP='false'
writeConfigKey "odp" "${ODP}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="O"
;;
c) ARCOFFLINE=$([ "${ARCOFFLINE}" = "true" ] && echo 'false' || echo 'true')
writeConfigKey "arc.offline" "${ARCOFFLINE}" "${USER_CONFIG_FILE}"
[ "${ARCOFFLINE}" = "false" ] && exec arc.sh
NEXT="c"
;;
# Diag Section
a) sysinfo; NEXT="a" ;;
A) networkdiag; NEXT="A" ;;
# Misc Settings
x) backupMenu; NEXT="x" ;;
z) updateMenu; NEXT="z" ;;
I) rebootMenu; NEXT="I" ;;
V) credits; NEXT="V" ;;
9) advancedMenu; NEXT="9" ;;
esac
;;
1)
exec arc.sh
;;
3)
if [ "${CONFDONE}" = "false" ]; then
arcModel
elif [ "${CONFDONE}" = "true" ]; then
arcSummary
elif [ "${BUILDDONE}" = "true" ]; then
boot
fi
;;
*)
break
;;
esac
done
fi
# Inform user
echo -e "Call \033[1;34marc.sh\033[0m to configure Loader"
echo
echo -e "Web Config: \033[1;34mhttp://${IPCON}${HTTPPORT:+:$HTTPPORT}\033[0m"
echo
echo -e "SSH Access:"
echo -e "IP: \033[1;34m${IPCON}\033[0m"
echo -e "User: \033[1;34mroot\033[0m"
echo -e "Password: \033[1;34marc\033[0m"
echo

View File

@@ -11,7 +11,7 @@ function availableAddons() {
local PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
for D in $(find "${ADDONS_PATH}" -maxdepth 1 -type d 2>/dev/null | sort); do
[ ! -f "${D}/manifest.yml" ] && continue
local ADDON=$(basename "${D}")
local ADDON=$(basename ${D})
local AVAILABLE="$(readConfigKey "${1}" "${D}/manifest.yml")"
[ "${AVAILABLE}" = false ] && continue
local SYSTEM=$(readConfigKey "system" "${D}/manifest.yml")
@@ -113,19 +113,3 @@ function updateAddon() {
rm -f "${F}"
done
}
###############################################################################
# Read Addon Key
# 1 - Addon
# 2 - key
function readAddonKey() {
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo ""
return 1
fi
if [ ! -f "${ADDONS_PATH}/${1}/manifest.yml" ]; then
echo ""
return 1
fi
readConfigKey "${2}" "${ADDONS_PATH}/${1}/manifest.yml"
}

View File

@@ -4,17 +4,19 @@ PART2_PATH="/mnt/p2"
PART3_PATH="/mnt/p3"
TMP_PATH="/tmp"
[ -f "${PART1_PATH}/ARC-BRANCH" ] && ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH") || ARC_BRANCH="null"
[ -f "${PART1_PATH}/ARC-VERSION" ] && ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION") || ARC_VERSION="null"
[ -f "${PART1_PATH}/ARC-BUILD" ] && ARC_BUILD=$(cat "${PART1_PATH}/ARC-BUILD") || ARC_BUILD="null"
ARC_TITLE="Arc ${ARC_VERSION}"
RAMDISK_PATH="${TMP_PATH}/ramdisk"
LOG_FILE="${TMP_PATH}/log.txt"
TMP_UP_PATH="${TMP_PATH}/upload"
GRUB_PATH="${PART1_PATH}/boot/grub"
USER_GRUB_CONFIG="${GRUB_PATH}/grub.cfg"
USER_GRUBENVFILE="${GRUB_PATH}/grubenv"
USER_GRUB_CONFIG="${PART1_PATH}/boot/grub/grub.cfg"
USER_GRUBENVFILE="${PART1_PATH}/boot/grub/grubenv"
USER_CONFIG_FILE="${PART1_PATH}/user-config.yml"
HW_KEY="${PART2_PATH}/machine.key"
GRUB_PATH="${PART1_PATH}/boot/grub"
ORI_ZIMAGE_FILE="${PART2_PATH}/zImage"
ORI_RDGZ_FILE="${PART2_PATH}/rd.gz"
@@ -41,7 +43,7 @@ EXTRACTOR_PATH="${PART3_PATH}/extractor"
EXTRACTOR_BIN="syno_extract_system_patch"
HTTPPORT=$(grep -i '^HTTP_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
[ -z "${HTTPPORT}" ] && HTTPPORT="" || true
[ -z "${HTTPPORT}" ] && HTTPPORT=8080 || true
DUFSPORT=$(grep -i '^DUFS_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)
[ -z "${DUFSPORT}" ] && DUFSPORT=7304 || true
TTYDPORT=$(grep -i '^TTYD_PORT=' /etc/arc.conf 2>/dev/null | cut -d'=' -f2)

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
# 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.

View File

@@ -22,66 +22,6 @@ function checkBootLoader() {
return 0
}
###############################################################################
# Check boot mode
function arc_mode() {
unset ARCMODE ARC_BRANCH ARC_VERSION ARC_BUILD ARCCONF
if grep -q 'automated_arc' /proc/cmdline; then
export ARCMODE="automated"
elif grep -q 'update_arc' /proc/cmdline; then
export ARCMODE="update"
elif grep -q 'force_arc' /proc/cmdline; then
export ARCMODE="config"
else
export ARCMODE="dsm"
fi
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
[ -f "${PART1_PATH}/ARC-BRANCH" ] && export ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH") || export ARC_BRANCH="null"
[ -f "${PART1_PATH}/ARC-VERSION" ] && export ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION") || export ARC_VERSION="null"
[ -f "${PART1_PATH}/ARC-BUILD" ] && export ARC_BUILD=$(cat "${PART1_PATH}/ARC-BUILD") || export ARC_BUILD="null"
[ "$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" ] && export ARCCONF="true" || export ARCCONF=""
}
###############################################################################
# Check for NIC and IP
function checkNIC() {
# Get Amount of NIC
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
for N in ${ETHX}; do
COUNT=0
DRIVER=$(basename "$(readlink -f /sys/class/net/${N}/device/driver 2>/dev/null)")
while true; do
CARRIER=$(cat /sys/class/net/${N}/carrier 2>/dev/null)
if [ "${CARRIER}" = "0" ]; then
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
break
fi
COUNT=$((COUNT + 1))
IP=$(getIP "${N}")
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | awk '/Speed:/ {print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
else
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
[ -z "${IPCON}" ] && IPCON="${IP}"
fi
break
fi
if [ -z "${CARRIER}" ]; then
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
break
fi
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
break
fi
sleep 1
done
done
}
###############################################################################
# Just show error message and dies
function die() {
@@ -207,14 +147,6 @@ function generateMacAddress() {
return 0
}
###############################################################################
function generate_and_write_serial() {
local use_patch=$1
SN="$(generateSerial "${MODEL}" "${use_patch}")"
writeConfigKey "arc.patch" "${use_patch}" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
}
###############################################################################
# Validate a serial number for a model
# 1 - Model
@@ -663,10 +595,9 @@ function systemCheck () {
CPUFREQ="false"
fi
# Check for Arc Patch
arc_mode
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
[ -z "${ARCCONF}" ] && writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
getnetinfo
getdiskinfo
# Check for Disks
getmap
}
@@ -737,14 +668,4 @@ function fixDSMRootPart() {
mdadm --assemble --scan >/dev/null 2>&1
fsck "${1}" >/dev/null 2>&1
fi
}
###############################################################################
# Menu functions
function write_menu() {
echo "$1 \"$2\" " >>"${TMP_PATH}/menu"
}
function write_menu_with_color() {
echo "$1 \"$2: \Z4${3:-none}\Zn\" " >>"${TMP_PATH}/menu"
}

View File

@@ -7,25 +7,13 @@
# eg: N i915.ko
# kvm
F irqbypass.ko
F kvm-intel.ko
F kvm-amd.ko
F kvm.ko
N irqbypass.ko
N kvm-intel.ko
N kvm-amd.ko
N kvm.ko
# acpi
N acpi_call.ko
N acpi-cpufreq.ko
N processor.ko
N button.ko
# cpufreq
N cpufreq_governor.ko
N cpufreq_ondemand.ko
N cpufreq_conservative.ko
N cpufreq_performance.ko
N cpufreq_powersave.ko
N cpufreq_userspace.ko
N cpufreq_stats.ko
# misc
N check_signature.ko
@@ -46,6 +34,14 @@ N cdc_ether.ko
N rndis_host.ko
N r8152.ko
# iwlwifi
N libarc4.ko
N cfg80211.ko
N mac80211.ko
N iwlwifi.ko
N iwlmvm.ko
N iwldvm.ko
## i915
#N dmabuf.ko
#N drm.ko

View File

@@ -49,9 +49,9 @@ function getAllModules() {
# Get list of all modules
for F in $(ls ${TMP_PATH}/modules/*.ko 2>/dev/null); do
local X=$(basename "${F}")
local X=$(basename ${F})
local M=${X:0:-3}
local DESC=$(modinfo "${F}" | awk -F':' '/description:/{ print $2}' | awk '{sub(/^[ ]+/,""); print}')
local DESC=$(modinfo ${F} | awk -F':' '/description:/{ print $2}' | awk '{sub(/^[ ]+/,""); print}')
[ -z "${DESC}" ] && DESC="${X}"
echo "${M} \"${DESC}\""
done
@@ -78,19 +78,19 @@ function installModules() {
local ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do
local M=$(basename "${F}")
local M=$(basename ${F})
[ "${ODP}" = "true" ] && [ -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue
if echo "${MLIST}" | grep -wq "${M:0:-3}"; then
cp -f "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}" 2>"${LOG_FILE}"
cp -f "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}"
else
rm -f "${RAMDISK_PATH}/usr/lib/modules/${M}" 2>"${LOG_FILE}"
rm -f "${RAMDISK_PATH}/usr/lib/modules/${M}"
fi
done
mkdir -p "${RAMDISK_PATH}/usr/lib/firmware"
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
else
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
fi
if [ $? -ne 0 ]; then
return 1
@@ -118,7 +118,7 @@ function addToModules() {
unpackModules "${PLATFORM}" "${KVER}"
cp -f "${KOFILE}" "${TMP_PATH}/modules"
cp -f ${KOFILE} ${TMP_PATH}/modules
packModules "${PLATFORM}" "${KVER}"
}
@@ -140,7 +140,7 @@ function delToModules() {
unpackModules "${PLATFORM}" "${KVER}"
rm -f "${TMP_PATH}/modules/${KONAME}"
rm -f ${TMP_PATH}/modules/${KONAME}
packModules "${PLATFORM}" "${KVER}"
}
@@ -173,7 +173,7 @@ function getdepends() {
unpackModules "${PLATFORM}" "${KVER}"
local DPS=($(_getdepends "${KONAME}" | tr ' ' '\n' | sort -u))
local DPS=($(_getdepends ${KONAME} | tr ' ' '\n' | sort -u))
echo ${DPS[@]}
rm -rf "${TMP_PATH}/modules"
}

View File

@@ -0,0 +1,50 @@
# Get Network Config for Loader
function getnet() {
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
ETHN=$(echo ${ETHX} | wc -w)
if [ "${ARCPATCH}" = "true" ]; then
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true"))
for I in $(seq 1 ${ETHN}); do
eval MAC${I}="${MACS[$((${I} - 1))]}"
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" = "false" ]; then
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false"))
for I in $(seq 1 ${ETHN}); do
eval MAC${I}="${MACS[$((${I} - 1))]}"
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" = "user" ]; then
# User Mac
for N in ${ETHX}; do
while true; do
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
--inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50\
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
MAC=$(cat "${TMP_PATH}/resp")
[ -z "${MAC}" ] && MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')"
if [ ${#MAC} -eq 12 ]; then
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Set Mac for ${N} to ${MAC}!" 5 50
writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}"
break
else
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Invalid MAC - Try again!" 5 50
fi
done
done
fi
}
# Get Amount of NIC
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
# Get actual IP
for N in ${ETHX}; do
IPCON="$(getIP "${N}")"
[ -n "${IPCON}" ] && break
done

View File

@@ -0,0 +1,250 @@
# Get PortMap for Loader
function getmap() {
# Sata Disks
SATADRIVES=0
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
# Clean old files
[ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax" && touch "${TMP_PATH}/drivesmax"
[ -f "${TMP_PATH}/drivescon" ] && rm -f "${TMP_PATH}/drivescon" && touch "${TMP_PATH}/drivescon"
[ -f "${TMP_PATH}/ports" ] && rm -f "${TMP_PATH}/ports" && touch "${TMP_PATH}/ports"
[ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap" && touch "${TMP_PATH}/remap"
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
let DISKIDXMAPIDX=0
DISKIDXMAP=""
let DISKIDXMAPIDXMAX=0
DISKIDXMAPMAX=""
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
NUMPORTS=0
CONPORTS=0
unset HOSTPORTS
declare -A HOSTPORTS
while read -r LINE; do
ATAPORT="$(echo ${LINE} | grep -o 'ata[0-9]*')"
PORT=$(echo ${ATAPORT} | sed 's/ata//')
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
while read -r PORT; do
ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && ATTACH=1 || ATTACH=0
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
[ ${PCMD} = 0 ] && DUMMY=1 || DUMMY=0
[ ${ATTACH} = 1 ] && CONPORTS="$((${CONPORTS} + 1))" && echo "$((${PORT} - 1))" >>"${TMP_PATH}/ports"
[ ${DUMMY} = 1 ] # Do nothing for now
NUMPORTS=$((${NUMPORTS} + 1))
done < <(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n)
[ ${NUMPORTS} -gt 8 ] && NUMPORTS=8
[ ${CONPORTS} -gt 8 ] && CONPORTS=8
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
DISKIDXMAP=$DISKIDXMAP$(printf "%02x" $DISKIDXMAPIDX)
let DISKIDXMAPIDX=$DISKIDXMAPIDX+$CONPORTS
DISKIDXMAPMAX=$DISKIDXMAPMAX$(printf "%02x" $DISKIDXMAPIDXMAX)
let DISKIDXMAPIDXMAX=$DISKIDXMAPIDXMAX+$NUMPORTS
SATADRIVES=$((${SATADRIVES} + ${CONPORTS}))
done
fi
fi
# SAS Disks
SASDRIVES=0
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
SASDRIVES=$((${SASDRIVES} + ${PORTNUM}))
done
fi
# SCSI Disks
SCSIDRIVES=0
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort - 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
SCSIDRIVES=$((${SCSIDRIVES} + ${PORTNUM}))
done
fi
# Raid Disks
RAIDDRIVES=0
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
RAIDDRIVES=$((${RAIDDRIVES} + ${PORTNUM}))
done
fi
# USB Disks
USBDRIVES=0
if [ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
[ ${PORTNUM} -eq 0 ] && continue
USBDRIVES=$((${USBDRIVES} + ${PORTNUM}))
done
fi
# MMC Disks
MMCDRIVES=0
if [ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::805 | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null)
[ ${PORTNUM} -eq 0 ] && continue
MMCDRIVES=$((${MMCDRIVES} + ${PORTNUM}))
done
fi
# NVMe Disks
NVMEDRIVES=0
if [ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l)
NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM}))
done
fi
# Disk Count for MaxDisks
DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES}))
HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES}))
writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
# Check for Sata Boot
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
LASTDRIVE=0
while read -r D; do
if [ "${BUS}" = "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then
MAXDISKS=${DRIVES}
echo -n "${D}>${MAXDISKS}:">>"${TMP_PATH}/remap"
elif [ ${D} != ${LASTDRIVE} ]; then
echo -n "${D}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
LASTDRIVE=$((${LASTDRIVE} + 1))
elif [ ${D} = ${LASTDRIVE} ]; then
LASTDRIVE=$((${D} + 1))
fi
done < <(cat "${TMP_PATH}/ports")
fi
}
function getmapSelection() {
# Compute PortMap Options
SATAPORTMAPMAX="$(awk '{print $1}' "${TMP_PATH}/drivesmax")"
SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")"
SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "config" ]; then
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
REMAP2="*"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
REMAP3="*"
else
REMAP1="*"
fi
# Ask for Portmap
if [ "${STEP}" = "storagemap" ]; then
dialog --backtitle "$(backtitlep)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
else
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
fi
if [ ${resp} -eq 1 ]; then
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 3 ]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 4 ]; then
writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 5 ]; then
writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}"
fi
else
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
fi
fi
# Check Remap for correct config
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
# Write Map to config and show Map to User
if [ "${REMAP}" = "acports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "maxports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
fi
}
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
SATACONTROLLER=$(lspci -d ::106 2>/dev/null | wc -l)
writeConfigKey "device.satacontroller" "${SATACONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${SATACONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "false" "${USER_CONFIG_FILE}"
fi
SASCONTROLLER=$(lspci -d ::107 2>/dev/null | wc -l)
writeConfigKey "device.sascontroller" "${SASCONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${SASCONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
SCSICONTROLLER=$(lspci -d ::100 2>/dev/null | wc -l)
writeConfigKey "device.scsicontroller" "${SCSICONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${SCSICONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
RAIDCONTROLLER=$(lspci -d ::104 2>/dev/null | wc -l)
writeConfigKey "device.raidcontroller" "${RAIDCONTROLLER}" "${USER_CONFIG_FILE}"
if [ ${RAIDCONTROLLER} -gt 0 ]; then
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi

View File

@@ -457,14 +457,9 @@ function updateLKMs() {
function updateOffline() {
local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${ARCOFFLINE}" != "true" ]; then
[ -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml" "${MODEL_CONFIG_PATH}/data.yml.bak" || true
[ -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml" "${MODEL_CONFIG_PATH}/data.yml.bak"
curl -skL "https://raw.githubusercontent.com/AuxXxilium/arc-dsm/refs/heads/main/data.yml" -o "${MODEL_CONFIG_PATH}/data.yml"
# Check file size and restore backup if necessary
local FILESIZE=$(stat -c%s "${MODEL_CONFIG_PATH}/data.yml")
if [ "${FILESIZE}" -lt 3072 ]; then
cp -f "${MODEL_CONFIG_PATH}/data.yml.bak" "${MODEL_CONFIG_PATH}/data.yml"
fi
[ ! -f "${MODEL_CONFIG_PATH}/data.yml" ] && cp -f "${MODEL_CONFIG_PATH}/data.yml.bak" "${MODEL_CONFIG_PATH}/data.yml"
fi
return 0
}
@@ -472,24 +467,34 @@ function updateOffline() {
###############################################################################
# Loading Update Mode
function dependenciesUpdate() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
FAILED="false"
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Updating Dependencies..." 3 40
sleep 2
FAILED="false"
for updateFunction in updateAddons updateModules updateCustom updatePatches updateLKMs updateOffline; do
$updateFunction || FAILED="true"
done
updateAddons
[ $? -ne 0 ] && FAILED="true"
updateModules
[ $? -ne 0 ] && FAILED="true"
updateCustom
[ $? -ne 0 ] && FAILED="true"
updatePatches
[ $? -ne 0 ] && FAILED="true"
updateLKMs
[ $? -ne 0 ] && FAILED="true"
updateOffline
[ $? -ne 0 ] && FAILED="true"
if [ "${FAILED}" = "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update Dependencies failed! Try again later." 3 40
else
sleep 3
elif [ "${FAILED}" = "false" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update Dependencies successful!" 3 40
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
sleep 3
clear
exec arc.sh
fi
sleep 3
clear
exec arc.sh
}

View File

@@ -24,6 +24,6 @@ As external: yes
Community Package required *
- NVMe
Cache: yes
Storage: no
Cache: yes (sometimes addon required)
Storage: Addon required
System (NVMe only): no

View File

@@ -24,6 +24,6 @@ Unsupported
Community Package required *
- NVMe
Cache: yes
Storage: no
Cache: yes (sometimes addon required)
Storage: Addon required
System (NVMe only): no

View File

@@ -24,6 +24,6 @@ Unsupported
Community Package required *
- NVMe
Cache: yes
Storage: no
Cache: yes (sometimes addon required)
Storage: Addon required
System (NVMe only): no

View File

@@ -26,6 +26,6 @@ Partially natively supported
Community Package required *
- NVMe
Cache: yes
Storage: no
Cache: yes (sometimes addon required)
Storage: Addon required
System (NVMe only): no

View File

@@ -8,7 +8,6 @@ set -e
# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
checkBootLoader || die "The loader is corrupted, please rewrite it!"
arc_mode || die "No bootmode found!"
[ -f "${HOME}/.initialized" ] && exec arc.sh || true
[ -f "${USER_CONFIG_FILE}" ] && sed -i "s/'/\"/g" "${USER_CONFIG_FILE}" >/dev/null 2>&1 || true
@@ -21,14 +20,15 @@ clear
COLUMNS=${COLUMNS:-50}
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
TITLE="Version:"
TITLE+=" ${ARC_VERSION} (${ARC_BUILD}) | Branch: ${ARC_BRANCH}"
TITLE+=" ${ARC_VERSION} (${ARC_BUILD})"
[ -n "${ARC_BRANCH}" ] && TITLE+=" | Branch: ${ARC_BRANCH}"
printf "\033[1;30m%*s\n" ${COLUMNS} ""
printf "\033[1;30m%*s\033[A\n" ${COLUMNS} ""
printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
TITLE="Boot:"
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [BIOS]"
TITLE+=" | Device: [${BUS}] | Mode: [${ARCMODE}]"
TITLE+=" [${BUS}]"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
# Check for Config File
@@ -84,35 +84,45 @@ initConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
initConfigKey "time" "{}" "${USER_CONFIG_FILE}"
initConfigKey "usbmount" "false" "${USER_CONFIG_FILE}"
initConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
if grep -q "automated_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
elif grep -q "update_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "update" "${USER_CONFIG_FILE}"
elif grep -q "force_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.mode" "dsm" "${USER_CONFIG_FILE}"
fi
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
if [ -n "${ARC_BRANCH}" ]; then
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
fi
# Sort network interfaces
if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}"); then
echo -e "Sorting NIC: \033[1;34mactive\033[0m"
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
echo
fi
# Read/Write IP/Mac to config
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
for N in ${ETHX}; do
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
IFS='/' read -r -a IPRA <<<"${IPR}"
ip addr flush dev "${N}"
ip addr add "${IPRA[0]}/${IPRA[1]:-"255.255.255.0"}" dev "${N}"
if [ -n "${IPRA[2]}" ]; then
ip route add default via "${IPRA[2]}" dev "${N}"
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
for N in ${ETHX}; do
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
IFS='/' read -r -a IPRA <<<"${IPR}"
ip addr flush dev "${N}"
ip addr add "${IPRA[0]}/${IPRA[1]:-"255.255.255.0"}" dev "${N}"
if [ -n "${IPRA[2]}" ]; then
ip route add default via "${IPRA[2]}" dev "${N}"
fi
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
fi
sleep 1
fi
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
fi
sleep 1
fi
[ "${N::3}" = "eth" ] && ethtool -s "${N}" wol g 2>/dev/null || true
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
done
[ "${N::3}" = "eth" ] && ethtool -s "${N}" wol g 2>/dev/null || true
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
done
ETHN=$(echo ${ETHX} | wc -w)
writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
# No network devices
@@ -142,6 +152,7 @@ writeConfigKey "pid" "${PID}" "${USER_CONFIG_FILE}"
# Decide if boot automatically
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "config" ]; then
echo -e "\033[1;34mStarting Config Mode...\033[0m"
elif [ "${ARCMODE}" = "automated" ]; then
@@ -158,13 +169,42 @@ echo
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
echo
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
IPCON=""
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
checkNIC
for N in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
while true; do
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
break
fi
COUNT=$((COUNT + 1))
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
else
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
[ -z "${IPCON}" ] && IPCON="${IP}"
fi
break
fi
if [ -z "$(cat /sys/class/net/${N}}/carrier 2>/dev/null)" ]; then
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
break
fi
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
break
fi
sleep 1
done
done
echo
mkdir -p "${ADDONS_PATH}"
@@ -181,7 +221,7 @@ touch "${HOME}/.initialized"
# Load Arc Overlay
echo -e "\033[1;34mLoading Arc Overlay...\033[0m"
echo
echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}${HTTPPORT:+:$HTTPPORT}\033[0m to configure Loader."
echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT:-7681}\033[0m to configure Loader."
# Check memory and load Arc
RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null)

View File

@@ -43,50 +43,46 @@ ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
[ "${PATURL:0:1}" = "#" ] && PATURL=""
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
# Check if DSM Version changed
. "${RAMDISK_PATH}/etc/VERSION"
if [[ -n "${BUILDNUM}" && ("${PRODUCTVER}" != "${majorversion}.${minorversion}" || "${BUILDNUM}" != "${buildnumber}" || "${SMALLNUM}" != "${smallfixnumber}") ]]; then
OLDVER="${PRODUCTVER}(${BUILDNUM}$([[ ${SMALLNUM:-0} -ne 0 ]] && echo "u${SMALLNUM}"))"
NEWVER="${majorversion}.${minorversion}(${buildnumber}$([[ ${smallfixnumber:-0} -ne 0 ]] && echo "u${smallfixnumber}"))"
if [[ -n "${PRODUCTVER}" && -n "${BUILDNUM}" && -n "${SMALLNUM}" ]] &&
([ "${PRODUCTVER}" != "${majorversion}.${minorversion}" ] || [ "${BUILDNUM}" != "${buildnumber}" ] || [ "${SMALLNUM}" != "${smallfixnumber}" ]); then
OLDVER="${PRODUCTVER}(${BUILDNUM}$([ ${SMALLNUM:-0} -ne 0 ] && echo "u${SMALLNUM}"))"
NEWVER="${majorversion}.${minorversion}(${buildnumber}$([ ${smallfixnumber:-0} -ne 0 ] && echo "u${smallfixnumber}"))"
PAT_URL=""
PAT_HASH=""
echo "\nVersion changed from ${OLDVER} to ${NEWVER}"
fi
# Re-read PAT_URL and PAT_HASH if they are empty or commented out
if [[ -z "${PAT_URL}" || "${PAT_URL:0:1}" == "#" ]]; then
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".url" "${D_FILE}")"
fi
if [[ -z "${PAT_HASH}" || "${PAT_HASH:0:1}" == "#" ]]; then
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".hash" "${D_FILE}")"
fi
PRODUCTVER="${majorversion}.${minorversion}"
BUILDNUM="${buildnumber}"
SMALLNUM="${smallfixnumber}"
PRODUCTVER=${majorversion}.${minorversion}
BUILDNUM=${buildnumber}
SMALLNUM=${smallfixnumber}
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "${BUILDNUM}" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
# Read model data
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Sanity check
if [ -z "${PLATFORM}" ] || [ -z "${KVER}" ]; then
echo "ERROR: Configuration for Model ${MODEL} and Version ${PRODUCTVER} not found." >"${LOG_FILE}"
echo "ERROR: Configuration for model ${MODEL} and productversion ${PRODUCTVER} not found." >"${LOG_FILE}"
exit 1
fi
# Read synoinfo and addons from config
declare -A SYNOINFO ADDONS MODULES
declare -A SYNOINFO
declare -A ADDONS
declare -A MODULES
# Read synoinfo and addons from config
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
@@ -97,24 +93,35 @@ while IFS=': ' read -r KEY VALUE; do
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
# Patches (diff -Naru OLDFILE NEWFILE > xxx.patch)
PATCHES=(
PATCHS=(
"ramdisk-etc-rc-*.patch"
"ramdisk-init-script-*.patch"
"ramdisk-post-init-script-*.patch"
"ramdisk-disable-root-pwd-*.patch"
"ramdisk-disable-disabled-ports-*.patch"
)
for PATCH in "${PATCHES[@]}"; do
echo "Patching with ${PATCH}" >>"${LOG_FILE}"
for PF in ${PATCH_PATH}/${PATCH}; do
[ -e "${PF}" ] || continue
echo "Applying patch ${PF}" >>"${LOG_FILE}"
if ! (cd "${RAMDISK_PATH}" && busybox patch -p1 -i "${PF}") >>"${LOG_FILE}" 2>&1; then
echo "Failed to apply patch ${FILE}" >>"${LOG_FILE}"
continue
fi
for PE in "${PATCHS[@]}"; do
RET=1
echo "Patching with ${PE}" >"${LOG_FILE}"
# ${PE} contains *, so double quotes cannot be added
for PF in $(ls ${PATCH_PATH}/${PE} 2>/dev/null); do
echo "Patching with ${PF}" >>"${LOG_FILE}"
# busybox patch and gun patch have different processing methods and parameters.
(cd "${RAMDISK_PATH}" && busybox patch -p1 -i "${PF}") >>"${LOG_FILE}" 2>&1
RET=$?
[ ${RET} -eq 0 ] && break
done
[ ${RET} -ne 0 ] && exit 1
done
# Add serial number to synoinfo.conf, to help to recovery a installed DSM
echo "Set synoinfo SN" >"${LOG_FILE}"
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
for KEY in ${!SYNOINFO[@]}; do
echo "Set synoinfo ${KEY}" >>"${LOG_FILE}"
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
done
# Patch /sbin/init.post
@@ -156,7 +163,7 @@ mkdir -p "${RAMDISK_PATH}/addons"
echo "export PLATFORM=\"${PLATFORM}\""
echo "export MODEL=\"${MODEL}\""
echo "export MODELID=\"${MODELID}\""
echo "export PRODUCTVERL=\"${PRODUCTVERL}\""
echo "export PRODUCTVER=\"${PRODUCTVER}\""
echo "export MLINK=\"${PAT_URL}\""
echo "export MCHECKSUM=\"${PAT_HASH}\""
echo "export LAYOUT=\"${LAYOUT:-qwerty}\""
@@ -165,7 +172,7 @@ mkdir -p "${RAMDISK_PATH}/addons"
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
# System Addons
for ADDON in redpill revert misc eudev disks localrss notify wol mountloader; do
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol" "mountloader"; do
PARAMS=""
if [ "${ADDON}" = "disks" ]; then
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
@@ -177,8 +184,8 @@ for ADDON in redpill revert misc eudev disks localrss notify wol mountloader; do
done
# User Addons
for ADDON in "${!ADDONS[@]}"; do
PARAMS="${ADDONS[${ADDON}]}"
for ADDON in ${!ADDONS[@]}; do
PARAMS=${ADDONS[${ADDON}]}
installAddon "${ADDON}" "${PLATFORM}" || echo "Addon ${ADDON} not found"
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
done
@@ -188,7 +195,7 @@ echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "Modify files" >"${LOG_FILE}"
# Remove function from scripts
[ "2" = "${PRODUCTVER:2:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
[ "2" = "${PRODUCTVER:0:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
# Build modules dependencies
# ${ARC_PATH}/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
@@ -203,7 +210,7 @@ fi
# backup current loader configs
BACKUP_PATH="${RAMDISK_PATH}/usr/arc/backup"
rm -rf "${BACKUP_PATH}"
for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}" "${USER_UP_PATH}" "${HW_KEY}"; do
for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}" "${USER_UP_PATH}"; do
if [ -f "${F}" ]; then
FD="$(dirname "${F}")"
mkdir -p "${FD/\/mnt/${BACKUP_PATH}}"

1
files/p1/ARC-VERSION Normal file
View File

@@ -0,0 +1 @@
23.1.1

View File

@@ -1,66 +1,44 @@
set default="boot"
set timeout="5"
set timeout_style="menu"
if [ -s ${prefix}/grubenv ]; then
load_env --skip-sig
fi
if [ "${next_entry}" ]; then
set default="${next_entry}"
unset next_entry
save_env next_entry
else
set default="boot"
fi
if [ "${linux_gfx_mode}" ]; then
save_env linux_gfx_mode
else
set linux_gfx_mode=keep
save_env linux_gfx_mode
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
function load_video {
if [ x"${feature_all_video_module}" = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
set vesa_mode=1
set menu_color_normal=white/black
set menu_color_highlight=white/red
set color_normal=white/black
if [ x"${feature_default_font_path}" = xy ]; then
font=unicode
else
font=${prefix}/fonts/unicode.pf2
if [ -s ${prefix}/grubenv ]; then
load_env --skip-sig
fi
if [ "${next_entry}" ]; then
set default="${next_entry}"
unset next_entry
save_env next_entry
fi
if [ "${vesa_mode}" ]; then
set vesa_mode=${vesa_mode}
fi
if loadfont ${font}; then
terminal_input console
terminal_output console
if [ "${feature_all_video_module}" = "y" ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
if loadfont unicode; then
if [ "${grub_platform}" = "efi" ]; then
set gfxmode=auto
else
set gfxmode=1024x768
fi
load_video
insmod gfxterm
terminal_output gfxterm
insmod gfxmenu
loadfont ${prefix}/theme/dejavu_bold_14.pf2
loadfont ${prefix}/theme/dejavu_mono_12.pf2
@@ -69,20 +47,17 @@ if loadfont ${font}; then
export theme
fi
terminal_output gfxterm
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
terminal_input --append serial
terminal_output --append serial
fi
function gfxmode {
set gfxpayload="${linux_gfx_mode}"
if [ "${linux_gfx_mode}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
function set_gfxpayload {
if [ ${vesa_mode} -eq 1 ]; then
set gfxpayload=keep
else
set gfxpayload=text
fi
}
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off amd_iommu_intr=legacy net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable amd_pstate=disable nox2apic nomodeset"
@@ -91,8 +66,8 @@ search --set=root --label "ARC3"
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
if [ "${default}" = "direct" ]; then
set timeout="1"
menuentry 'DSM Direct Mode' ${menuentry_id_option} direct {
gfxmode
menuentry 'DSM Direct Mode' --id direct {
set_gfxpayload
echo "Loading DSM Kernel..."
linux /zImage-dsm ${dsm_cmdline}
echo "Loading DSM Initramfs..."
@@ -101,8 +76,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
echo "Access http://find.synology.com/ to connect the DSM via web."
}
fi
menuentry 'Arc DSM Mode' ${menuentry_id_option} boot {
gfxmode
menuentry 'Arc DSM Mode' --id boot {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline}
echo "Loading Arc Initramfs..."
@@ -116,8 +91,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
if [ -e /automated ]; then
menuentry 'Arc Automated Mode' ${menuentry_id_option} automated {
gfxmode
menuentry 'Arc Automated Mode' --id automated {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc
echo "Loading Arc Initramfs..."
@@ -130,8 +105,8 @@ if [ -e /automated ]; then
}
fi
menuentry 'Arc Config Mode' ${menuentry_id_option} config {
gfxmode
menuentry 'Arc Config Mode' --id config {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_arc
echo "Loading Arc Initramfs..."
@@ -144,8 +119,8 @@ menuentry 'Arc Config Mode' ${menuentry_id_option} config {
}
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
menuentry 'Arc Update Mode' ${menuentry_id_option} update {
gfxmode
menuentry 'Arc Update Mode' --id update {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} update_arc
echo "Loading Arc Initramfs..."
@@ -156,8 +131,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
echo "Booting..."
}
menuentry 'DSM Recovery Mode' ${menuentry_id_option} recovery {
gfxmode
menuentry 'DSM Recovery Mode' --id recovery {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} recovery
echo "Loading Arc Initramfs..."
@@ -168,8 +143,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
fi
echo "Booting..."
}
menuentry 'DSM Reinstall Mode' ${menuentry_id_option} junior {
gfxmode
menuentry 'DSM Reinstall Mode' --id junior {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_junior
echo "Loading Arc Initramfs..."
@@ -182,30 +157,31 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
}
fi
menuentry 'System UEFI Setup' ${menuentry_id_option} uefi {
menuentry 'Enter BIOS Setup' --id bios {
fwsetup
}
menuentry 'System Memtest86+' ${menuentry_id_option} memtest {
menuentry 'Start Memtest86+' --id memtest {
echo "Loading memtest86+..."
linux ${prefix}/memtest
}
menuentry 'System Poweroff' ${menuentry_id_option} poweroff {
menuentry 'Poweroff' --id poweroff {
echo "System is powering off..."
halt
}
if [ "${linux_gfx_mode}" = "keep" ]; then
menuentry 'Change vesa to text video mode' ${menuentry_id_option} videomode {
set linux_gfx_mode=text
save_env linux_gfx_mode
if [ ${vesa_mode} = 1 ]; then
menuentry 'Change Vesa to Text Output' --id videomode {
set vesa_mode=0
save_env vesa_mode
configfile ${prefix}/grub.cfg
}
else
menuentry 'Change text to vesa video mode' ${menuentry_id_option} videomode {
set linux_gfx_mode=keep
save_env linux_gfx_mode
menuentry 'Change Text to Vesa Output' --id videomode {
set vesa_mode=1
save_env vesa_mode
reboot
configfile ${prefix}/grub.cfg
}
fi

82
img-ext.sh Executable file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
#
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
set -e
# Clean cached Files
sudo git clean -fdx
. scripts/func.sh "${AUX_TOKEN}"
# Unmount Image File
sudo umount "/tmp/p1" 2>/dev/null || true
sudo umount "/tmp/p3" 2>/dev/null || true
# Get extractor, LKM, addons and Modules
echo "Get Dependencies"
getAddons "files/p3/addons"
getModules "files/p3/modules"
getConfigs "files/p3/configs"
getPatches "files/p3/patches"
getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
mkdir -p "brx"
[ ! -f "../brx/bzImage" ] && getBuildrootx "brx" || copyBuildroot "brx"
# Sbase
IMAGE_FILE="arc_create.img"
gzip -dc "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"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.3.7"
ARC_BRANCH="extended"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
if [ -f "brx/bzImage-arc" ] && [ -f "brx/initrd-arc" ]; then
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
else
exit 1
fi
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"
sudo rm -rf "/tmp/p1"
sudo rm -rf "/tmp/p3"
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk

View File

@@ -27,14 +27,11 @@ getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
case "${1}" in
evo) getBuildroot "${1}" "br" ;;
*) echo "Invalid option specified" ;;
esac
[ -f "../brs/bzImage" ] && copyBuildroot "brs" || getBuildroots "brs"
# Sbase
IMAGE_FILE="arc.img"
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
IMAGE_FILE="arc_create.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
@@ -48,17 +45,17 @@ mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
ARC_BUILD="$(date +'%y%m%d')"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.3.7"
ARC_BRANCH="dev"
echo "${ARC_VERSION}" >"files/p1/ARC-VERSION"
echo "${ARC_BUILD}" >"files/p1/ARC-BUILD"
echo "${ARC_BRANCH}" >"files/p1/ARC-BRANCH"
ARC_BRANCH="minimal"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
if [ -f "br/bzImage-arc" ] && [ -f "br/initrd-arc" ]; then
cp -f "br/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "br/initrd-arc" "files/initrd" "files/p3/initrd-arc"
if [ -f "brs/bzImage-arc" ] && [ -f "brs/initrd-arc" ]; then
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
else
exit 1
fi
@@ -66,7 +63,7 @@ fi
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
sudo cp -rf "files/p3/"* "/tmp/p3"
sudo sync
sync
echo "Unmount image file"
sudo umount "/tmp/p1"
@@ -76,4 +73,9 @@ sudo rm -rf "/tmp/p3"
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk

View File

@@ -185,33 +185,50 @@ function getTheme() {
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot
# $1 type (min for S, ext for X, micro for M)
# $2 path
function getBuildroot() {
local TYPE="${1}"
local DEST_PATH="${2}"
local REPO=""
local ZIP_NAME=""
local TAG_VAR=""
local REPO="arc-buildroot-${TYPE}"
# Get latest Buildroot-X
# $1 path
function getBuildrootx() {
echo "Getting Buildroot-X begin"
local DEST_PATH="${1}"
echo "Getting Buildroot-${TYPE} begin"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/${REPO}/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRTAG="${TAG}-${TYPE}"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRXTAG="${TAG}"
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
rm -f "${DEST_PATH}/bzImage-arc"
rm -f "${DEST_PATH}/initrd-arc"
while read -r ID NAME; do
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/${REPO}/releases/assets/${ID}" -o "${DEST_PATH}/br.zip"
echo "Buildroot: ${TAG}-${TYPE}"
unzip -o "${DEST_PATH}/br.zip" -d "${DEST_PATH}"
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/assets/${ID}" -o "${DEST_PATH}/brx.zip"
echo "Buildroot-X: ${TAG}"
unzip -o "${DEST_PATH}/brx.zip" -d "${DEST_PATH}"
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
fi
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/${REPO}/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot-S
# $1 path
function getBuildroots() {
echo "Getting Buildroot-S begin"
local DEST_PATH="${1}"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRSTAG="${TAG}"
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
rm -f "${DEST_PATH}/bzImage-arc"
rm -f "${DEST_PATH}/initrd-arc"
while read -r ID NAME; do
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/assets/${ID}" -o "${DEST_PATH}/brs.zip"
echo "Buildroot-S: ${TAG}"
unzip -o "${DEST_PATH}/brs.zip" -d "${DEST_PATH}"
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
fi
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Offline
@@ -277,46 +294,36 @@ function repackInitrd() {
sudo rm -rf "${RDXZ_PATH}"
}
# resizeImg
# resizeimg
# $1 input file
# $2 change size MB e.g., +50M -50M
# $2 changsize MB eg: +50M -50M
# $3 output file
function resizeImg() {
local INPUT_FILE="${1}"
local CHANGE_SIZE="${2}"
local OUTPUT_FILE="${3:-${INPUT_FILE}}"
INPUT_FILE="${1}"
CHANGE_SIZE="${2}"
OUTPUT_FILE="${3:-${INPUT_FILE}}"
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && { echo "Input file not specified or does not exist"; exit 1; }
[[ -z "${CHANGE_SIZE}" ]] && { echo "Change size not specified"; exit 1; }
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && exit 1
[ -z "${CHANGE_SIZE}" ] && exit 1
INPUT_FILE="$(realpath "${INPUT_FILE}")"
OUTPUT_FILE="$(realpath "${OUTPUT_FILE}")"
local CURRENT_SIZE
CURRENT_SIZE=$(du -m "${INPUT_FILE}" | awk '{print $1}')
local SIZE
SIZE=$((CURRENT_SIZE + ${CHANGE_SIZE//M/}))
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && { echo "Invalid size calculated"; exit 1; }
SIZE=$(($(du -m "${INPUT_FILE}" | awk '{print $1}')$(echo "${CHANGE_SIZE}" | sed 's/M//g; s/b//g')))
[[ -z "${SIZE}" || "${SIZE}" -lt 0 ]] && exit 1
if [[ "${INPUT_FILE}" != "${OUTPUT_FILE}" ]]; then
if [ ! "${INPUT_FILE}" = "${OUTPUT_FILE}" ]; then
sudo cp -f "${INPUT_FILE}" "${OUTPUT_FILE}"
fi
sudo truncate -s "${SIZE}M" "${OUTPUT_FILE}"
# Use `parted` to resize partition 3
sudo parted "${OUTPUT_FILE}" --script -- resizepart 3 "${SIZE}M"
local LOOPX
sudo truncate -s ${SIZE}M "${OUTPUT_FILE}"
echo -e "d\n\nn\n\n\n\n\nn\nw" | sudo fdisk "${OUTPUT_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${OUTPUT_FILE}"
local PARTITION
PARTITION=$(ls "${LOOPX}p3")
sudo e2fsck -fp "${PARTITION}"
sudo tune2fs -l "${PARTITION}" | grep "Block size"
sudo resize2fs "${PARTITION}"
sudo losetup -d "${LOOPX}"
sudo losetup -P ${LOOPX} "${OUTPUT_FILE}"
sudo e2fsck -fp $(ls ${LOOPX}* | sort -n | tail -1)
sudo resize2fs $(ls ${LOOPX}* | sort -n | tail -1)
sudo losetup -d ${LOOPX}
}
# createvmx
@@ -492,4 +499,4 @@ function copyBuildroot() {
mkdir -p "${DEST_PATH}"
cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
}
}

View File

@@ -29,7 +29,7 @@ done
popd
rm -f grub.img
dd if=/dev/zero of=grub.img bs=1M seek=2048 count=0
dd if=/dev/zero of=grub.img bs=1M seek=1024 count=0
echo -e "n\np\n1\n\n+50M\nn\np\n2\n\n+50M\nn\np\n3\n\n\na\n1\nw\nq\n" | fdisk grub.img
fdisk -l grub.img
@@ -71,4 +71,4 @@ sudo umount ${LOOPX}p1
sudo losetup -d ${LOOPX}
sudo rm -rf ${NAME}1
gzip grub.img
gzip grub.img