Compare commits

...

117 Commits

Author SHA1 Message Date
AuxXxilium
8f4cb31962 Merge pull request #5255 from AuxXxilium/dev
Dev
2024-12-18 21:25:18 +01:00
AuxXxilium
3b62345e5a grub: update 2024-12-17 23:21:27 2024-12-18 20:50:57 +01:00
AuxXxilium
f564167e9d tree: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-18 20:50:37 +01:00
AuxXxilium
67e3d5c0f8 tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-16 17:56:28 +01:00
AuxXxilium
80d3118e7d Merge pull request #5231 from AuxXxilium/dev
Dev
2024-12-11 22:21:20 +01:00
AuxXxilium
39e00baf57 tree: more fixes
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-11 18:17:54 +01:00
AuxXxilium
3378fb5a93 grub: update 2024-12-11 18:10:51 2024-12-11 18:10:51 +01:00
AuxXxilium
7e481182b1 tree: more fixes
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-11 17:55:26 +01:00
AuxXxilium
6b0d2dad68 build: local update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-09 17:03:05 +01:00
AuxXxilium
8b8a7bcc99 storage: silence output
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-08 13:49:34 +01:00
AuxXxilium
a4a3c1998b Merge pull request #5133 from AuxXxilium/dev
functions: rewrite text
2024-12-07 18:51:59 +01:00
AuxXxilium
1ecf4db983 functions: rewrite text
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-07 18:51:40 +01:00
AuxXxilium
8adb3026f7 Merge pull request #5128 from AuxXxilium/dev
arc: fix port change
2024-12-07 15:25:13 +01:00
AuxXxilium
c9c320c2ca arc: fix port change
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-07 15:24:52 +01:00
AuxXxilium
4902d10167 Merge pull request #5124 from AuxXxilium/dev
Dev
2024-12-07 13:45:34 +01:00
AuxXxilium
04890fecd5 arc: fix SN if automated update and user set his own
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-07 13:45:03 +01:00
AuxXxilium
28c68c9043 network: fix window
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-07 00:31:17 +01:00
AuxXxilium
6f6778f3a3 tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-06 18:28:19 +01:00
AuxXxilium
bedf2d0a6b boot: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-06 16:23:54 +01:00
AuxXxilium
fe3430df09 Merge pull request #5093 from AuxXxilium/dev
Dev
2024-12-05 19:38:57 +01:00
AuxXxilium
8af23fb3fe boot: fix typo
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-05 19:37:53 +01:00
AuxXxilium
f124199acc tree: fix typo
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-05 19:23:10 +01:00
AuxXxilium
831d4c6384 arc-functions: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-05 19:20:37 +01:00
AuxXxilium
48780950bd boot: init: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-05 19:10:45 +01:00
AuxXxilium
e5ad10ab09 grub/boot: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-05 18:57:16 +01:00
AuxXxilium
09f52a444e grub: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-05 18:53:21 +01:00
AuxXxilium
a40b66063a Merge pull request #5066 from AuxXxilium/dev
Dev
2024-12-03 22:17:06 +01:00
AuxXxilium
8997d71e0c grub: set gfx back to old
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-03 22:16:36 +01:00
AuxXxilium
04da524e3d Merge pull request #5065 from AuxXxilium/dev
Dev
2024-12-03 22:05:58 +01:00
AuxXxilium
7f434f374a grub: update 2024-12-03 21:05:25 2024-12-03 21:05:25 +01:00
AuxXxilium
82c9fc028a arc: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-03 20:48:31 +01:00
AuxXxilium
135505bf22 Merge pull request #5046 from AuxXxilium/dev
tree: fix more logic
2024-12-02 23:53:57 +01:00
AuxXxilium
d55ca84ccd tree: fix more logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-02 23:46:49 +01:00
AuxXxilium
85e636d0e6 Merge pull request #5045 from AuxXxilium/dev
func: fix typo
2024-12-02 23:30:28 +01:00
AuxXxilium
29a028ad89 func: fix typo
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-02 23:29:57 +01:00
AuxXxilium
a886046e64 Merge pull request #5044 from AuxXxilium/dev
Dev
2024-12-02 23:12:32 +01:00
AuxXxilium
915f60710d build: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-02 23:11:35 +01:00
AuxXxilium
567aaf9733 arc: fix keymap
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-02 20:44:06 +01:00
AuxXxilium
8d2b2acb62 Merge pull request #5029 from AuxXxilium/dev
arc: update model table
2024-12-01 20:46:09 +01:00
AuxXxilium
49d8a0425c arc: update model table
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 20:40:48 +01:00
AuxXxilium
0acb2020c8 Merge pull request #5028 from AuxXxilium/dev
tree: rewrite more
2024-12-01 19:19:29 +01:00
AuxXxilium
5338b8ecc7 tree: rewrite more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 19:09:57 +01:00
AuxXxilium
fb44e027b3 Merge pull request #5027 from AuxXxilium/dev
Dev
2024-12-01 18:12:30 +01:00
AuxXxilium
ad987595bb tree: rework more logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 18:09:26 +01:00
AuxXxilium
3049a8cf5d tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 17:53:50 +01:00
AuxXxilium
f6f9ed1810 arc: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 17:42:45 +01:00
AuxXxilium
b33d1e0013 grub: test
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 17:09:48 +01:00
AuxXxilium
a3f6d44b52 Merge pull request #5024 from AuxXxilium/dev
Dev
2024-12-01 16:44:44 +01:00
AuxXxilium
931e5c7942 grub: set fixed resolution
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 16:37:23 +01:00
AuxXxilium
2c90cfd41b init: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 11:23:32 +01:00
AuxXxilium
bf33567af2 arc-functions: fix clone loader
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-12-01 11:12:19 +01:00
AuxXxilium
4418bfa3f9 Merge pull request #5005 from AuxXxilium/dev
tree: fix automated
2024-11-30 23:27:14 +01:00
AuxXxilium
a239db84ff tree: fix automated
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-30 23:26:20 +01:00
AuxXxilium
9a50bf50ea Merge pull request #5003 from AuxXxilium/dev
Dev
2024-11-30 22:16:48 +01:00
AuxXxilium
ea0c82fd95 tree: fix more logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-30 22:12:52 +01:00
AuxXxilium
c8663b8994 boot: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-30 21:29:31 +01:00
AuxXxilium
0cf78e4fbf Merge pull request #5000 from AuxXxilium/dev
Dev
2024-11-30 20:18:33 +01:00
AuxXxilium
65210543b7 tree: fix more logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-30 20:17:44 +01:00
AuxXxilium
13fa3fc771 tree: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-30 02:49:53 +01:00
AuxXxilium
f6f86334ed grub: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-29 22:45:11 +01:00
AuxXxilium
74093f29b1 init/boot: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-29 21:31:13 +01:00
AuxXxilium
466424229d tree: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-28 23:22:57 +01:00
AuxXxilium
6c31c321e6 arc: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-28 20:53:38 +01:00
AuxXxilium
1f46c8860f tree: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-28 18:03:45 +01:00
AuxXxilium
21ffcf4cd5 busybox: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-26 22:07:20 +01:00
AuxXxilium
4a94b7237f boot: fix mac
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-25 00:16:43 +01:00
AuxXxilium
8c0e316993 tree: update more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-25 00:12:14 +01:00
AuxXxilium
582292c5d1 init: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-25 00:00:09 +01:00
AuxXxilium
d87c63b870 arc: fix menu bug
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 23:52:35 +01:00
AuxXxilium
4be4774994 boot: add sections
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 23:16:09 +01:00
AuxXxilium
5f89c1d61a tree: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 22:56:22 +01:00
AuxXxilium
73ad75ed34 update: rewrite messages
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 14:00:32 +01:00
AuxXxilium
bc0c10f829 boot/grub: change intel pstate
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 12:55:17 +01:00
AuxXxilium
dfe6a3c534 arc: add new addon to preselection
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 11:39:59 +01:00
AuxXxilium
75fa94aba8 Merge branch 'test' into dev
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 11:36:33 +01:00
AuxXxilium
8b4bdf2fc8 tree: fix syntax and logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-24 11:32:03 +01:00
AuxXxilium
16f3590843 update: fix window
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-23 23:32:04 +01:00
AuxXxilium
892c374946 tree: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-23 14:36:09 +01:00
AuxXxilium
c77d646d26 tree: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 20:20:45 +01:00
AuxXxilium
9323868f05 grub: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 20:15:15 +01:00
AuxXxilium
3555ec84ad build: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 20:08:59 +01:00
AuxXxilium
32ffa70cb1 tree: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 19:54:38 +01:00
AuxXxilium
2d0dd7d7e9 tree: rework 2
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 13:39:15 +01:00
AuxXxilium
27493c7f4f tree: rework menu order and fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 12:30:57 +01:00
AuxXxilium
1021427900 grub: fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 12:01:21 +01:00
AuxXxilium
8cb6619ae8 tree: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-20 01:29:20 +01:00
AuxXxilium
d9ebdd95d8 functions: fast fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 17:30:55 +01:00
AuxXxilium
902db23960 arc: add warning if arc patch failed
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 16:48:17 +01:00
AuxXxilium
2c2286e651 arc: don't show online functions if loader is offline
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 16:42:46 +01:00
AuxXxilium
d274d528bb arc: reinit loader after restore config
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 16:40:17 +01:00
AuxXxilium
dabbd3ff81 arc: fix restore from online
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 16:38:27 +01:00
AuxXxilium
b2538b24ef tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 16:22:53 +01:00
AuxXxilium
c4ff1ecf1e arc: remove some warnings
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-17 16:17:59 +01:00
AuxXxilium
e218db8511 arc: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 23:17:59 +01:00
AuxXxilium
8c22d11c49 tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 22:58:57 +01:00
AuxXxilium
71e7eba6f3 arc: change false message
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 22:42:00 +01:00
AuxXxilium
5f030c2349 tree: add some sanity check
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 21:53:43 +01:00
AuxXxilium
5fa2c3a1c6 arc: cleanup more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 20:43:46 +01:00
AuxXxilium
cf2daa9807 networkdiag: add useridapi check
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 19:01:58 +01:00
AuxXxilium
167d909e13 arc-functions: add message for user without a brain
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 18:27:12 +01:00
AuxXxilium
b4ebd305bd functions: fix typo
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 15:45:11 +01:00
AuxXxilium
f4bbb7c5bb tree: rework more logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 11:31:31 +01:00
AuxXxilium
390f5b11db tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 10:42:03 +01:00
AuxXxilium
8bc3393d55 functions: move to correct file
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-16 00:35:56 +01:00
AuxXxilium
cee2d7d263 tree: cleanup
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-15 15:46:33 +01:00
AuxXxilium
ab508a9eb5 arc-functions: rename update function
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-15 15:35:27 +01:00
AuxXxilium
16a73afe9d arc-functions: more logic fix
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-15 15:25:43 +01:00
AuxXxilium
c4cc0b779a arc-functions: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-15 14:57:03 +01:00
AuxXxilium
601547d9db arc-functions: more work
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-15 14:16:47 +01:00
AuxXxilium
a68b5d446e functions: fix hwid for multiple nic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-15 14:08:09 +01:00
AuxXxilium
3ccb91be9f arc-functions: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-14 20:42:40 +01:00
AuxXxilium
3e010b781a arc: fix copy
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-13 23:53:11 +01:00
AuxXxilium
dcd86a4272 build: fix local
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-13 23:43:24 +01:00
AuxXxilium
c287e33aab arc: fix logic
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-13 18:55:07 +01:00
AuxXxilium
95c1eb6897 tree: rework more
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-13 18:05:58 +01:00
AuxXxilium
fb183e437e build: fix local
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-13 17:23:09 +01:00
AuxXxilium
efca3aaf6d arc-functions: rework id check
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-11-13 01:20:37 +01:00
36 changed files with 1470 additions and 1198 deletions

View File

@@ -45,15 +45,19 @@ jobs:
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
sudo snap install yq
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
# sudo snap install yq
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
fi
df -h
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get Buildroot
run: |
. scripts/func.sh
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
echo "Get Dependencies"
getAddons "files/p3/addons"
@@ -116,7 +120,6 @@ jobs:
echo "Repack initrd"
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
#cp -f "brx/initrd-arc" "files/p3/initrd-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
@@ -133,9 +136,15 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx
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 Next Image
@@ -152,7 +161,7 @@ jobs:
# Cleanup
- name: Cleanup
run: |
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc.vhdx" "arc-flat.vmdk"
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc"
# Build incremental
- name: Build Stable Image
@@ -206,9 +215,15 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx
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 Stable Image
@@ -236,7 +251,8 @@ jobs:
- Development Build
### Information:
- Full Changelog and Arc Patch (Decryption Key) are available in my Discord.
- Full Changelog is available in my Discord
- Discord Account for Arc Patch needed
### Dependencies:
- Addons: ${{ env.ADDONTAG }}

View File

@@ -71,15 +71,19 @@ jobs:
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
sudo snap install yq
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
# sudo snap install yq
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
fi
df -h
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get Dependencies for all Image
run: |
. scripts/func.sh
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
echo "Get Dependencies"
getAddons "files/p3/addons"
@@ -90,7 +94,7 @@ jobs:
getOffline "files/p3/configs"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getBuildrootx "brx"
getBuildrootx "brx"
getBuildroots "brs"
# Export Dependencies Version to env
@@ -142,7 +146,6 @@ jobs:
echo "Repack initrd"
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
#cp -f "brx/initrd-arc" "files/p3/initrd-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
@@ -159,9 +162,12 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx
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"
@@ -174,7 +180,7 @@ jobs:
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 }}.vhdx.zip" arc.vhdx
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)
fi
@@ -182,7 +188,7 @@ jobs:
# Cleanup
- name: Cleanup
run: |
rm -rf "arc.img" "arc.ova" "arc.vmdk" "arc-dyn.vmdk" "arc.vhdx" "arc-flat.vmdk"
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc"
# Build incremental
- name: Build Stable Image
@@ -236,9 +242,12 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic arc-dyn.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vhdx -o subformat=dynamic arc.vhdx
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"
@@ -251,7 +260,7 @@ jobs:
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 }}.vhdx.zip" arc.vhdx
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)
fi
@@ -270,7 +279,8 @@ jobs:
- ${{ inputs.notice }}
### Information:
- Full Changelog and Arc Patch (Decryption Key) are available in my Discord.
- Full Changelog is available in my Discord
- Discord Account for Arc Patch needed
### Versions:
- stable: Stable Image (Full Image, all dependencies are included, less hardware support)

View File

@@ -43,7 +43,7 @@ jobs:
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)"
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -E '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##*/}"

File diff suppressed because it is too large Load Diff

View File

@@ -4,20 +4,19 @@
# 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}/include/addons.sh
. ${ARC_PATH}/include/modules.sh
. ${ARC_PATH}/include/update.sh
. ${ARC_PATH}/include/storage.sh
. ${ARC_PATH}/include/network.sh
. ${ARC_PATH}/include/compat.sh
. ${ARC_PATH}/arc-functions.sh
. "${ARC_PATH}/include/functions.sh"
. "${ARC_PATH}/include/addons.sh"
. "${ARC_PATH}/include/modules.sh"
. "${ARC_PATH}/include/update.sh"
. "${ARC_PATH}/include/storage.sh"
. "${ARC_PATH}/include/network.sh"
. "${ARC_PATH}/include/compat.sh"
. "${ARC_PATH}/arc-functions.sh"
# Get Keymap and Timezone Config
# Get Keymap and Timezone and check System
onlineCheck
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
# Check for System
systemCheck
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
@@ -60,7 +59,7 @@ BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
###############################################################################
# Mounts backtitle dynamically
function backtitle() {
BACKTITLE="${ARC_TITLE}$([ -n "${NEWTAG}" ] && [ ${ARC_VERSION//[!0-9]/} -lt ${NEWTAG//[!0-9]/} ] && echo " > ${NEWTAG}") | "
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)} | "
@@ -69,19 +68,19 @@ function backtitle() {
BACKTITLE+="Build: ${BUILDDONE} | "
BACKTITLE+="${MACHINE}(${BUS}) | "
[ -n "${KEYMAP}" ] && BACKTITLE+="KB: ${KEYMAP}"
[ "${ARCOFFLINE}" == "true" ] && BACKTITLE+=" | Offline"
[ "${ARCOFFLINE}" = "true" ] && BACKTITLE+=" | Offline"
echo "${BACKTITLE}"
}
function backtitlep() {
[ "${STEP}" == "model" ] && BACKTITLEP="CHOOSE MODEL >>> " || BACKTITLEP="Choose Model >>> "
[ "${STEP}" == "version" ] && BACKTITLEP+="CHOOSE VERSION >>> " || BACKTITLEP+="Choose Version >>> "
[ "${STEP}" == "snmac" ] && BACKTITLEP+="SET SN/MAC >>> " || BACKTITLEP+="Set SN/Mac >>> "
[ "${STEP}" == "network" ] && BACKTITLEP+="SET NETWORK >>> " || BACKTITLEP+="Set Network >>> "
[ "${STEP}" == "storagemap" ] && BACKTITLEP+="SET STORAGEMAP >>> " || BACKTITLEP+="Set StorageMap >>> "
[ "${STEP}" == "addons" ] && BACKTITLEP+="SET ADDONS >>> " || BACKTITLEP+="Set Addons >>> "
[ "${STEP}" == "build" ] && BACKTITLEP+="BUILD LOADER >>> " || BACKTITLEP+="Build Loader >>> "
[ "${STEP}" == "boot" ] && BACKTITLEP+="BOOT DSM" || BACKTITLEP+="Boot DSM"
[ "${STEP}" = "model" ] && BACKTITLEP="CHOOSE MODEL >>> " || BACKTITLEP="Choose Model >>> "
[ "${STEP}" = "version" ] && BACKTITLEP+="CHOOSE VERSION >>> " || BACKTITLEP+="Choose Version >>> "
[ "${STEP}" = "snmac" ] && BACKTITLEP+="SET SN/MAC >>> " || BACKTITLEP+="Set SN/Mac >>> "
[ "${STEP}" = "network" ] && BACKTITLEP+="SET NETWORK >>> " || BACKTITLEP+="Set Network >>> "
[ "${STEP}" = "storagemap" ] && BACKTITLEP+="SET STORAGEMAP >>> " || BACKTITLEP+="Set StorageMap >>> "
[ "${STEP}" = "addons" ] && BACKTITLEP+="SET ADDONS >>> " || BACKTITLEP+="Set Addons >>> "
[ "${STEP}" = "build" ] && BACKTITLEP+="BUILD LOADER >>> " || BACKTITLEP+="Build Loader >>> "
[ "${STEP}" = "boot" ] && BACKTITLEP+="BOOT DSM" || BACKTITLEP+="Boot DSM"
echo "${BACKTITLEP}"
}
@@ -89,11 +88,10 @@ function backtitlep() {
# Model Selection
function arcModel() {
STEP="model"
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
dialog --backtitle "$(backtitlep)" --title "Model" \
--infobox "Reading Models..." 3 25
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs
fi
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
# Loop menu
RESTRICT=1
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
@@ -104,7 +102,7 @@ function arcModel() {
echo "${M} ${P}" >>"${TMP_PATH}/modellist"
done < <(echo "${PM}")
done < <(echo "${PS}")
if [ "${ARCMODE}" == "config" ]; then
if [ "${ARCMODE}" = "config" ]; then
while true; do
echo -n "" >"${TMP_PATH}/menu"
while read -r M A; do
@@ -115,16 +113,16 @@ function arcModel() {
ARC=""
BETA=""
[ -n "${ARCCONFM}" ] && ARC="x" || ARC=""
[ "${DT}" == "true" ] && DTS="x" || DTS=""
[ "${DT}" = "true" ] && DTS="x" || DTS=""
IGPUS=""
[[ "${A}" == "apollolake" || "${A}" == "geminilake" ]] && IGPUS="up to 9th"
[ "${A}" == "epyc7002" ] && IGPUS="up to 14th"
[ "${DT}" == "true" ] && HBAS="" || HBAS="x"
[ "${M}" == "SA6400" ] && HBAS="x"
[ "${DT}" == "false" ] && USBS="int/ext" || USBS="ext"
[[ "${M}" == "DS918+" || "${M}" == "DS1019+" || "${M}" == "DS1621xs+" || "${M}" == "RS1619xs+" ]] && M_2_CACHE="+" || M_2_CACHE="x"
[[ "${M}" == "DS220+" || "${M}" == "DS224+" ]] && M_2_CACHE=""
[[ "${M}" == "DS220+" || "${M}" == "DS224+" || "${M}" == "DS918+" || "${M}" == "DS1019+" || "${M}" == "DS1621xs+" || "${M}" == "RS1619xs+" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
[[ "${A}" = "apollolake" || "${A}" = "geminilake" ]] && IGPUS="up to 9th"
[ "${A}" = "epyc7002" ] && IGPUS="up to 14th"
[ "${DT}" = "true" ] && HBAS="" || HBAS="x"
[ "${M}" = "SA6400" ] && HBAS="x"
[ "${DT}" = "false" ] && USBS="int/ext" || USBS="ext"
[[ "${M}" = "DS718+" || "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_CACHE="+" || M_2_CACHE="x"
[[ "${M}" = "DS220+" || "${M}" = "DS224+" ]] && M_2_CACHE=""
[[ "${M}" = "DS220+" || "${M}" = "DS224+" || "${M}" = "DS718+" || "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
# Check id model is compatible with CPU
if [ ${RESTRICT} -eq 1 ]; then
for F in "${FLAGS}"; do
@@ -133,32 +131,33 @@ function arcModel() {
break
fi
done
if [ "${A}" != "epyc7002" ] && [ "${DT}" == "true" ] && [ "${EXTERNALCONTROLLER}" == "true" ]; then
if [ "${A}" != "epyc7002" ] && [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
COMPATIBLE=0
fi
if [ "${A}" != "epyc7002" ] && [ ${SATACONTROLLER} -eq 0 ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
if [ "${A}" != "epyc7002" ] && [ ${SATACONTROLLER} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
COMPATIBLE=0
fi
if [ "${A}" == "epyc7002" ] && [[ ${SCSICONTROLLER} -ne 0 || ${RAIDCONTROLLER} -ne 0 ]]; then
if [ "${A}" = "epyc7002" ] && [[ ${SCSICONTROLLER} -ne 0 || ${RAIDCONTROLLER} -ne 0 ]]; then
COMPATIBLE=0
fi
if [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" == "usb" ] && [ ${SATADRIVES} -eq 0 ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
if [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "usb" ] && [ ${SATADRIVES} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
COMPATIBLE=0
elif [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" == "sata" ] && [ ${SATADRIVES} -eq 1 ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
elif [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "sata" ] && [ ${SATADRIVES} -eq 1 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
COMPATIBLE=0
fi
[ -z "$(grep -w "${M}" "${S_FILE}")" ] && COMPATIBLE=0
fi
[ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno"
[ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0
if [ -n "${ARCKEY}" ]; then
if [ -n "${ARCCONF}" ]; then
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
else
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
fi
done < <(cat "${TMP_PATH}/modellist")
[ -n "${ARCKEY}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
[ -n "${ARCKEY}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
dialog --backtitle "$(backtitlep)" --title "${TITLEMSG}" --colors \
--cancel-label "Show all" --help-button --help-label "Exit" \
--extra-button --extra-label "Info" \
@@ -166,25 +165,21 @@ function arcModel() {
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
RET=$?
case ${RET} in
0) # ok-button
0)
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
break
;;
1) # cancel-button -> Show all Models
1)
[ ${RESTRICT} -eq 1 ] && RESTRICT=0 || RESTRICT=1
;;
2) # help-button -> Exit
return 1
break
;;
3) # extra-button -> Platform Info
3)
resp=$(cat ${TMP_PATH}/resp)
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
dialog --backtitle "$(backtitlep)" --colors \
--title "Platform Info" --textbox "./informations/${PLATFORM}.yml" 70 80
;;
255) # ESC -> Exit
*)
return 1
break
;;
@@ -192,7 +187,7 @@ function arcModel() {
done
fi
# Reset Model Config if changed
if [ "${ARCMODE}" == "config" ] && [ "${MODEL}" != "${resp}" ]; then
if [ "${ARCMODE}" = "config" ] && [ "${MODEL}" != "${resp}" ]; then
MODEL="${resp}"
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
@@ -241,11 +236,11 @@ function arcVersion() {
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" == "config" ] && [ "${ARCRESTORE}" != "true" ]; then
if [ "${ARCMODE}" = "config" ] && [ "${ARCRESTORE}" != "true" ]; then
# Select Build for DSM
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
dialog --clear --no-items --nocancel --title "Version" --backtitle "$(backtitlep)" \
--no-items --menu "Choose DSM Version" 7 30 0 ${ITEMS} \
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitlep)" \
--no-items --menu "Select DSM Version" 7 30 0 ${ITEMS} \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 0
resp=$(cat ${TMP_PATH}/resp)
@@ -274,7 +269,7 @@ function arcVersion() {
PVS="$(readConfigEntriesArray "${PLATFORM}.\"${MODEL}\"" "${D_FILE}" | sort -r)"
echo -n "" >"${TMP_PATH}/versions"
while read -r V; do
if [ "${V:0:3}" != "${PRODUCTVER}" ] || [ "${V}" == "${PREV}" ]; then
if [ "${V:0:3}" != "${PRODUCTVER}" ] || [ "${V}" = "${PREV}" ]; then
continue
else
echo "${V}" >>"${TMP_PATH}/versions"
@@ -282,8 +277,8 @@ function arcVersion() {
PREV="${V}"
done < <(echo "${PVS}")
DSMPVS="$(cat ${TMP_PATH}/versions)"
dialog --backtitle "$(backtitlep)" --colors --title "Version" \
--no-items --menu "Choose a DSM Build" 0 0 0 ${DSMPVS} \
dialog --backtitle "$(backtitlep)" --colors --title "DSM Build" \
--no-items --menu "Select DSM Build" 0 0 0 ${DSMPVS} \
2>${TMP_PATH}/resp
RET=$?
[ ${RET} -ne 0 ] && return
@@ -320,11 +315,11 @@ function arcVersion() {
dialog --backtitle "$(backtitlep)" --colors --title "Automated Mode" \
--yesno "${MSG}" 6 55
[ $? -eq 0 ] && ARCMODE="automated" || ARCMODE="config"
elif [ "${ARCMODE}" == "automated" ] || [ "${ARCRESTORE}" == "true" ]; then
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
VALID="true"
fi
# Change Config if Files are valid
if [ "${VALID}" == "true" ]; then
if [ "${VALID}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Config" \
--infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60
# Reset Synoinfo
@@ -336,27 +331,27 @@ function arcVersion() {
ADDONS="$(readConfigKey "addons" "${USER_CONFIG_FILE}")"
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
if [ "${ADDONS}" == "{}" ]; then
if [ "${ADDONS}" = "{}" ]; then
initConfigKey "addons.acpid" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.updatenotify" "" "${USER_CONFIG_FILE}"
if [ ${NVMEDRIVES} -gt 0 ]; then
if [ "${PLATFORM}" == "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
if [ "${PLATFORM}" = "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
initConfigKey "addons.nvmesystem" "" "${USER_CONFIG_FILE}"
elif [ "${MODEL}" == "DS918+" ] || [ "${MODEL}" == "DS1019+" ] || [ "${MODEL}" == "DS1621xs+" ] || [ "${MODEL}" == "RS1619xs+" ]; then
elif [ "${MODEL}" = "DS918+" ] || [ "${MODEL}" = "DS1019+" ] || [ "${MODEL}" = "DS1621xs+" ] || [ "${MODEL}" = "RS1619xs+" ]; then
initConfigKey "addons.nvmecache" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
else
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
fi
fi
if [ "${MACHINE}" == "Native" ]; then
if [ "${MACHINE}" = "Native" ]; then
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.powersched" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.sensors" "" "${USER_CONFIG_FILE}"
fi
if [ "${PLATFORM}" == "apollolake" ] || [ "${PLATFORM}" == "geminilake" ]; then
if [ "${PLATFORM}" = "apollolake" ] || [ "${PLATFORM}" = "geminilake" ]; then
initConfigKey "addons.i915" "" "${USER_CONFIG_FILE}"
fi
if echo "${PAT_URL}" 2>/dev/null | grep -q "7.2.2"; then
@@ -365,6 +360,9 @@ function arcVersion() {
if [ -n "${ARCCONF}" ]; then
initConfigKey "addons.arcdns" "" "${USER_CONFIG_FILE}"
fi
if [ ${SASDRIVES} -gt 0 ] && [ "${DT}" = "false" ]; then
initConfigKey "addons.smartctl" "" "${USER_CONFIG_FILE}"
fi
fi
while IFS=': ' read -r ADDON PARAM; do
[ -z "${ADDON}" ] && continue
@@ -373,7 +371,7 @@ function arcVersion() {
fi
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do
@@ -381,7 +379,7 @@ function arcVersion() {
done < <(getAllModules "${PLATFORM}" "${KVERP}")
fi
# Check for Only Version
if [ "${ONLYVERSION}" == "true" ]; then
if [ "${ONLYVERSION}" = "true" ]; then
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYVERSION="false"
@@ -406,18 +404,17 @@ function arcPatch() {
# Read Model Values
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" == "automated" ]; then
[ -z "${ARCCONF}" ] && checkHardwareID || true
sleep 1
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" == "config" ]; then
if [ "${ARCMODE}" = "automated" ] && [ "${ARCPATCH}" != "user" ]; then
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" = "config" ]; then
dialog --clear --backtitle "$(backtitlep)" \
--nocancel --title "SN/Mac Options"\
--menu "Choose an Option." 7 60 0 \
--menu "Choose an Option" 7 60 0 \
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
2 "Use random SN/Mac (Reduced DSM Features)" \
3 "Use my own SN/Mac (Be sure your Data is valid)" \
@@ -425,11 +422,20 @@ function arcPatch() {
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
[ -z "${ARCCONF}" ] && checkHardwareID || true
sleep 1
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
if [ -n "${ARCCONF}" ]; then
dialog --backtitle "$(backtitlep)" --colors --title "Arc Patch" \
--infobox "Arc Patch successful!" 3 30
sleep 2
SN="$(generateSerial "${MODEL}" "true")"
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
else
dialog --backtitle "$(backtitlep)" --colors --title "Arc Patch" \
--infobox "Arc Patch failed!" 3 30
sleep 2
SN="$(generateSerial "${MODEL}" "false")"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
fi
elif [ ${resp} -eq 2 ]; then
# Generate random Serial
SN="$(generateSerial "${MODEL}" "false")"
@@ -449,8 +455,8 @@ function arcPatch() {
done
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
fi
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
fi
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
arcSettings
}
@@ -466,20 +472,22 @@ function arcSettings() {
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
# Get Network Config for Loader
STEP="network"
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
sleep 2
getnet
[ $? -ne 0 ] && return 1
if [ "${ONLYPATCH}" == "true" ]; then
if [ "${ARCMODE}" = "config" ] || [ "${ARCPATCH}" = "true" ] || [ "${ARCPATCH}" = "false" ]; then
STEP="network"
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
sleep 2
getnet
[ $? -ne 0 ] && return 1
fi
if [ "${ONLYPATCH}" = "true" ]; then
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYPATCH="false"
return 0
fi
# Select Portmap for Loader
if [ "${DT}" == "false" ] && [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
STEP="storagemap"
dialog --backtitle "$(backtitlep)" --colors --title "Storage Map" \
--infobox "Generating Storage Map..." 3 40
@@ -488,7 +496,7 @@ function arcSettings() {
[ $? -ne 0 ] && return 1
fi
# Check for Custom Build
if [ "${ARCMODE}" == "config" ]; then
if [ "${ARCMODE}" = "config" ]; then
# Select Addons
STEP="addons"
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
@@ -497,17 +505,17 @@ function arcSettings() {
[ $? -ne 0 ] && return 1
fi
# Check for CPU Frequency Scaling & Governor
if [ "${ARCMODE}" == "config" ] && [ "${MACHINE}" == "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
governorSelection
[ $? -ne 0 ] && return 1
elif [ "${ARCMODE}" == "automated" ] && [ "${MACHINE}" == "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
[ "${PLATFORM}" == "epyc7002" ] && writeConfigKey "addons.cpufreqscaling" "schedutil" "${USER_CONFIG_FILE}" || writeConfigKey "addons.cpufreqscaling" "conservative" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
[ "${PLATFORM}" = "epyc7002" ] && writeConfigKey "addons.cpufreqscaling" "schedutil" "${USER_CONFIG_FILE}" || writeConfigKey "addons.cpufreqscaling" "conservative" "${USER_CONFIG_FILE}"
fi
if [ "${ARCMODE}" == "config" ]; then
if [ "${ARCMODE}" = "config" ]; then
# Check for DT and HBA/Raid Controller
if [ "${DT}" == "true" ] && [ "${EXTERNALCONTROLLER}" == "true" ]; then
if [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
fi
@@ -518,24 +526,24 @@ function arcSettings() {
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You have more NIC (${DEVICENIC}) then 8 NIC.\nOnly 8 supported by DSM." 6 60
fi
if [ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" == "true" ]; then
if [ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly ${MODELNIC} are used by Arc Patch." 6 80
--msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
fi
# Check for AES
if [ "${AESSYS}" == "false" ]; then
if [ "${AESSYS}" = "false" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: Your System doesn't support Hardwareencryption in DSM. (AES)" 5 70
fi
# Check for CPUFREQ
if [[ "${CPUFREQ}" == "false" || "${ACPISYS}" == "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
fi
fi
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
# eMMC Boot Support
if [ "${EMMCBOOT}" == "true" ]; then
if [ "${EMMCBOOT}" = "true" ]; then
writeConfigKey "modules.mmc_block" "" "${USER_CONFIG_FILE}"
writeConfigKey "modules.mmc_core" "" "${USER_CONFIG_FILE}"
else
@@ -547,7 +555,7 @@ function arcSettings() {
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" == "config" ]; then
if [ "${ARCMODE}" = "config" ]; then
# Ask for Build
dialog --clear --backtitle "$(backtitlep)" --title "Config done" \
--no-cancel --menu "Build now?" 7 40 0 \
@@ -587,12 +595,12 @@ function arcSummary() {
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
if [ "${REMAP}" == "acports" ] || [ "${REMAP}" == "maxports" ]; then
if [ "${REMAP}" = "acports" ] || [ "${REMAP}" = "maxports" ]; then
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
elif [ "${REMAP}" == "remap" ]; then
elif [ "${REMAP}" = "remap" ]; then
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
elif [ "${REMAP}" == "ahci" ]; then
elif [ "${REMAP}" = "ahci" ]; then
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
else
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
@@ -609,7 +617,7 @@ function arcSummary() {
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${DT}" == "false" ] && [ "${REMAP}" == "user" ]; then
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ]; then
if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Error" \
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
@@ -624,7 +632,7 @@ function arcSummary() {
SUMMARY+="\n>> DT: \Zb${DT}\Zn"
SUMMARY+="\n>> PAT URL: \Zb${PAT_URL}\Zn"
SUMMARY+="\n>> PAT Hash: \Zb${PAT_HASH}\Zn"
[ "${MODEL}" == "SA6400" ] && SUMMARY+="\n>> Kernel: \Zb${KERNEL}\Zn"
[ "${MODEL}" = "SA6400" ] && SUMMARY+="\n>> Kernel: \Zb${KERNEL}\Zn"
SUMMARY+="\n>> Kernel Version: \Zb${KVER}\Zn"
SUMMARY+="\n"
SUMMARY+="\n\Z4> Arc Information\Zn"
@@ -633,7 +641,7 @@ function arcSummary() {
[ -n "${DISKMAP}" ] && SUMMARY+="\n>> DiskIdxMap: \Zb${DISKMAP}\Zn"
[ -n "${PORTREMAP}" ] && SUMMARY+="\n>> SataRemap: \Zb${PORTREMAP}\Zn"
[ -n "${AHCIPORTREMAP}" ] && SUMMARY+="\n>> AhciRemap: \Zb${AHCIPORTREMAP}\Zn"
[ "${DT}" == "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn"
[ "${DT}" = "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn"
SUMMARY+="\n>> Directboot: \Zb${DIRECTBOOT}\Zn"
SUMMARY+="\n>> eMMC Boot: \Zb${EMMCBOOT}\Zn"
SUMMARY+="\n>> Kernelload: \Zb${KERNELLOAD}\Zn"
@@ -667,19 +675,6 @@ function arcSummary() {
# Building Loader
function make() {
STEP="build"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)"
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
BOOTMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${BOOTMODE}" != "automated" ] && [ "${ARCOFFLINE}" != "true" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then
if ! curl -skL "https://auxxxilium.tech/check.yml" -o "${TMP_PATH}/check.yml" 2>/dev/null; then
SN=$(generateSerial "${MODEL}" "false")
else
if grep -q "${SN}" "${TMP_PATH}/check.yml"; then
SN=$(generateSerial "${MODEL}" "false")
fi
fi
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
fi
# Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
@@ -691,7 +686,7 @@ function make() {
# Check for Arc Patch
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" == "false" ]; then
if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" = "false" ]; then
deleteConfigKey "addons.amepatch" "${USER_CONFIG_FILE}"
deleteConfigKey "addons.arcdns" "${USER_CONFIG_FILE}"
fi
@@ -709,12 +704,12 @@ function make() {
sleep 2
return 1
fi
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" == "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" = "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
(
livepatch
sleep 3
) 2>&1 | dialog --backtitle "$(backtitlep)" --colors --title "Build Loader" \
--progressbox "Magical things happening..." 20 70
--progressbox "Patching DSM Files..." 20 70
else
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
--infobox "Configuration issue found.\nCould not build Loader!\nExit." 5 40
@@ -749,13 +744,13 @@ function arcFinish() {
if [ -n "${MODELID}" ]; then
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" == "automated" ] || [ "${UPDATEMODE}" == "true" ]; then
if [ "${ARCMODE}" = "automated" ] || [ "${UPDATEMODE}" = "true" ]; then
boot
else
# Ask for Boot
dialog --clear --backtitle "$(backtitle)" --title "Build done"\
--no-cancel --menu "Boot now?" 7 40 0 \
1 "Yes - Boot Arc Loader now" \
1 "Yes - Boot DSM now" \
2 "No - I want to make changes" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
@@ -775,7 +770,7 @@ function juniorboot() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
if [[ "${BUILDDONE}" == "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
if [ $? -eq 0 ]; then
@@ -795,7 +790,7 @@ function boot() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
if [[ "${BUILDDONE}" == "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
if [ $? -eq 0 ]; then
@@ -805,8 +800,7 @@ function boot() {
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM...\nPlease stay patient!" 4 25
sleep 2
clear
exec boot.sh
exec reboot
fi
}
@@ -814,7 +808,7 @@ function boot() {
###############################################################################
# Main loop
# Check for Arc Mode
if [ "${ARCMODE}" == "update" ]; then
if [ "${ARCMODE}" = "update" ]; then
if [ "${ARCOFFLINE}" != "true" ]; then
updateLoader
else
@@ -823,48 +817,48 @@ if [ "${ARCMODE}" == "update" ]; then
sleep 3
exec reboot
fi
elif [ "${ARCMODE}" == "automated" ]; then
elif [ "${ARCMODE}" = "automated" ]; then
# Check for Custom Build
if [ "${BUILDDONE}" == "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
if [ "${BUILDDONE}" = "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
arcModel
else
make
fi
else
[ "${CONFDONE}" == "true" ] && NEXT="2" || NEXT="1"
[ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1"
[ "${CONFDONE}" = "true" ] && NEXT="2" || NEXT="1"
[ "${BUILDDONE}" = "true" ] && NEXT="3" || NEXT="1"
while true; do
echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu"
echo "= \"\Z4===== Main =====\Zn \" " >"${TMP_PATH}/menu"
if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then
echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu"
fi
echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" == "true" ] && [ -n "${IPCON}" ]; then
if [ "${CONFDONE}" = "true" ]; then
echo "2 \"Build Loader \" " >>"${TMP_PATH}/menu"
fi
if [ "${BUILDDONE}" == "true" ]; then
if [ "${BUILDDONE}" = "true" ]; then
echo "3 \"Boot Loader \" " >>"${TMP_PATH}/menu"
fi
echo "= \"\Z4========== Info ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "= \"\Z4===== Info =====\Zn \" " >>"${TMP_PATH}/menu"
echo "a \"Sysinfo \" " >>"${TMP_PATH}/menu"
echo "A \"Networkdiag \" " >>"${TMP_PATH}/menu"
echo "= \"\Z4========== System ========\Zn \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" == "true" ]; then
if [ "${ARCOPTS}" == "true" ]; then
echo "= \"\Z4===== System ====\Zn \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" = "true" ]; then
if [ "${ARCOPTS}" = "true" ]; then
echo "4 \"\Z1Hide Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "4 \"\Z1Show Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${ARCOPTS}" == "true" ]; then
echo "= \"\Z4======== Arc DSM ========\Zn \" " >>"${TMP_PATH}/menu"
if [ "${ARCOPTS}" = "true" ]; then
echo "= \"\Z4==== Arc DSM ====\Zn \" " >>"${TMP_PATH}/menu"
echo "b \"Addons \" " >>"${TMP_PATH}/menu"
echo "d \"Modules \" " >>"${TMP_PATH}/menu"
echo "e \"Version \" " >>"${TMP_PATH}/menu"
echo "p \"SN/Mac Options \" " >>"${TMP_PATH}/menu"
if [ "${DT}" == "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then
if [ "${DT}" = "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then
echo "S \"Sata PortMap \" " >>"${TMP_PATH}/menu"
fi
if [ "${DT}" == "true" ]; then
if [ "${DT}" = "true" ]; then
echo "o \"DTS Map Options \" " >>"${TMP_PATH}/menu"
fi
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
@@ -876,73 +870,73 @@ else
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "sequentialio"; then
echo "Q \"SequentialIO Options \" " >>"${TMP_PATH}/menu"
fi
fi
if [ "${BOOTOPTS}" == "true" ]; then
echo "6 \"\Z1Hide Boot Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "6 \"\Z1Show Boot Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${BOOTOPTS}" == "true" ]; then
echo "= \"\Z4========== Boot =========\Zn \" " >>"${TMP_PATH}/menu"
echo "m \"Boot Kernelload: \Z4${KERNELLOAD}\Zn \" " >>"${TMP_PATH}/menu"
echo "E \"eMMC Boot Support: \Z4${EMMCBOOT}\Zn \" " >>"${TMP_PATH}/menu"
if [ "${DIRECTBOOT}" == "false" ]; then
echo "i \"Boot IP Waittime: \Z4${BOOTIPWAIT}\Zn \" " >>"${TMP_PATH}/menu"
fi
echo "q \"Directboot: \Z4${DIRECTBOOT}\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" == "true" ]; then
echo "7 \"\Z1Hide DSM Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "7 \"\Z1Show DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" == "true" ]; then
echo "= \"\Z4========== DSM ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "j \"Cmdline \" " >>"${TMP_PATH}/menu"
echo "k \"Synoinfo \" " >>"${TMP_PATH}/menu"
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
echo "s \"Allow Downgrade \" " >>"${TMP_PATH}/menu"
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
echo "N \"Add new User\" " >>"${TMP_PATH}/menu"
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
if [ "${PLATFORM}" == "epyc7002" ]; then
if [ "${PLATFORM}" = "epyc7002" ]; then
echo "K \"Kernel: \Z4${KERNEL}\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DT}" == "true" ]; then
if [ "${DT}" = "true" ]; then
echo "H \"Hotplug/SortDrives: \Z4${HDDSORT}\Zn \" " >>"${TMP_PATH}/menu"
else
echo "h \"USB Mount: \Z4${USBMOUNT}\Zn \" " >>"${TMP_PATH}/menu"
fi
fi
if [ "${BOOTOPTS}" = "true" ]; then
echo "6 \"\Z1Hide Boot Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "6 \"\Z1Show Boot Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${BOOTOPTS}" = "true" ]; then
echo "= \"\Z4===== Boot =====\Zn \" " >>"${TMP_PATH}/menu"
echo "m \"Boot Kernelload: \Z4${KERNELLOAD}\Zn \" " >>"${TMP_PATH}/menu"
echo "E \"eMMC Boot Support: \Z4${EMMCBOOT}\Zn \" " >>"${TMP_PATH}/menu"
if [ "${DIRECTBOOT}" = "false" ]; then
echo "i \"Boot IP Waittime: \Z4${BOOTIPWAIT}\Zn \" " >>"${TMP_PATH}/menu"
fi
echo "q \"Directboot: \Z4${DIRECTBOOT}\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" = "true" ]; then
echo "7 \"\Z1Hide DSM Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "7 \"\Z1Show DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" = "true" ]; then
echo "= \"\Z4===== DSM =====\Zn \" " >>"${TMP_PATH}/menu"
echo "j \"Cmdline \" " >>"${TMP_PATH}/menu"
echo "k \"Synoinfo \" " >>"${TMP_PATH}/menu"
echo "N \"Add new User\" " >>"${TMP_PATH}/menu"
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
echo "s \"Allow Downgrade Version \" " >>"${TMP_PATH}/menu"
echo "O \"Official Driver Priority: \Z4${ODP}\Zn \" " >>"${TMP_PATH}/menu"
echo "B \"Grep DSM Config from Backup \" " >>"${TMP_PATH}/menu"
fi
fi
if [ "${LOADEROPTS}" == "true" ]; then
if [ "${LOADEROPTS}" = "true" ]; then
echo "8 \"\Z1Hide Loader Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "8 \"\Z1Show Loader Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${LOADEROPTS}" == "true" ]; then
echo "= \"\Z4========= Loader =========\Zn \" " >>"${TMP_PATH}/menu"
echo "= \"\Z1=== Edit with caution! ===\Zn \" " >>"${TMP_PATH}/menu"
echo "D \"StaticIP for Loader/DSM \" " >>"${TMP_PATH}/menu"
if [ "${LOADEROPTS}" = "true" ]; then
echo "= \"\Z4===== Loader =====\Zn \" " >>"${TMP_PATH}/menu"
echo "c \"Offline Mode: \Z4${ARCOFFLINE}\Zn \" " >>"${TMP_PATH}/menu"
echo "D \"StaticIP for Loader/DSM \" " >>"${TMP_PATH}/menu"
echo "f \"Bootscreen Options \" " >>"${TMP_PATH}/menu"
echo "W \"RD Compression: \Z4${RD_COMPRESSED}\Zn \" " >>"${TMP_PATH}/menu"
echo "X \"Sata DOM: \Z4${SATADOM}\Zn \" " >>"${TMP_PATH}/menu"
echo "u \"LKM Version: \Z4${LKM}\Zn \" " >>"${TMP_PATH}/menu"
echo "L \"Grep Logs from dbgutils \" " >>"${TMP_PATH}/menu"
echo "U \"Change Loader Password \" " >>"${TMP_PATH}/menu"
echo "Z \"Change Loader Ports \" " >>"${TMP_PATH}/menu"
echo "w \"Reset Loader to Defaults \" " >>"${TMP_PATH}/menu"
echo "L \"Grep Logs from dbgutils \" " >>"${TMP_PATH}/menu"
echo "B \"Grep DSM Config from Backup \" " >>"${TMP_PATH}/menu"
echo "= \"\Z1== Edit with caution! ==\Zn \" " >>"${TMP_PATH}/menu"
echo "W \"RD Compression: \Z4${RD_COMPRESSED}\Zn \" " >>"${TMP_PATH}/menu"
echo "X \"Sata DOM: \Z4${SATADOM}\Zn \" " >>"${TMP_PATH}/menu"
echo "u \"LKM Version: \Z4${LKM}\Zn \" " >>"${TMP_PATH}/menu"
echo "C \"Clone Loader to another Disk \" " >>"${TMP_PATH}/menu"
echo "n \"Grub Bootloader Config \" " >>"${TMP_PATH}/menu"
echo "y \"Choose a Keymap for Loader \" " >>"${TMP_PATH}/menu"
echo "F \"\Z1Formate Disks \Zn \" " >>"${TMP_PATH}/menu"
fi
echo "= \"\Z4========== Misc ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "= \"\Z4===== Misc =====\Zn \" " >>"${TMP_PATH}/menu"
echo "x \"Backup/Restore/Recovery \" " >>"${TMP_PATH}/menu"
[ "${ARCOFFLINE}" != "true" ] && echo "z \"Update Menu \" " >>"${TMP_PATH}/menu"
echo "I \"Power/Service Menu \" " >>"${TMP_PATH}/menu"
@@ -963,36 +957,36 @@ else
A) networkdiag; NEXT="A" ;;
# System Section
# Arc Section
4) [ "${ARCOPTS}" == "true" ] && ARCOPTS='false' || ARCOPTS='true'
4) [ "${ARCOPTS}" = "true" ] && ARCOPTS='false' || ARCOPTS='true'
ARCOPTS="${ARCOPTS}"
NEXT="4"
;;
b) addonMenu; NEXT="b" ;;
d) modulesMenu; NEXT="d" ;;
e) ONLYVERSION="true" && arcVersion; NEXT="e" ;;
p) ONLYPATCH="true" && arcPatch; NEXT="p" ;;
p) ONLYPATCH="true" && checkHardwareID && arcPatch; NEXT="p" ;;
S) storageMenu; NEXT="S" ;;
o) dtsMenu; NEXT="o" ;;
g) governorMenu; NEXT="g" ;;
P) storagepanelMenu; NEXT="P" ;;
Q) sequentialIOMenu; NEXT="Q" ;;
# Boot Section
6) [ "${BOOTOPTS}" == "true" ] && BOOTOPTS='false' || BOOTOPTS='true'
6) [ "${BOOTOPTS}" = "true" ] && BOOTOPTS='false' || BOOTOPTS='true'
BOOTOPTS="${BOOTOPTS}"
NEXT="6"
;;
m) [ "${KERNELLOAD}" == "kexec" ] && KERNELLOAD='power' || KERNELLOAD='kexec'
m) [ "${KERNELLOAD}" = "kexec" ] && KERNELLOAD='power' || KERNELLOAD='kexec'
writeConfigKey "kernelload" "${KERNELLOAD}" "${USER_CONFIG_FILE}"
NEXT="m"
;;
E) [ "${EMMCBOOT}" == "true" ] && EMMCBOOT='false' || EMMCBOOT='true'
if [ "${EMMCBOOT}" == "false" ]; then
E) [ "${EMMCBOOT}" = "true" ] && EMMCBOOT='false' || EMMCBOOT='true'
if [ "${EMMCBOOT}" = "false" ]; then
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.disk_swap" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.supportraid" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.support_emmc_boot" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.support_install_only_dev" "${USER_CONFIG_FILE}"
elif [ "${EMMCBOOT}" == "true" ]; then
elif [ "${EMMCBOOT}" = "true" ]; then
writeConfigKey "emmcboot" "true" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo.disk_swap" "no" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo.supportraid" "no" "${USER_CONFIG_FILE}"
@@ -1004,13 +998,13 @@ else
NEXT="E"
;;
i) bootipwaittime; NEXT="i" ;;
q) [ "${DIRECTBOOT}" == "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
q) [ "${DIRECTBOOT}" = "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
grub-editenv ${USER_GRUBENVFILE} create
writeConfigKey "directboot" "${DIRECTBOOT}" "${USER_CONFIG_FILE}"
NEXT="q"
;;
# DSM Section
7) [ "${DSMOPTS}" == "true" ] && DSMOPTS='false' || DSMOPTS='true'
7) [ "${DSMOPTS}" = "true" ] && DSMOPTS='false' || DSMOPTS='true'
DSMOPTS="${DSMOPTS}"
NEXT="7"
;;
@@ -1023,12 +1017,11 @@ else
J) resetDSMNetwork; NEXT="J" ;;
M) mountDSM; NEXT="M" ;;
T) disablescheduledTasks; NEXT="T" ;;
Z) loaderPorts; NEXT="Z" ;;
K) [ "${KERNEL}" == "official" ] && KERNEL='custom' || KERNEL='official'
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
if [ "${ODP}" = "true" ]; then
ODP="false"
writeConfigKey "odp" "${ODP}" "${USER_CONFIG_FILE}"
fi
@@ -1036,7 +1029,7 @@ else
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
if [ -n "${PLATFORM}" ] && [ -n "${KVER}" ]; then
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
@@ -1046,17 +1039,17 @@ else
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="K"
;;
H) [ "${HDDSORT}" == "true" ] && HDDSORT='false' || HDDSORT='true'
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) if [ "${USBMOUNT}" == "auto" ]; then
h) if [ "${USBMOUNT}" = "auto" ]; then
USBMOUNT='internal'
elif [ "${USBMOUNT}" == "internal" ]; then
elif [ "${USBMOUNT}" = "internal" ]; then
USBMOUNT='external'
elif [ "${USBMOUNT}" == "external" ]; then
elif [ "${USBMOUNT}" = "external" ]; then
USBMOUNT='auto'
fi
writeConfigKey "usbmount" "${USBMOUNT}" "${USER_CONFIG_FILE}"
@@ -1064,7 +1057,7 @@ else
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="h"
;;
O) [ "${ODP}" == "false" ] && ODP='true' || ODP='false'
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}")"
@@ -1072,32 +1065,33 @@ else
;;
B) getbackup; NEXT="B" ;;
# Loader Section
8) [ "${LOADEROPTS}" == "true" ] && LOADEROPTS='false' || LOADEROPTS='true'
8) [ "${LOADEROPTS}" = "true" ] && LOADEROPTS='false' || LOADEROPTS='true'
LOADEROPTS="${LOADEROPTS}"
NEXT="8"
;;
D) staticIPMenu; NEXT="D" ;;
c) [ "${ARCOFFLINE}" == "true" ] && ARCOFFLINE='false' || ARCOFFLINE='true'
c) ARCOFFLINE=$([ "${ARCOFFLINE}" = "true" ] && echo 'false' || echo 'true')
writeConfigKey "arc.offline" "${ARCOFFLINE}" "${USER_CONFIG_FILE}"
[ "${ARCOFFLINE}" == "false" ] && exec arc.sh
[ "${ARCOFFLINE}" = "false" ] && exec arc.sh
NEXT="c"
;;
D) staticIPMenu; NEXT="D" ;;
f) bootScreen; NEXT="f" ;;
W) [ "${RD_COMPRESSED}" == "true" ] && RD_COMPRESSED='false' || RD_COMPRESSED='true'
Z) loaderPorts; NEXT="Z" ;;
U) loaderPassword; NEXT="U" ;;
W) RD_COMPRESSED=$([ "${RD_COMPRESSED}" = "true" ] && echo 'false' || echo 'true')
writeConfigKey "rd-compressed" "${RD_COMPRESSED}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="W"
;;
X) satadomMenu; NEXT="X" ;;
u) [ "${LKM}" == "prod" ] && LKM='dev' || LKM='prod'
u) [ "${LKM}" = "prod" ] && LKM='dev' || LKM='prod'
writeConfigKey "lkm" "${LKM}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="u"
;;
L) greplogs; NEXT="L" ;;
U) loaderPassword; NEXT="U" ;;
w) resetLoader; NEXT="w" ;;
C) cloneLoader; NEXT="C" ;;
n) editGrubCfg; NEXT="n" ;;

View File

@@ -3,20 +3,20 @@
set -e
[[ -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}/include/functions.sh"
# 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!"
[ "${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}")
# Check if machine has EFI
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
FBI=$(cat /sys/class/graphics/fb*/name 2>/dev/null | head -1)
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
# Print Title centralized
clear
@@ -59,7 +59,7 @@ DSMINFO="$(readConfigKey "boot.dsminfo" "${USER_CONFIG_FILE}")"
SYSTEMINFO="$(readConfigKey "boot.systeminfo" "${USER_CONFIG_FILE}")"
DISKINFO="$(readConfigKey "boot.diskinfo" "${USER_CONFIG_FILE}")"
if [ "${DSMINFO}" == "true" ]; then
if [ "${DSMINFO}" = "true" ]; then
echo -e "\033[1;37mDSM:\033[0m"
echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m"
echo -e "Platform: \033[1;37m${PLATFORM}\033[0m"
@@ -67,14 +67,14 @@ if [ "${DSMINFO}" == "true" ]; then
echo -e "LKM: \033[1;37m${LKM}\033[0m"
echo
fi
if [ "${SYSTEMINFO}" == "true" ]; then
if [ "${SYSTEMINFO}" = "true" ]; then
echo -e "\033[1;37mSystem:\033[0m"
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
fi
if [ "${DISKINFO}" == "true" ]; then
if [ "${DISKINFO}" = "true" ]; then
echo -e "\033[1;37mDisks:\033[0m"
echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m"
fi
@@ -82,7 +82,7 @@ fi
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
HASATA=0
for D in $(lsblk -dpno NAME); do
[ "${D}" == "${LOADER_DISK}" ] && continue
[ "${D}" = "${LOADER_DISK}" ] && continue
if echo "sata sas scsi" | grep -qw "$(getBus "${D}")"; then
HASATA=1
break
@@ -102,26 +102,40 @@ 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:-${MODEL}}"
CMDLINE['vid']="${VID:-"0x46f4"}" # Sanity check
CMDLINE['pid']="${PID:-"0x0001"}" # Sanity check
CMDLINE['sn']="${SN}"
CMDLINE["syno_hw_version"]="${MODELID:-${MODEL}}"
CMDLINE["vid"]="${VID:-"0x46f4"}" # Sanity check
CMDLINE["pid"]="${PID:-"0x0001"}" # Sanity check
CMDLINE["sn"]="${SN}"
# Boot Cmdline
if grep -q "force_junior" /proc/cmdline; then
CMDLINE['force_junior']=""
CMDLINE["force_junior"]=""
fi
if grep -q "recovery" /proc/cmdline; then
CMDLINE['force_junior']=""
CMDLINE['recovery']=""
CMDLINE["force_junior"]=""
CMDLINE["recovery"]=""
fi
if [ ${EFI} -eq 1 ]; then
CMDLINE['withefi']=""
CMDLINE["withefi"]=""
else
CMDLINE['noefi']=""
CMDLINE["noefi"]=""
fi
# DSM Cmdline
@@ -132,14 +146,14 @@ 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
if [ "${DT}" = "true" ]; then
CMDLINE["syno_ttyS0"]="serial,0x3f8"
CMDLINE["syno_ttyS1"]="serial,0x2f8"
else
@@ -149,32 +163,37 @@ else
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['rootwait']=""
CMDLINE['loglevel']="15"
CMDLINE['log_buf_len']="32M"
CMDLINE['panic']="${KERNELPANIC:-0}"
CMDLINE['pcie_aspm']="off"
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
#[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable"
CMDLINE["root"]="/dev/md0"
CMDLINE["loglevel"]="15"
CMDLINE["log_buf_len"]="32M"
CMDLINE["rootwait"]=""
CMDLINE["panic"]="${KERNELPANIC:-0}"
# DSM Specific Cmdline
CMDLINE["pcie_aspm"]="off"
CMDLINE["modprobe.blacklist"]="${MODBLACKLIST}"
[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="passive"
[ $(cat /proc/cpuinfo | grep AMD | wc -l) -gt 0 ] && CMDLINE["amd_pstate"]="passive"
# CMDLINE["nomodeset"]=""
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
CMDLINE["nox2apic"]=""
fi
#if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ "${BUS}" != "mmc" ] && [ "${EMMCBOOT}" != "true" ]; then
# if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "sdhci"; then
# [ ! "${CMDLINE['modprobe.blacklist']}" == "" ] && CMDLINE['modprobe.blacklist']+=","
# CMDLINE['modprobe.blacklist']+="sdhci,sdhci_pci,sdhci_acpi"
# if ! echo "${CMDLINE["modprobe.blacklist"]}" | grep -q "sdhci"; then
# [ ! "${CMDLINE["modprobe.blacklist"]}" = "" ] && CMDLINE["modprobe.blacklist"]+=","
# CMDLINE["modprobe.blacklist"]+="sdhci,sdhci_pci,sdhci_acpi"
# fi
# fi
if [ "${DT}" == "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
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
fi
# CMDLINE['kvm.ignore_msrs']="1"
@@ -186,20 +205,19 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
CMDLINE["SASmodel"]="1"
fi
# Cmdline NIC Settings
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
ETHM="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
ETHN="$(echo ${ETHX} | wc -w)"
# 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 ETH in ${ETHX}; do
MAC="$(readConfigKey "${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | tr '[:lower:]' '[:upper:]')"
NIC=$((${NIC} + 1))
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}"
CMDLINE["netif_num"]="${NIC}"
# Read user network settings
while IFS=': ' read -r KEY VALUE; do
@@ -213,7 +231,7 @@ done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
# Prepare command line
CMDLINE_LINE=""
for KEY in ${!CMDLINE[@]}; do
for KEY in "${!CMDLINE[@]}"; do
VALUE="${CMDLINE[${KEY}]}"
CMDLINE_LINE+=" ${KEY}"
[ -n "${VALUE}" ] && CMDLINE_LINE+="=${VALUE}"
@@ -221,46 +239,24 @@ done
CMDLINE_LINE=$(echo "${CMDLINE_LINE}" | sed 's/^ //') # Remove leading space
echo "${CMDLINE_LINE}" >"${PART1_PATH}/cmdline.yml"
function _bootwait() {
# Exec Bootwait to check SSH/Web connection
BOOTWAIT=5
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB
MSG=""
while test ${BOOTWAIT} -ge 0; do
MSG="\033[1;33mAccess SSH/Web will interrupt boot...\033[0m"
echo -en "\r${MSG}"
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WC
if ! diff WB WC >/dev/null 2>&1; then
echo -en "\r\033[1;33mAccess SSH/Web detected and boot is interrupted.\033[0m\n"
rm -f WB WC
exit 0
fi
sleep 1
BOOTWAIT=$((BOOTWAIT - 1))
done
rm -f WB WC
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
return 0
}
# Boot
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
if [ "${DIRECTBOOT}" == "true" ]; then
if [ "${DIRECTBOOT}" = "true" ]; then
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}"
grub-editenv ${USER_GRUBENVFILE} set next_entry="direct"
_bootwait || true
echo -e "\033[1;34mReboot with Directboot\033[0m"
exec reboot
reboot
exit 0
elif [ "${DIRECTBOOT}" == "false" ]; then
elif [ "${DIRECTBOOT}" = "false" ]; then
grub-editenv ${USER_GRUBENVFILE} unset dsm_cmdline
grub-editenv ${USER_GRUBENVFILE} unset next_entry
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
IPCON=""
if [ "${ARCPATCH}" == "true" ]; then
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"
@@ -268,18 +264,18 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
for ETH in ${ETHX}; do
for N in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
while true; do
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
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 ${ETH})"
COUNT=$((COUNT + 1))
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
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
@@ -288,7 +284,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
fi
break
fi
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
break
fi
@@ -302,19 +298,28 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
_bootwait || true
DSMLOGO="$(readConfigKey "boot.dsmlogo" "${USER_CONFIG_FILE}")"
if [ "${DSMLOGO}" == "true" ] && [ -c "/dev/fb0" ]; then
if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ]; then
[[ "${IPCON}" =~ ^169\.254\..* ]] && IPCON=""
[ -n "${IPCON}" ] && URL="http://${IPCON}:5000" || URL="http://find.synology.com/"
python ${ARC_PATH}/include/functions.py makeqr -d "${URL}" -l "6" -o "${TMP_PATH}/qrcode_boot.png"
python3 ${ARC_PATH}/include/functions.py makeqr -d "${URL}" -l "6" -o "${TMP_PATH}/qrcode_boot.png"
[ -f "${TMP_PATH}/qrcode_boot.png" ] && echo | fbv -acufi "${TMP_PATH}/qrcode_boot.png" >/dev/null 2>/dev/null || true
fi
for T in $(w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
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.\033[0m\n" >"/dev/${T}" 2>/dev/null || echo -e "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.\nNo IP found.\033[0m\n" >"/dev/${T}" 2>/dev/null
fi
done
# # Unload all network interfaces
# for D in $(realpath /sys/class/net/*/device/driver); do rmmod -f "$(basename ${D})" 2>/dev/null || true; done
# Unload all graphics drivers
# for D in $(lsmod | grep -E '^(nouveau|amdgpu|radeon|i915)' | awk '{print $1}'); do rmmod -f "${D}" 2>/dev/null || true; done
# for I in $(find /sys/devices -name uevent -exec bash -c 'cat {} 2>/dev/null | grep -Eq "PCI_CLASS=0?30[0|1|2]00" && dirname {}' \;); do
# [ -e ${I}/reset ] && cat ${I}/vendor >/dev/null | grep -iq 0x10de && echo 1 >${I}/reset || true # Proc open nvidia driver when booting
# done
echo -e "\033[1;37mLoading DSM Kernel...\033[0m"
# Executes DSM kernel via KEXEC
KEXECARGS="-a"
@@ -326,7 +331,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
echo -e "\033[1;37mBooting DSM...\033[0m"
# Boot to DSM
[ "${KERNELLOAD}" == "kexec" ] && kexec -e || poweroff
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff
fi
exit 0

View File

@@ -1,16 +1,16 @@
#!/usr/bin/env bash
read_u8() {
dd if=$1 bs=1 skip=$(($2)) count=1 2>/dev/null | od -An -tu1 | grep -Eo '[0-9]+'
dd if="${1}" bs=1 skip="$((${2}))" count=1 2>/dev/null | od -An -tu1 | grep -Eo '[0-9]+'
}
read_u32() {
dd if=$1 bs=1 skip=$(($2)) count=4 2>/dev/null | od -An -tu4 | grep -Eo '[0-9]+'
dd if="${1}" bs=1 skip="$((${2}))" count=4 2>/dev/null | od -An -tu4 | grep -Eo '[0-9]+'
}
set -x
setup_size=$(read_u8 $1 0x1f1)
payload_offset=$(read_u32 $1 0x248)
payload_length=$(read_u32 $1 0x24c)
inner_pos=$((($setup_size + 1) * 512))
setup_size=$(read_u8 "${1}" 0x1f1)
payload_offset=$(read_u32 "${1}" 0x248)
payload_length=$(read_u32 "${1}" 0x24c)
inner_pos=$(((setup_size + 1) * 512))
tail -c+$(($inner_pos + 1)) $1 | tail -c+$(($payload_offset + 1)) | head -c $(($payload_length)) | head -c $(($payload_length - 4)) | unlzma >$2
tail -c+$(($inner_pos + 1)) "${1}" | tail -c+$(($payload_offset + 1)) | head -c "${payload_length}" | head -c $(($payload_length - 4)) | unlzma >"${2}"

View File

@@ -1,42 +0,0 @@
#!/usr/bin/env bash
#
# Calculate the amount of space needed to run the kernel, including room for
# the .bss and .brk sections.
#
# Usage:
# objdump -h a.out | sh calc_run_size.sh
NUM='\([0-9a-fA-F]*[ \t]*\)'
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/\1\4/p')
if [ -z "$OUT" ]; then
echo "Never found .bss or .brk file offset" >&2
exit 1
fi
OUT=$(echo ${OUT# })
sizeA=$(printf "%d" 0x${OUT%% *})
OUT=${OUT#* }
offsetA=$(printf "%d" 0x${OUT%% *})
OUT=${OUT#* }
sizeB=$(printf "%d" 0x${OUT%% *})
OUT=${OUT#* }
offsetB=$(printf "%d" 0x${OUT%% *})
run_size=$((${offsetA} + ${sizeA} + ${sizeB}))
# BFD linker shows the same file offset in ELF.
if [ "${offsetA}" -ne "${offsetB}" ]; then
# Gold linker shows them as consecutive.
endB=$((${offsetB} + ${sizeB}))
if [ "$endB" != "$run_size" ]; then
printf "sizeA: 0x%x\n" ${sizeA} >&2
printf "offsetA: 0x%x\n" ${offsetA} >&2
printf "sizeB: 0x%x\n" ${sizeB} >&2
printf "offsetB: 0x%x\n" ${offsetB} >&2
echo ".bss and .brk are non-contiguous" >&2
exit 1
fi
fi
printf "%d\n" ${run_size}
exit 0

View File

@@ -10,38 +10,34 @@
#
# ----------------------------------------------------------------------
check_vmlinux()
{
# Use readelf to check if it's a valid ELF
# TODO: find a better to way to check that it's really vmlinux
# and not just an elf
readelf -h $1 > /dev/null 2>&1 || return 1
check_vmlinux() {
# Use readelf to check if it's a valid ELF
# TODO: find a better to way to check that it's really vmlinux
# and not just an elf
readelf -h $1 >/dev/null 2>&1 || return 1
cat $1
exit 0
cat $1
exit 0
}
try_decompress()
{
# The obscure use of the "tr" filter is to work around older versions of
# "grep" that report the byte offset of the line instead of the pattern.
try_decompress() {
# The obscure use of the "tr" filter is to work around older versions of
# "grep" that report the byte offset of the line instead of the pattern.
# Try to find the header ($1) and decompress from here
for pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
do
pos=${pos%%:*}
tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
check_vmlinux $tmp
done
# Try to find the header ($1) and decompress from here
for pos in $(tr "$1\n$2" "\n$2=" <"$img" | grep -abo "^$2"); do
pos=${pos%%:*}
tail -c+$pos "$img" | $3 >$tmp 2>/dev/null
check_vmlinux $tmp
done
}
# Check invocation:
me=${0##*/}
img=$1
if [ $# -ne 1 -o ! -s "$img" ]
then
echo "Usage: $me <kernel-image>" >&2
exit 2
if [ $# -ne 1 ] || [ ! -s "$img" ]; then
echo "Usage: $me <kernel-image>" >&2
exit 2
fi
# Prepare temp files:
@@ -61,4 +57,4 @@ try_decompress '(\265/\375' xxx unzstd
check_vmlinux $img
# Bail out:
echo "$me: Cannot find vmlinux." >&2
echo "$me: Cannot find vmlinux." >&2

Binary file not shown.

View File

@@ -15,19 +15,24 @@ function availableAddons() {
[ "${AVAILABLE}" = false ] && continue
local SYSTEM=$(readConfigKey "system" "${D}/manifest.yml")
[ "${SYSTEM}" = true ] && continue
if [[ "${ARCOFFLINE}" == "true" || -z "${ARCCONF}" ]] && [[ "${ADDON}" == "amepatch" || "${ADDON}" == "arcdns" ]]; then
if [[ "${ARCOFFLINE}" = "true" || -z "${ARCCONF}" ]] && [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]]; then
continue
fi
if [ "${MACHINE}" != "Native" ] && [ "${ADDON}" == "cpufreqscaling" ]; then
if [ "${MACHINE}" != "Native" ] && [ "${ADDON}" = "cpufreqscaling" ]; then
continue
fi
if echo "${PAT_URL}" 2>/dev/null | grep -vq "7.2.2"; then
if [ "${ADDON}" = "allowdowngrade" ]; then
continue
fi
fi
local DESC="$(readConfigKey "description" "${D}/manifest.yml")"
local BETA="$(readConfigKey "beta" "${D}/manifest.yml")"
local TARGET="$(readConfigKey "target" "${D}/manifest.yml")"
[ "${BETA}" = true ] && BETA="(Beta) " || BETA=""
if [ "${TARGET}" == "app" ]; then
if [ "${TARGET}" = "app" ]; then
[ "${AVAILABLE}" = true ] && echo -e "${ADDON}\t\Z4${BETA}${DESC}\Zn"
elif [ "${TARGET}" == "system" ]; then
elif [ "${TARGET}" = "system" ]; then
[ "${AVAILABLE}" = true ] && echo -e "${ADDON}\t\Z1${BETA}${DESC}\Zn"
else
[ "${AVAILABLE}" = true ] && echo -e "${ADDON}\t${BETA}${DESC}"

View File

@@ -23,7 +23,7 @@ function writeConfigKey() {
# Return Value
function readConfigKey() {
RESULT=$(yq eval '.'${1}' | explode(.)' "${2}" 2>/dev/null)
[ "${RESULT}" == "null" ] && echo "" || echo "${RESULT}"
[ "${RESULT}" = "null" ] && echo "" || echo "${RESULT}"
}
###############################################################################

View File

@@ -1,15 +1,15 @@
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" 2>/dev/null && pwd)"
. ${ARC_PATH}/include/consts.sh
. ${ARC_PATH}/include/configFile.sh
. ${ARC_PATH}/include/addons.sh
. "${ARC_PATH}/include/consts.sh"
. "${ARC_PATH}/include/configFile.sh"
. "${ARC_PATH}/include/addons.sh"
###############################################################################
# Check loader disk
function checkBootLoader() {
while read KNAME RO; do
[ -z "${KNAME}" ] && continue
[ "${RO}" == "0" ] && continue
[ "${RO}" = "0" ] && continue
hdparm -r0 "${KNAME}" >/dev/null 2>&1 || true
done <<<$(lsblk -pno KNAME,RO 2>/dev/null)
[ ! -w "${PART1_PATH}" ] && return 1
@@ -49,7 +49,7 @@ function arrayExistItem() {
ITEM="${1}"
shift
for i in "$@"; do
[ "${i}" == "${ITEM}" ] || continue
[ "${i}" = "${ITEM}" ] || continue
EXISTS=0
break
done
@@ -92,7 +92,7 @@ function genRandomValue() {
function generateSerial() {
PREFIX="$(readConfigArray "${1}.prefix" "${S_FILE}" 2>/dev/null | sort -R | tail -1)"
MIDDLE="$(readConfigArray "${1}.middle" "${S_FILE}" 2>/dev/null | sort -R | tail -1)"
if [ "${2}" == "true" ]; then
if [ "${2}" = "true" ]; then
SUFFIX="arc"
else
SUFFIX="$(readConfigKey "${1}.suffix" "${S_FILE}" 2>/dev/null)"
@@ -124,7 +124,7 @@ function generateSerial() {
# Returns serial number
function generateMacAddress() {
MACPRE="$(readConfigKey "${1}.macpre" "${S_FILE}")"
if [ "${3}" == "true" ]; then
if [ "${3}" = "true" ]; then
MACSUF="$(readConfigKey "${1}.mac" "${S_FILE}" 2>/dev/null)"
else
MACSUF="$(printf '%02x%02x%02x' $((${RANDOM} % 256)) $((${RANDOM} % 256)) $((${RANDOM} % 256)))"
@@ -136,7 +136,7 @@ function generateMacAddress() {
[ ${I} -lt ${NUM} ] && MACS+=" "
done
MACS="$(echo "${MACS}" | tr '[:lower:]' '[:upper:]')"
MACS="$(echo "${MACS}" | tr '[:upper:]' '[:lower:]')"
echo "${MACS}"
return 0
}
@@ -188,7 +188,7 @@ function arrayExistItem() {
ITEM="${1}"
shift
for i in "$@"; do
[ "${i}" == "${ITEM}" ] || continue
[ "${i}" = "${ITEM}" ] || continue
EXISTS=0
break
done
@@ -229,18 +229,17 @@ function _set_conf_kv() {
# sort netif busid
function _sort_netif() {
local ETHLIST=""
local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
for ETH in ${ETHX}; do
local MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
local BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
local ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
for N in ${ETHX}; do
local MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
local BUS="$(ethtool -i ${N} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${N}\n"
done
local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)"
local ETHLIST="$(echo -e "${ETHLISTTMPB}" | grep -v '^$')"
local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')"
local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)"
# echo "${ETHSEQ}" >"/tmp/ethseq"
# sort
if [ ! "${ETHSEQ}" = "$(seq 0 $((${ETHNUM:0} - 1)))" ]; then
/etc/init.d/S41dhcpcd stop >/dev/null 2>&1
@@ -278,7 +277,7 @@ function getBus() {
# 1 - ethN
function getIP() {
local IP=""
MACR="$(cat /sys/class/net/${1}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
MACR="$(cat /sys/class/net/${1}/address 2>/dev/null | sed 's/://g')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ]; then
IFS='/' read -r -a IPRA <<<"${IPR}"
@@ -383,7 +382,7 @@ function rebootTo() {
local MODES="config recovery junior automated update bios memtest"
[ -z "${1}" ] && exit 1
if ! echo "${MODES}" | grep -qw "${1}"; then exit 1; fi
[ "${1}" == "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated"
[ "${1}" = "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated"
[ ! -f "${USER_GRUBENVFILE}" ] && grub-editenv ${USER_GRUBENVFILE} create
# echo -e "Rebooting to ${1} mode..."
grub-editenv ${USER_GRUBENVFILE} set next_entry="${1}"
@@ -438,7 +437,7 @@ function extractDSMFiles() {
echo -e "Could not determine if pat file is encrypted or not, maybe corrupted, try again!"
;;
esac
if [ "${isencrypted}" == "yes" ]; then
if [ "${isencrypted}" = "yes" ]; then
# Uses the extractor to untar PAT file
LD_LIBRARY_PATH="${EXTRACTOR_PATH}" "${EXTRACTOR_PATH}/${EXTRACTOR_BIN}" "${PAT_PATH}" "${EXT_PATH}" >"${LOG_FILE}" 2>&1
else
@@ -466,7 +465,7 @@ function livepatch() {
echo -e " - failed!"
PVALID="false"
fi
if [ "${PVALID}" == "true" ]; then
if [ "${PVALID}" = "true" ]; then
# Patch Ramdisk
echo -n "Patching Ramdisk"
if ${ARC_PATH}/ramdisk-patch.sh; then
@@ -477,12 +476,12 @@ function livepatch() {
PVALID="false"
fi
fi
if [ "${PVALID}" == "false" ]; then
if [ "${PVALID}" = "false" ]; then
echo
echo -e "Patching DSM Files failed! Please stay patient for Update."
sleep 5
exit 1
elif [ "${PVALID}" == "true" ]; then
elif [ "${PVALID}" = "true" ]; then
ZIMAGE_HASH="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')"
writeConfigKey "zimage-hash" "${ZIMAGE_HASH}" "${USER_CONFIG_FILE}"
RAMDISK_HASH="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')"
@@ -494,32 +493,38 @@ function livepatch() {
###############################################################################
# Check NTP and Keyboard Layout
function onlineCheck() {
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
REGION="$(curl -m 10 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f1)"
TIMEZONE="$(curl -m 10 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f2)"
[ -z "${KEYMAP}" ] && KEYMAP="$(curl -m 10 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
KEYMAP="$(curl -m 10 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
if [ "${KEYMAP}" = "ua" ]; then
rm -rf "${PART3_PATH}" && exec poweroff
fi
[ -z "${KEYMAP}" ] && KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
if [ -n "${REGION}" ] && [ -n "${TIMEZONE}" ]; then
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
[ $(echo "${ARC_VERSION}" | grep "dev" | wc -l) -eq 0 ] && NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
[ $(echo "${ARC_VERSION}" | grep "dev" | wc -l) -gt 0 ] && NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
writeConfigKey "time.region" "${REGION}" "${USER_CONFIG_FILE}"
writeConfigKey "time.timezone" "${TIMEZONE}" "${USER_CONFIG_FILE}"
updateOffline
else
REGION="$(readConfigKey "time.region" "${USER_CONFIG_FILE}")"
TIMEZONE="$(readConfigKey "time.timezone" "${USER_CONFIG_FILE}")"
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
fi
[ -n "${TIMEZONE}" ] && [ -n "${REGION}" ] && ln -sf "/usr/share/zoneinfo/${REGION}/${TIMEZONE}" /etc/localtime
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
if [ -z "${LAYOUT}" ]; then
[ -n "${KEYMAP}" ] && KEYMAP="$(echo ${KEYMAP} | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]' | tr -d '[:punct:]' | tr -d '[:digit:]')"
[ -n "${KEYMAP}" ] && writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
[ -z "${KEYMAP}" ] && KEYMAP="us"
loadkeys ${KEYMAP}
if loadkeys "${KEYMAP:-us}" 2>/dev/null; then
writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
else
KEYMAP="us"
loadkeys "${KEYMAP}" 2>/dev/null
writeConfigKey "keymap" "${KEYMAP}" "${USER_CONFIG_FILE}"
fi
fi
if [ "${KEYMAP}" == "ua" ]; then
poweroff
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
if [ -n "${NEWTAG}" ]; then
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
updateOffline
else
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
fi
}
@@ -552,7 +557,7 @@ function systemCheck () {
fi
# Check for CPU Frequency Scaling
CPUFREQUENCIES=$(ls -ltr /sys/devices/system/cpu/cpufreq/* 2>/dev/null | wc -l)
if [ ${CPUFREQUENCIES} -gt 1 ] && [ "${ACPISYS}" == "true" ]; then
if [ ${CPUFREQUENCIES} -gt 1 ] && [ "${ACPISYS}" = "true" ]; then
CPUFREQ="true"
else
CPUFREQ="false"
@@ -565,6 +570,68 @@ function systemCheck () {
###############################################################################
# Generate HardwareID
function genHWID () {
HWID="$(echo $(dmidecode -t 4 | grep ID | sed 's/.*ID://;s/ //g' | head -1) $(ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g') | sha256sum | awk '{print $1}' | cut -c1-16)" 2>/dev/null
HWID="$(echo $(dmidecode -t 4 | grep ID | sed 's/.*ID://;s/ //g' | head -1) $(ifconfig | grep eth | awk '{print $NF}' | sed 's/://g' | sort | head -1) | sha256sum | awk '{print $1}' | cut -c1-16)" 2>/dev/null
echo "${HWID}"
}
###############################################################################
# Check if port is valid
function check_port() {
if [ -z "${1}" ]; then
return 0
else
if [[ "${1}" =~ ^[0-9]+$ ]] && [ "${1}" -ge 0 ] && [ "${1}" -le 65535 ]; then
return 0
else
return 1
fi
fi
}
###############################################################################
# Unmount disks
function __umountNewBlDisk() {
umount "${TMP_PATH}/sdX1" 2>/dev/null
umount "${TMP_PATH}/sdX2" 2>/dev/null
umount "${TMP_PATH}/sdX3" 2>/dev/null
}
function __umountDSMRootDisk() {
umount "${TMP_PATH}/mdX"
rm -rf "${TMP_PATH}/mdX"
}
###############################################################################
# bootwait SSH/Web
function _bootwait() {
# Exec Bootwait to check SSH/Web connection
BOOTWAIT=5
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB
MSG=""
while test ${BOOTWAIT} -ge 0; do
MSG="\033[1;33mAccess to SSH/Web will interrupt boot...\033[0m"
echo -en "\r${MSG}"
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WC
if ! diff WB WC >/dev/null 2>&1; then
echo -en "\r\033[1;33mAccess to SSH/Web detected and boot is interrupted.\033[0m\n"
rm -f WB WC
exit 0
fi
sleep 1
BOOTWAIT=$((BOOTWAIT - 1))
done
rm -f WB WC
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
return 0
}
###############################################################################
# check and fix the DSM root partition
# 1 - DSM root path
function fixDSMRootPart() {
if mdadm --detail "${1}" 2>/dev/null | grep -i "State" | grep -iEq "active|FAILED|Not Started"; then
mdadm --stop "${1}" >/dev/null 2>&1
mdadm --assemble --scan >/dev/null 2>&1
fsck "${1}" >/dev/null 2>&1
fi
}

View File

@@ -14,7 +14,7 @@ function getAllModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
@@ -49,7 +49,7 @@ function installModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}"
@@ -61,7 +61,7 @@ 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})
[ "${ODP}" == "true" -a -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue
[ "${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}"
else
@@ -69,7 +69,7 @@ function installModules() {
fi
done
mkdir -p "${RAMDISK_PATH}/usr/lib/firmware"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
else
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
@@ -101,13 +101,13 @@ function addToModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
fi
cp -f ${KOFILE} ${TMP_PATH}/modules
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
else
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
@@ -132,13 +132,13 @@ function delToModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
fi
rm -f ${TMP_PATH}/modules/${KONAME}
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
else
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
@@ -174,7 +174,7 @@ function getdepends() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"

View File

@@ -1,38 +1,37 @@
# Get Network Config for Loader
function getnet() {
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
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)"
if [ "${ARCPATCH}" == "true" ]; then
ETHN="$(echo ${ETHX} | wc -w)"
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
ETHN="$(echo ${ETHX} | wc -w)"
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
elif [ "${ARCPATCH}" = "user" ]; then
# User Mac
for ETH in ${ETHX}; do
for N in ${ETHX}; do
while true; do
MAC="$(cat /sys/class/net/${ETH}/address | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
--inputbox "Type a custom MAC for ${ETH} (Eq. 001132abc123)." 7 50 "${MAC}"\
--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 "${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
MAC="$(echo "${MAC}" | tr '[:lower:]' '[:upper:]')"
[ -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
writeConfigKey "${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
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
@@ -43,9 +42,9 @@ function getnet() {
}
# Get Amount of NIC
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
# Get actual IP
for ETH in ${ETHX}; do
IPCON=$(getIP ${ETH})
for N in ${ETHX}; do
IPCON="$(getIP "${N}")"
[ -n "${IPCON}" ] && break
done

View File

@@ -2,53 +2,51 @@
function getmap() {
# Sata Disks
SATADRIVES=0
# 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 | 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
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" || true
[ -f "${TMP_PATH}/drivescon" ] && rm -f "${TMP_PATH}/drivescon" && touch "${TMP_PATH}/drivescon" || true
[ -f "${TMP_PATH}/ports" ] && rm -f "${TMP_PATH}/ports" && touch "${TMP_PATH}/ports" || true
[ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap" && touch "${TMP_PATH}/remap" || true
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 | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::107 | awk '{print $1}'); do
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)
@@ -57,8 +55,8 @@ function getmap() {
fi
# SCSI Disks
SCSIDRIVES=0
if [ $(lspci -d ::100 | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::100 | awk '{print $1}'); do
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)
@@ -67,8 +65,8 @@ function getmap() {
fi
# Raid Disks
RAIDDRIVES=0
if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::104 | awk '{print $1}'); do
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)
@@ -77,8 +75,8 @@ function getmap() {
fi
# USB Disks
USBDRIVES=0
if [[ -d "/sys/class/scsi_host" && $(ls -l /sys/class/scsi_host | grep usb | wc -l) -gt 0 ]]; then
for PCI in $(lspci -d ::c03 | awk '{print $1}'); do
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)
@@ -88,9 +86,9 @@ function getmap() {
fi
# MMC Disks
MMCDRIVES=0
if [[ -d "/sys/class/mmc_host" && $(ls -l /sys/class/mmc_host | grep mmc_host | wc -l) -gt 0 ]]; then
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}" | sed "s/\ .*://")
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}))
@@ -98,8 +96,8 @@ function getmap() {
fi
# NVMe Disks
NVMEDRIVES=0
if [ $(lspci -d ::108 | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::108 | awk '{print $1}'); do
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)
@@ -119,16 +117,16 @@ function getmap() {
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
# Check for Sata Boot
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
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
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
elif [ ${D} = ${LASTDRIVE} ]; then
LASTDRIVE=$((${D} + 1))
fi
done < <(cat "${TMP_PATH}/ports")
@@ -142,17 +140,17 @@ function getmapSelection() {
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
if [ "${ARCMODE}" = "config" ]; then
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "true" ] && [ "${MACHINE}" == "Native" ]; then
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
REMAP2="*"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
REMAP3="*"
else
REMAP1="*"
fi
# Ask for Portmap
if [ "${STEP}" == "storagemap" ]; then
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}" \
@@ -190,9 +188,9 @@ function getmapSelection() {
fi
else
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "true" ] && [ "${MACHINE}" == "Native" ]; then
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
@@ -201,27 +199,27 @@ function getmapSelection() {
# 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
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
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
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
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
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
@@ -230,22 +228,22 @@ function getmapSelection() {
}
# Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
SATACONTROLLER=$(lspci -d ::106 | wc -l)
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 | wc -l)
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 | wc -l)
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 | wc -l)
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}"

View File

@@ -10,7 +10,7 @@ function updateLoader() {
if [ -z "${TAG}" ]; then
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
if [ "${ARC_BRANCH}" == "dev" ]; then
if [ "${ARC_BRANCH}" = "dev" ]; then
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
else
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
@@ -26,30 +26,37 @@ function updateLoader() {
export URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/update.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/update.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--gauge "Download Loader: $TAG ..." 14 72
}
}' 4>&- |
dialog --gauge "Download Update: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/update.zip" ] && [ $(ls -s "${TMP_PATH}/update.zip" | cut -d' ' -f1) -gt 300000 ]; then
mkdir -p "${TMP_PATH}/update"
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--infobox "Updating Loader..." 3 50
if unzip -oq "${TMP_PATH}/update.zip" -d "/mnt"; then
if unzip -oq "${TMP_PATH}/update.zip" -d "${TMP_PATH}/update"; then
cp -rf "${TMP_PATH}/update"/* "/mnt"
rm -rf "${TMP_PATH}/update"
rm -f "${TMP_PATH}/update.zip"
fi
if [ "$(cat "${PART1_PATH}/ARC-VERSION")" = "${TAG}" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--infobox "Update successful!" 3 50
--infobox "Update Loader successful!" 3 50
sleep 2
else
if [ "${ARCMODE}" == "update" ]; then
if [ "${ARCMODE}" = "update" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
sleep 3
@@ -59,7 +66,7 @@ function updateLoader() {
fi
fi
else
if [ "${ARCMODE}" == "update" ]; then
if [ "${ARCMODE}" = "update" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
sleep 3
@@ -70,18 +77,18 @@ function updateLoader() {
fi
fi
[ -n "${ARCCONF}" ] && cp -f "${TMP_PATH}/bak.yml" "${S_FILE}"
if [ "${ARCMODE}" == "update" ] && [ "${CONFDONE}" == "true" ]; then
if [ "${ARCMODE}" = "update" ] && [ "${CONFDONE}" = "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update successful! -> Reboot to automated Build Mode..." 3 60
--infobox "Update Loader successful! -> Reboot to automated Build Mode..." 3 60
sleep 3
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
rebootTo "automated"
rebootTo automated
else
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update successful! -> Reboot to Config Mode..." 3 50
--infobox "Update Loader successful! -> Reboot to Config Mode..." 3 50
sleep 3
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
rebootTo "config"
rebootTo config
fi
}
@@ -102,21 +109,22 @@ function updateAddons() {
export URL="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/addons.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/addons.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Addons" \
--gauge "Download Addons: $TAG ..." 14 72
}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download Addons: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/addons.zip" ]; then
rm -rf "${ADDONS_PATH}"
mkdir -p "${ADDONS_PATH}"
@@ -132,7 +140,7 @@ function updateAddons() {
rm -f "${F}"
done
dialog --backtitle "$(backtitle)" --title "Update Addons" \
--infobox "Update successful!" 3 50
--infobox "Update Addons successful!" 3 50
sleep 2
else
return 1
@@ -161,21 +169,22 @@ function updatePatches() {
export URL="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/patches.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/patches.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Patches" \
--gauge "Download Patches: $TAG ..." 14 72
}
}' 4>&- |
dialog --gauge "Download Patches: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/patches.zip" ]; then
rm -rf "${PATCH_PATH}"
mkdir -p "${PATCH_PATH}"
@@ -184,7 +193,7 @@ function updatePatches() {
if unzip -oq "${TMP_PATH}/patches.zip" -d "${PATCH_PATH}"; then
rm -f "${TMP_PATH}/patches.zip"
dialog --backtitle "$(backtitle)" --title "Update Patches" \
--infobox "Update successful!" 3 50
--infobox "Update Patches successful!" 3 50
sleep 2
else
return 1
@@ -213,21 +222,22 @@ function updateCustom() {
export URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/custom.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/custom.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
--gauge "Download Custom Kernel: $TAG ..." 14 72
}
}' 4>&- |
dialog --gauge "Download Custom: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/custom.zip" ]; then
rm -rf "${CUSTOM_PATH}"
mkdir -p "${CUSTOM_PATH}"
@@ -236,7 +246,7 @@ function updateCustom() {
if unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"; then
rm -f "${TMP_PATH}/custom.zip"
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
--infobox "Update successful!" 3 50
--infobox "Update Custom successful!" 3 50
sleep 2
else
return 1
@@ -255,7 +265,7 @@ function updateModules() {
local PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
local PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
local KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
@@ -265,34 +275,35 @@ function updateModules() {
sleep 3
idx=$((${idx} + 1))
done
if [ -n "${TAG}" ] && [[ "${MODULESVERSION}" != "${TAG}" || ! -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ]]; then
if [ -n "${TAG}" ] && [ "${MODULESVERSION}" != "${TAG}" ]; then
rm -rf "${MODULES_PATH}"
mkdir -p "${MODULES_PATH}"
export URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/modules.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/modules.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--gauge "Download Modules: $TAG ..." 14 72
}
}' 4>&- |
dialog --gauge "Download Modules: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/modules.zip" ]; then
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--infobox "Updating Modules..." 3 50
if unzip -oq "${TMP_PATH}/modules.zip" -d "${MODULES_PATH}"; then
rm -f "${TMP_PATH}/modules.zip"
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--infobox "Update successful!" 3 50
--infobox "Update Modules successful!" 3 50
sleep 2
else
return 1
@@ -319,8 +330,8 @@ function updateModules() {
###############################################################################
# Update Configs
function updateConfigs() {
local ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
[ -f "${MODEL_CONFIG_PATH}/VERSION" ] && local CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")" || CONFIGSVERSION="0.0.0"
local USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
if [ -z "${1}" ]; then
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
@@ -338,21 +349,22 @@ function updateConfigs() {
export URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/configs.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/configs.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Configs" \
--gauge "Download Configs: $TAG ..." 14 72
}
}' 4>&- |
dialog --gauge "Download Configs: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/configs.zip" ]; then
mkdir -p "${MODEL_CONFIG_PATH}"
dialog --backtitle "$(backtitle)" --title "Update Configs" \
@@ -360,8 +372,9 @@ function updateConfigs() {
if unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"; then
rm -f "${TMP_PATH}/configs.zip"
dialog --backtitle "$(backtitle)" --title "Update Configs" \
--infobox "Update successful!" 3 50
--infobox "Update Configs successful!" 3 50
sleep 2
[ -n "${USERID}" ] && checkHardwareID || true
else
return 1
fi
@@ -393,21 +406,22 @@ function updateLKMs() {
export URL="https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/rp-lkms.zip 2>&1 |
{
curl -kL "${URL}" -o ${TMP_PATH}/rp-lkms.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
s/ /\xa0/g; # replacing space with nbsp as dialog squashes spaces
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--gauge "Download LKMs: $TAG ..." 14 72
}
}' 4>&- |
dialog --gauge "Download LKMs: ${TAG}..." 14 72 4>&-
} 4>&1
if [ -f "${TMP_PATH}/rp-lkms.zip" ]; then
rm -rf "${LKMS_PATH}"
mkdir -p "${LKMS_PATH}"
@@ -416,7 +430,7 @@ function updateLKMs() {
if unzip -oq "${TMP_PATH}/rp-lkms.zip" -d "${LKMS_PATH}"; then
rm -f "${TMP_PATH}/rp-lkms.zip"
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--infobox "Update successful!" 3 50
--infobox "Update LKMs successful!" 3 50
sleep 2
else
return 1
@@ -446,7 +460,7 @@ function dependenciesUpdate() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
FAILED="false"
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Updating Dependencies..." 0 0
--infobox "Updating Dependencies..." 3 40
sleep 2
updateAddons
[ $? -ne 0 ] && FAILED="true"
@@ -460,13 +474,13 @@ function dependenciesUpdate() {
[ $? -ne 0 ] && FAILED="true"
updateOffline
[ $? -ne 0 ] && FAILED="true"
if [ "${FAILED}" == "true" ]; then
if [ "${FAILED}" = "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
--infobox "Update Dependencies failed! Try again later." 3 40
sleep 3
elif [ "${FAILED}" == "false" ]; then
elif [ "${FAILED}" = "false" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update successful!" 0 0
--infobox "Update Dependencies successful!" 3 40
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
sleep 3

View File

@@ -3,15 +3,13 @@
set -e
[[ -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}/include/functions.sh"
# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
checkBootLoader || die "The loader is corrupted, please rewrite it!"
BUS=$(getBus "${LOADER_DISK}")
# Check if machine has EFI
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
# Print Title centralized
clear
@@ -38,9 +36,10 @@ initConfigKey "arc" "{}" "${USER_CONFIG_FILE}"
initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
initConfigKey "boot" "{}" "${USER_CONFIG_FILE}"
initConfigKey "boot.dsminfo" "true" "${USER_CONFIG_FILE}"
@@ -96,28 +95,28 @@ if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}");
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
fi
# Read/Write IP/Mac to config
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
for ETH in ${ETHX}; do
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ]; then
IFS='/' read -r -a IPRA <<<"${IPR}"
ip addr flush dev ${ETH}
ip addr add ${IPRA[0]}/${IPRA[1]:-"255.255.255.0"} dev ${ETH}
if [ -n "${IPRA[2]}" ]; then
ip route add default via ${IPRA[2]} dev ${ETH}
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
[ "${ETH::3}" == "eth" ] && ethtool -s ${ETH} wol g 2>/dev/null || true
# [ "${ETH::3}" == "eth" ] && ethtool -K ${ETH} rxhash off 2>/dev/null || true
initConfigKey "${ETH}" "${MACR}" "${USER_CONFIG_FILE}"
done
ETHN="$(echo ${ETHX} | wc -w)"
[ "${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
echo
@@ -128,7 +127,7 @@ VID="0x46f4"
PID="0x0001"
BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen"
if [ "${BUS}" == "usb" ]; then
if [ "${BUS}" = "usb" ]; then
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)"
PID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_MODEL_ID | cut -d= -f2)"
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
@@ -147,19 +146,15 @@ 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
if [ "${ARCMODE}" = "config" ]; then
echo -e "\033[1;34mStarting Config Mode...\033[0m"
elif [ "${ARCMODE}" == "automated" ]; then
elif [ "${ARCMODE}" = "automated" ]; then
echo -e "\033[1;34mStarting automated Build Mode...\033[0m"
elif [ "${ARCMODE}" == "update" ]; then
elif [ "${ARCMODE}" = "update" ]; then
echo -e "\033[1;34mStarting Update Mode...\033[0m"
elif [ "${BUILDDONE}" == "true" ] && [ "${ARCMODE}" == "dsm" ]; then
elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then
echo -e "\033[1;34mStarting DSM Mode...\033[0m"
if [ -f "${ARC_PATH}/boot.sh" ]; then
boot.sh && exit 0
else
echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m"
fi
exec boot.sh && exit 0
else
echo -e "\033[1;34mStarting Config Mode...\033[0m"
fi
@@ -172,18 +167,18 @@ IPCON=""
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
for ETH in ${ETHX}; do
for N in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
while true; do
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
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 ${ETH})"
COUNT=$((COUNT + 1))
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
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
@@ -192,7 +187,7 @@ for ETH in ${ETHX}; do
fi
break
fi
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
if [ -z "$(cat /sys/class/net/${N}}/carrier 2>/dev/null)" ]; then
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
break
fi
@@ -213,6 +208,9 @@ mkdir -p "${MODULES_PATH}"
mkdir -p "${PATCH_PATH}"
mkdir -p "${USER_UP_PATH}"
# Tell webterminal that the loader is ready
touch "${HOME}/.initialized"
# Load Arc Overlay
echo -e "\033[1;34mLoading Arc Overlay...\033[0m"
echo
@@ -223,7 +221,7 @@ RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null)
if [ ${RAM} -le 3500 ]; then
echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m"
else
arc.sh
exec arc.sh
fi
exit 0

Binary file not shown.

View File

@@ -2,9 +2,9 @@
[[ -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}/include/addons.sh
. ${ARC_PATH}/include/modules.sh
. "${ARC_PATH}/include/functions.sh"
. "${ARC_PATH}/include/addons.sh"
. "${ARC_PATH}/include/modules.sh"
set -o pipefail # Get exit code from process piped
@@ -43,8 +43,8 @@ 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=""
[ "${PATURL:0:1}" = "#" ] && PATURL=""
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
# Check if DSM Version changed
. "${RAMDISK_PATH}/etc/VERSION"
@@ -67,7 +67,7 @@ writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Sanity check
if [ -z "${PLATFORM}" ] || [ -z "${KVER}" ]; then
@@ -93,21 +93,21 @@ while IFS=': ' read -r KEY VALUE; do
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
# Patches (diff -Naru OLDFILE NEWFILE > xxx.patch)
PATCHES=()
PATCHES+=("ramdisk-etc-rc-*.patch")
PATCHES+=("ramdisk-init-script-*.patch")
PATCHES+=("ramdisk-post-init-script-*.patch")
PATCHES+=("ramdisk-disable-root-pwd-*.patch")
PATCHES+=("ramdisk-disable-disabled-ports-*.patch")
for PE in ${PATCHES[@]}; do
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 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}"
(
cd "${RAMDISK_PATH}"
patch -p1 -i "${PF}" >>"${LOG_FILE}" 2>&1 # busybox patch and gun patch have different processing methods and parameters.
)
# 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
@@ -128,13 +128,17 @@ done
grep -v -e '^[\t ]*#' -e '^$' "${PATCH_PATH}/config-manipulators.sh" >"${TMP_PATH}/rp.txt"
sed -e "/@@@CONFIG-MANIPULATORS-TOOLS@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
rm -f "${TMP_PATH}/rp.txt"
touch "${TMP_PATH}/rp.txt"
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc.defaults/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
for KEY in ${!SYNOINFO[@]}; do
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc.defaults/synoinfo.conf'" >>"${TMP_PATH}/rp.txt"
done
# Generate synoinfo configurations
{
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc/synoinfo.conf'"
echo "_set_conf_kv 'SN' '${SN}' '/tmpRoot/etc.defaults/synoinfo.conf'"
for KEY in "${!SYNOINFO[@]}"; do
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc/synoinfo.conf'"
echo "_set_conf_kv '${KEY}' '${SYNOINFO[${KEY}]}' '/tmpRoot/etc.defaults/synoinfo.conf'"
done
} >"${TMP_PATH}/rp.txt"
sed -e "/@@@CONFIG-GENERATED@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "${RAMDISK_PATH}/sbin/init.post"
rm -f "${TMP_PATH}/rp.txt"
@@ -149,26 +153,28 @@ gzip -dc "${LKMS_PATH}/rp-${PLATFORM}-${KVERP}-${LKM}.ko.gz" >"${RAMDISK_PATH}/u
# Addons
echo "Create addons.sh" >"${LOG_FILE}"
mkdir -p "${RAMDISK_PATH}/addons"
echo "#!/bin/sh" >"${RAMDISK_PATH}/addons/addons.sh"
echo 'echo "addons.sh called with params ${@}"' >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export LOADERLABEL=\"ARC\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export LOADERVERSION=\"${ARC_VERSION}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export LOADERBUILD=\"${ARC_BUILD}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export LOADERBRANCH=\"${ARCBRANCH}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export PLATFORM=\"${PLATFORM}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export PRODUCTVER=\"${PRODUCTVER}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MODEL=\"${MODEL}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MODELID=\"${MODELID}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MLINK=\"${PAT_URL}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MCHECKSUM=\"${PAT_HASH}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export LAYOUT=\"${LAYOUT}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export KEYMAP=\"${KEYMAP}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
{
echo "#!/bin/sh"
echo 'echo "addons.sh called with params ${@}"'
echo "export LOADERLABEL=\"ARC\""
echo "export LOADERVERSION=\"${ARC_VERSION}\""
echo "export LOADERBUILD=\"${ARC_BUILD}\""
echo "export LOADERBRANCH=\"${ARCBRANCH}\""
echo "export PLATFORM=\"${PLATFORM}\""
echo "export MODEL=\"${MODEL}\""
echo "export MODELID=\"${MODELID}\""
echo "export PRODUCTVER=\"${PRODUCTVER}\""
echo "export MLINK=\"${PAT_URL}\""
echo "export MCHECKSUM=\"${PAT_HASH}\""
echo "export LAYOUT=\"${LAYOUT}\""
echo "export KEYMAP=\"${KEYMAP}\""
} >"${RAMDISK_PATH}/addons/addons.sh"
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
# System Addons
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol" "mountloader"; do
PARAMS=""
if [ "${ADDON}" == "disks" ]; then
if [ "${ADDON}" = "disks" ]; then
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
PARAMS="${HDDSORT} ${USBMOUNT}"
@@ -190,7 +196,7 @@ echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "Modify files" >"${LOG_FILE}"
# Remove function from scripts
[ "2" == "${PRODUCTVER:0: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
@@ -228,14 +234,14 @@ for N in $(seq 0 7); do
done
# SA6400 patches
if [ "${PLATFORM}" == "epyc7002" ]; then
if [ "${PLATFORM}" = "epyc7002" ]; then
echo -n " - Apply Epyc7002 Fixes"
sed -i 's#/dev/console#/var/log/lrc#g' ${RAMDISK_PATH}/usr/bin/busybox
sed -i '/^echo "START/a \\nmknod -m 0666 /dev/console c 1 3' ${RAMDISK_PATH}/linuxrc.syno
fi
# Broadwellntbap patches
if [ "${PLATFORM}" == "broadwellntbap" ]; then
if [ "${PLATFORM}" = "broadwellntbap" ]; then
echo -n " - Apply Broadwellntbap Fixes"
sed -i 's/IsUCOrXA="yes"/XIsUCOrXA="yes"/g; s/IsUCOrXA=yes/XIsUCOrXA=yes/g' ${RAMDISK_PATH}/usr/syno/share/environments.sh
fi
@@ -247,7 +253,7 @@ for F in $(ls -1 ${USER_UP_PATH}/*.sh 2>/dev/null); do
done
# Reassembly ramdisk
if [ "${RD_COMPRESSED}" == "true" ]; then
if [ "${RD_COMPRESSED}" = "true" ]; then
(cd "${RAMDISK_PATH}" && find . 2>/dev/null | cpio -o -H newc -R root:root | xz -9 --format=lzma >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || exit 1
else
(cd "${RAMDISK_PATH}" && find . 2>/dev/null | cpio -o -H newc -R root:root >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || exit 1

View File

@@ -3,72 +3,89 @@
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
. ${ARC_PATH}/include/functions.sh
calculate_run_size() {
NUM='\([0-9a-fA-F]*[ \t]*\)'
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/0x\1 0x\4/p')
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
if [ -z "${OUT}" ]; then
echo "Never found .bss or .brk file offset" >&2
return 1
fi
read -r sizeA offsetA sizeB offsetB <<<$(echo ${OUT} | awk '{printf "%d %d %d %d", strtonum($1), strtonum($2), strtonum($3), strtonum($4)}')
runSize=$((offsetA + sizeA + sizeB))
# BFD linker shows the same file offset in ELF.
if [ "${offsetA}" -ne "${offsetB}" ]; then
# Gold linker shows them as consecutive.
endSize=$((offsetB + sizeB))
if [ "${endSize}" -ne "${runSize}" ]; then
printf "sizeA: 0x%x\n" ${sizeA} >&2
printf "offsetA: 0x%x\n" ${offsetA} >&2
printf "sizeB: 0x%x\n" ${sizeB} >&2
printf "offsetB: 0x%x\n" ${offsetB} >&2
echo ".bss and .brk are non-contiguous" >&2
return 1
fi
fi
printf "%d\n" ${runSize}
return 0
}
# Adapted from: scripts/Makefile.lib
# Usage: size_append FILE [FILE2] [FILEn]...
# Output: LE HEX with size of file in bytes (to STDOUT)
file_size_le() {
printf $(
dec_size=0
for F in "${@}"; do
fsize=$(stat -c "%s" ${F})
dec_size=$((${dec_size} + ${fsize}))
done
printf "%08x\n" ${dec_size} |
sed 's/\(..\)/\1 /g' | {
read ch0 ch1 ch2 ch3
for ch in ${ch3} ${ch2} ${ch1} ${ch0}; do
printf '%s%03o' '\' $((0x${ch}))
done
local dec_size=0
for F in "$@"; do dec_size=$((dec_size + $(stat -c "%s" "${F}"))); done
printf "%08x\n" "${dec_size}" | sed 's/\(..\)/\1 /g' | {
read -r ch0 ch1 ch2 ch3
for ch in "${ch3}" "${ch2}" "${ch1}" "${ch0}"; do printf '%s%03o' '\' "$((0x${ch}))"; done
}
)
}
size_le() {
printf $(
printf "%08x\n" "${@}" |
sed 's/\(..\)/\1 /g' | {
read ch0 ch1 ch2 ch3
for ch in ${ch3} ${ch2} ${ch1} ${ch0}; do
printf '%s%03o' '\' $((0x${ch}))
done
printf "%08x\n" "${@}" | sed 's/\(..\)/\1 /g' | {
read -r ch0 ch1 ch2 ch3
for ch in "${ch3}" "${ch2}" "${ch1}" "${ch0}"; do printf '%s%03o' '\' "$((0x${ch}))"; done
}
)
}
VMLINUX_MOD=${1}
ZIMAGE_MOD=${2}
KVER_MAJOR=${KVER:0:1}
if [ ${KVER_MAJOR} -eq 4 ]; then
KVER=$(strings "${VMLINUX_MOD}" | grep -Eo "Linux version [0-9]+\.[0-9]+\.[0-9]+" | head -1 | awk '{print $3}')
if [ "$(echo "${KVER:-4}" | cut -d'.' -f1)" -lt 5 ]; then
# Kernel version 4.x or 3.x (bromolow)
#zImage_head 16494
#payload(
# vmlinux.bin x
# padding 0xf00000-x
# vmlinux.bin size 4
#) 0xf00004
#zImage_tail(
# unknown 72
# run_size 4
# unknown 30
# vmlinux.bin size 4
# unknown 114460
#) 114570
#crc32 4
# zImage_head 16494
# payload(
# vmlinux.bin x
# padding 0xf00000-x
# vmlinux.bin size 4
# ) 0xf00004
# zImage_tail(
# unknown 72
# run_size 4
# unknown 30
# vmlinux.bin size 4
# unknown 114460
# ) 114570
# crc32 4
gzip -dc "${ARC_PATH}/bzImage-template-v4.gz" >"${ZIMAGE_MOD}" || exit 1
dd if="${VMLINUX_MOD}" of="${ZIMAGE_MOD}" bs=16494 seek=1 conv=notrunc || exit 1
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=15745134 seek=1 conv=notrunc || exit 1
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=15745244 seek=1 conv=notrunc || exit 1
RUN_SIZE=$(objdump -h ${VMLINUX_MOD} | sh "${ARC_PATH}/calc_run_size.sh")
size_le ${RUN_SIZE} | dd of=${ZIMAGE_MOD} bs=15745210 seek=1 conv=notrunc|| exit 1
size_le $(($((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}'))) ^ 0xFFFFFFFF)) | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
RUN_SIZE=$(objdump -h "${VMLINUX_MOD}" | calc_run_size)
size_le "${RUN_SIZE}" | dd of="${ZIMAGE_MOD}" bs=15745210 seek=1 conv=notrunc || exit 1
size_le "$((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}') ^ 0xFFFFFFFF))" | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
else
# Kernel version 5.x
gzip -dc "${ARC_PATH}/bzImage-template-v5.gz" >"${ZIMAGE_MOD}" || exit 1
@@ -76,7 +93,7 @@ else
dd if="${VMLINUX_MOD}" of="${ZIMAGE_MOD}" bs=14561 seek=1 conv=notrunc || exit 1
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=34463421 seek=1 conv=notrunc || exit 1
file_size_le "${VMLINUX_MOD}" | dd of="${ZIMAGE_MOD}" bs=34479132 seek=1 conv=notrunc || exit 1
# RUN_SIZE=$(objdump -h ${VMLINUX_MOD} | sh "${ARC_PATH}/calc_run_size.sh")
# size_le ${RUN_SIZE} | dd of=${ZIMAGE_MOD} bs=34626904 seek=1 conv=notrunc || exit 1
size_le $(($((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}'))) ^ 0xFFFFFFFF)) | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
# RUN_SIZE=$(objdump -h "${VMLINUX_MOD}" | calc_run_size)
# size_le "${RUN_SIZE}" | dd of="${ZIMAGE_MOD}" bs=34626904 seek=1 conv=notrunc || exit 1
size_le "$((16#$(crc32 "${ZIMAGE_MOD}" | awk '{print $1}') ^ 0xFFFFFFFF))" | dd of="${ZIMAGE_MOD}" conv=notrunc oflag=append || exit 1
fi

View File

@@ -2,7 +2,7 @@
[[ -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}/include/functions.sh"
set -o pipefail # Get exit code from process piped
@@ -12,22 +12,22 @@ set -o pipefail # Get exit code from process piped
rm -f "${MOD_ZIMAGE_FILE}"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" == "custom" ]; then
if [ "${KERNEL}" = "custom" ]; then
echo -n " - Using customized Kernel"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Extract bzImage
gzip -dc "${CUSTOM_PATH}/bzImage-${PLATFORM}-${KVERP}.gz" >"${MOD_ZIMAGE_FILE}"
else
# Extract vmlinux
${ARC_PATH}/bzImage-to-vmlinux.sh "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
"${ARC_PATH}/bzImage-to-vmlinux.sh" "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
# Patch boot params and ramdisk check
${ARC_PATH}/kpatch "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
"${ARC_PATH}/kpatch" "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
# rebuild zImage
${ARC_PATH}/vmlinux-to-bzImage.sh "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
"${ARC_PATH}/vmlinux-to-bzImage.sh" "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
fi
sync

View File

@@ -1,28 +1,14 @@
insmod search
insmod echo
insmod terminal
insmod test
insmod font
insmod loadenv
insmod serial
insmod usb_keyboard
insmod linux
insmod gzio
insmod fat
insmod ext2
insmod ata
insmod btrfs
insmod ntfs
insmod part_msdos
insmod part_gpt
set default="boot"
set timeout="5"
set timeout_style="menu"
set pager=1
set vesa_mode=1
set menu_color_normal=white/black
set menu_color_highlight=white/red
set color_normal=white/black
if [ -s $prefix/grubenv ]; then
load_env
if [ -s ${prefix}/grubenv ]; then
load_env --skip-sig
fi
if [ "${next_entry}" ]; then
set default="${next_entry}"
@@ -33,26 +19,29 @@ if [ "${vesa_mode}" ]; then
set vesa_mode=${vesa_mode}
fi
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
}
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
load_video
if loadfont unicode; then
insmod gfxterm
set gfxmode=1024x768
set gfxmode=auto
set gfxpayload=auto
terminal_output gfxterm
if [ "${grub_platform}" = "efi" ]; then
terminal_output --append gfxterm
else
terminal_output gfxterm
fi
insmod gfxmenu
loadfont ${prefix}/theme/dejavu_bold_14.pf2
loadfont ${prefix}/theme/dejavu_mono_12.pf2
@@ -61,9 +50,9 @@ if loadfont unicode; then
export theme
fi
if serial --unit=0 --speed=115200; then
terminal_input --append serial_com0
terminal_output --append serial_com0
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
terminal_input --append serial
terminal_output --append serial
fi
function set_gfxpayload {
@@ -74,11 +63,7 @@ function set_gfxpayload {
fi
}
set menu_color_normal=white/black
set menu_color_highlight=white/red
set color_normal=white/black
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable"
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off nox2apic nomodeset intel_pstate=passive amd_pstate=passive"
search --set=root --label "ARC3"
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,7 +5,7 @@ set -e
# Clean cached Files
sudo git clean -fdx
. scripts/func.sh
. scripts/func.sh "${AUX_TOKEN}"
# Get extractor, LKM, addons and Modules
echo "Get Dependencies"
@@ -17,7 +17,8 @@ getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
getBuildrootx "brx"
mkdir -p "brx"
[ ! -f "../brx/bzImage" ] && getBuildrootx "brx" || copyBuildroot "brx"
# Sbase
IMAGE_FILE="arc.img"
@@ -35,19 +36,22 @@ mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[[ ! -f "brx/bzImage-arc" || ! -f "brx/initrd-arc" ]] && return 1
ARC_BUILD="`date +'%y%m%d'`-dev"
ARC_VERSION="13.11"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.3.7"
ARC_BRANCH="next"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
#cp -f "brx/initrd-arc" "files/p3/initrd-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
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
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
exit 1
fi
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
@@ -62,4 +66,4 @@ rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk

View File

@@ -5,7 +5,7 @@ set -e
# Clean cached Files
sudo git clean -fdx
. scripts/func.sh
. scripts/func.sh "${AUX_TOKEN}"
# Get extractor, LKM, addons and Modules
echo "Get Dependencies"
@@ -17,7 +17,7 @@ getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
getBuildroots "brs"
[ -f "../brs/bzImage" ] && copyBuildroot "brs" || getBuildroots "brs"
# Sbase
IMAGE_FILE="arc.img"
@@ -35,19 +35,22 @@ 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
ARC_BUILD="`date +'%y%m%d'`-dev"
ARC_VERSION="13.11"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.3.7"
ARC_BRANCH="stable"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
#cp -f "brs/initrd-arc" "files/p3/initrd-arc"
repackInitrd "brs/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
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
exit 1
fi
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
@@ -62,4 +65,4 @@ rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk

Binary file not shown.

View File

@@ -489,4 +489,4 @@ int main(int argc, char *argv[])
close(fd);
printf("Finish!\n");
return 0;
}
}

View File

@@ -6,30 +6,7 @@
# See /LICENSE for more information.
#
# Get latest Arc
# $1 path
function getArcSystem() {
echo "Getting ArcSystem begin"
local DEST_PATH="${1}"
local RELEASE="${2}"
local CACHE_FILE="/tmp/system.zip"
rm -f "${CACHE_FILE}"
if [ "${RELEASE}" = "dev" ]; then
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-system/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
else
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-system/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
fi
if curl -skL "https://github.com/AuxXxilium/arc-system/releases/download/${TAG}/system-${TAG}.zip" -o "${CACHE_FILE}"; then
# Unzip LKMs
mkdir -p "${DEST_PATH}"
unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"
rm -f "${CACHE_FILE}"
echo "Getting ArcSystem end - ${TAG}"
else
echo "Failed to get ArcSystem"
exit 1
fi
}
[ -n "${1}" ] && export TOKEN="${1}"
# Get latest LKMs
# $1 path
@@ -198,52 +175,44 @@ function getBuildrootx() {
echo "Getting Buildroot-X begin"
local DEST_PATH="${1}"
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
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}"
echo "Getting Kernel"
rm -f "${DEST_PATH}/bzImage-arc"
if curl -skL "https://github.com/AuxXxilium/arc-buildroot-x/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-arc"; then
echo "Kernel: ${TAG}"
else
echo "Failed to get Kernel"
exit 1
fi
echo "Getting Ramdisk"
rm -f "${DEST_PATH}/initrd-arc"
if curl -skL "https://github.com/AuxXxilium/arc-buildroot-x/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-arc"; then
echo "Ramdisk: ${TAG}"
else
echo "Failed to get Ramdisk"
exit 1
fi
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-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/arc-buildroot-x/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot-X
# Get latest Buildroot-S
# $1 path
function getBuildroots() {
echo "Getting Buildroot-S begin"
local DEST_PATH="${1}"
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
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}"
echo "Getting Kernel"
rm -f "${DEST_PATH}/bzImage-arc"
if curl -skL "https://github.com/AuxXxilium/arc-buildroot-s/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-arc"; then
echo "Kernel: ${TAG}"
else
echo "Failed to get Kernel"
exit 1
fi
echo "Getting Ramdisk"
rm -f "${DEST_PATH}/initrd-arc"
if curl -skL "https://github.com/AuxXxilium/arc-buildroot-s/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-arc"; then
echo "Ramdisk: ${TAG}"
else
echo "Failed to get Ramdisk"
exit 1
fi
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
@@ -263,33 +232,49 @@ function getOffline() {
}
# repack initrd
# $1 initrd file
# $1 initrd file
# $2 plugin path
# $3 output file
function repackInitrd() {
INITRD_FILE="${1}"
PLUGIN_PATH="${2}"
OUTPUT_PATH="${3:-${INITRD_FILE}}"
local INITRD_FILE="${1}"
local PLUGIN_PATH="${2}"
local OUTPUT_PATH="${3:-${INITRD_FILE}}"
[ -z "${INITRD_FILE}" ] || [ ! -f "${INITRD_FILE}" ] && exit 1
[ -z "${PLUGIN_PATH}" ] || [ ! -d "${PLUGIN_PATH}" ] && exit 1
INITRD_FILE="$(readlink -f "${INITRD_FILE}")"
PLUGIN_PATH="$(readlink -f "${PLUGIN_PATH}")"
OUTPUT_PATH="$(readlink -f "${OUTPUT_PATH}")"
RDXZ_PATH="rdxz_tmp"
INITRD_FILE="$(realpath "${INITRD_FILE}")"
PLUGIN_PATH="$(realpath "${PLUGIN_PATH}")"
OUTPUT_PATH="$(realpath "${OUTPUT_PATH}")"
local RDXZ_PATH="rdxz_tmp"
mkdir -p "${RDXZ_PATH}"
(
cd "${RDXZ_PATH}"
sudo xz -dc <"${INITRD_FILE}" | sudo cpio -idm
) || true
local INITRD_FORMAT=$(file -b --mime-type "${INITRD_FILE}")
case "${INITRD_FORMAT}" in
*'x-cpio'*) (cd "${RDXZ_PATH}" && sudo cpio -idm <"${INITRD_FILE}") >/dev/null 2>&1 ;;
*'x-xz'*) (cd "${RDXZ_PATH}" && xz -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
*'x-lz4'*) (cd "${RDXZ_PATH}" && lz4 -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
*'x-lzma'*) (cd "${RDXZ_PATH}" && lzma -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
*'x-bzip2'*) (cd "${RDXZ_PATH}" && bzip2 -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
*'gzip'*) (cd "${RDXZ_PATH}" && gzip -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
*'zstd'*) (cd "${RDXZ_PATH}" && zstd -dc "${INITRD_FILE}" | sudo cpio -idm) >/dev/null 2>&1 ;;
*) ;;
esac
sudo cp -rf "${PLUGIN_PATH}/"* "${RDXZ_PATH}/"
[ -f "${OUTPUT_PATH}" ] && rm -rf "${OUTPUT_PATH}"
(
cd "${RDXZ_PATH}"
sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz -9 --check=crc32 >"${OUTPUT_PATH}"
) || true
case "${INITRD_FORMAT}" in
*'x-cpio'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*'x-xz'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz -9 -C crc32 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*'x-lz4'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | lz4 -9 -l -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*'x-lzma'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | lzma -9 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*'x-bzip2'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | bzip2 -9 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*'gzip'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | gzip -9 -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*'zstd'*) (cd "${RDXZ_PATH}" && sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | zstd -19 -T0 -f -c - >"${OUTPUT_PATH}") >/dev/null 2>&1 ;;
*) ;;
esac
sudo rm -rf "${RDXZ_PATH}"
}
@@ -305,8 +290,8 @@ function resizeImg() {
[[ -z "${INPUT_FILE}" || ! -f "${INPUT_FILE}" ]] && exit 1
[ -z "${CHANGE_SIZE}" ] && exit 1
INPUT_FILE="$(readlink -f "${INPUT_FILE}")"
OUTPUT_FILE="$(readlink -f "${OUTPUT_FILE}")"
INPUT_FILE="$(realpath "${INPUT_FILE}")"
OUTPUT_FILE="$(realpath "${OUTPUT_FILE}")"
SIZE=$(($(du -m "${INPUT_FILE}" | awk '{print $1}')$(echo "${CHANGE_SIZE}" | sed 's/M//g; s/b//g')))
@@ -325,47 +310,28 @@ function resizeImg() {
sudo losetup -d ${LOOPX}
}
# convertova
# createvmx
# $1 bootloader file
# $2 ova file
function convertova() {
# $2 vmx name
function createvmx() {
BLIMAGE=${1}
OVAPATH=${2}
VMNAME=${2}
BLIMAGE="$(readlink -f "${BLIMAGE}")"
OVAPATH="$(readlink -f "${OVAPATH}")"
VMNAME="$(basename "${OVAPATH}" .ova)"
# Download and install ovftool if it doesn't exist
if [ ! -x ovftool/ovftool ]; then
rm -rf ovftool ovftool.zip
curl -skL https://github.com/rgl/ovftool-binaries/raw/main/archive/VMware-ovftool-4.6.0-21452615-lin.x86_64.zip -o ovftool.zip
if [ $? -ne 0 ]; then
echo "Failed to download ovftool"
exit 1
fi
unzip ovftool.zip -d . >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to extract ovftool"
exit 1
fi
chmod +x ovftool/ovftool
fi
if ! command -v qemu-img &>/dev/null; then
sudo apt install -y qemu-utils
fi
# Convert raw image to VMDK
rm -rf "OVA_${VMNAME}"
mkdir -p "OVA_${VMNAME}"
qemu-img convert -O vmdk -o 'adapter_type=lsilogic,subformat=streamOptimized,compat6' "${BLIMAGE}" "OVA_${VMNAME}/${VMNAME}-disk1.vmdk"
qemu-img create -f vmdk "OVA_${VMNAME}/${VMNAME}-disk2.vmdk" "32G"
rm -rf "VMX_${VMNAME}"
mkdir -p "VMX_${VMNAME}"
qemu-img convert -O vmdk -o 'adapter_type=lsilogic,subformat=streamOptimized,compat6' "${BLIMAGE}" "VMX_${VMNAME}/${VMNAME}-disk1.vmdk"
qemu-img create -f vmdk "VMX_${VMNAME}/${VMNAME}-disk2.vmdk" "32G"
# Create VM configuration
cat <<_EOF_ >"OVA_${VMNAME}/${VMNAME}.vmx"
cat <<_EOF_ >"VMX_${VMNAME}/${VMNAME}.vmx"
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "21"
virtualHW.version = "17"
displayName = "${VMNAME}"
annotation = "https://github.com/AuxXxilium/arc"
guestOS = "ubuntu-64"
@@ -413,14 +379,108 @@ ethernet0.virtualDev = "vmxnet3"
ethernet0.connectionType = "nat"
ethernet0.allowguestconnectioncontrol = "true"
ethernet0.present = "TRUE"
serial0.fileType = "file"
serial0.fileName = "serial0.log"
serial0.present = "TRUE"
sata0.present = "TRUE"
sata0:0.fileName = "${VMNAME}-disk1.vmdk"
sata0:0.present = "TRUE"
sata0:1.fileName = "${VMNAME}-disk2.vmdk"
sata0:1.present = "TRUE"
_EOF_
}
# convertvmx
# $1 bootloader file
# $2 vmx file
function convertvmx() {
local BLIMAGE=${1}
local VMXPATH=${2}
BLIMAGE="$(realpath "${BLIMAGE}")"
VMXPATH="$(realpath "${VMXPATH}")"
local VMNAME="$(basename "${VMXPATH}" .vmx)"
createvmx "${BLIMAGE}" "${VMNAME}"
rm -rf "${VMXPATH}"
mv -f "VMX_${VMNAME}" "${VMXPATH}"
}
# convertova
# $1 bootloader file
# $2 ova file
function convertova() {
local BLIMAGE=${1}
local OVAPATH=${2}
BLIMAGE="$(realpath "${BLIMAGE}")"
OVAPATH="$(realpath "${OVAPATH}")"
local VMNAME="$(basename "${OVAPATH}" .ova)"
createvmx "${BLIMAGE}" "${VMNAME}"
# Download and install ovftool if it doesn't exist
if [ ! -x ovftool/ovftool ]; then
rm -rf ovftool ovftool.zip
curl -skL https://github.com/rgl/ovftool-binaries/raw/main/archive/VMware-ovftool-4.6.0-21452615-lin.x86_64.zip -o ovftool.zip
if [ $? -ne 0 ]; then
echo "Failed to download ovftool"
exit 1
fi
unzip ovftool.zip -d . >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to extract ovftool"
exit 1
fi
chmod +x ovftool/ovftool
fi
rm -f "${OVAPATH}"
ovftool/ovftool "OVA_${VMNAME}/${VMNAME}.vmx" "${OVAPATH}"
rm -rf "OVA_${VMNAME}"
ovftool/ovftool "VMX_${VMNAME}/${VMNAME}.vmx" "${OVAPATH}"
rm -rf "VMX_${VMNAME}"
}
# createvmc
# $1 vhd file
# $2 vmc file
function createvmc() {
local BLIMAGE=${1:-arc.vhd}
local VMCPATH=${2:-arc.vmc}
BLIMAGE="$(basename "${BLIMAGE}")"
VMCPATH="$(realpath "${VMCPATH}")"
cat <<_EOF_ >"${VMCPATH}"
<?xml version="1.0" encoding="UTF-8"?>
<preferences>
<version type="string">2.0</version>
<hardware>
<memory>
<ram_size type="integer">4096</ram_size>
</memory>
<pci_bus>
<ide_adapter>
<ide_controller id="0">
<location id="0">
<drive_type type="integer">1</drive_type>
<pathname>
<relative type="string">${BLIMAGE}</relative>
</pathname>
</location>
</ide_controller>
</ide_adapter>
</pci_bus>
</hardware>
</preferences>
_EOF_
}
# copy buildroot
function copyBuildroot() {
DEST_PATH="${1}"
rm -rf "${DEST_PATH}"
mkdir -p "${DEST_PATH}"
cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
}