Compare commits

...

68 Commits

Author SHA1 Message Date
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
22 changed files with 906 additions and 682 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

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

View File

@@ -334,8 +334,8 @@ function cmdlineMenu() {
RET=$?
case ${RET} in
0) # ok-button
NAME="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
VALUE="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
NAME="$(sed -n '1p' "${TMP_PATH}/resp" 2>/dev/null)"
VALUE="$(sed -n '2p' "${TMP_PATH}/resp" 2>/dev/null)"
[[ "${NAME}" = *= ]] && NAME="${NAME%?}"
[[ "${VALUE}" = =* ]] && VALUE="${VALUE#*=}"
if [ -z "${NAME//\"/}" ]; then
@@ -539,8 +539,8 @@ function synoinfoMenu() {
RET=$?
case ${RET} in
0) # ok-button
NAME="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
VALUE="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
NAME="$(sed -n '1p' "${TMP_PATH}/resp" 2>/dev/null)"
VALUE="$(sed -n '2p' "${TMP_PATH}/resp" 2>/dev/null)"
[[ "${NAME}" = *= ]] && NAME="${NAME%?}"
[[ "${VALUE}" = =* ]] && VALUE="${VALUE#*=}"
if [ -z "${NAME//\"/}" ]; then
@@ -582,9 +582,9 @@ function synoinfoMenu() {
--checklist "Select synoinfo entry to remove" 0 0 0 --file "${TMP_PATH}/opts" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && continue
RESP=$(cat "${TMP_PATH}/resp")
[ -z "${RESP}" ] && continue
for I in ${RESP}; do
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && continue
for I in ${resp}; do
unset SYNOINFO[${I}]
deleteConfigKey "synoinfo.\"${I}\"" "${USER_CONFIG_FILE}"
done
@@ -721,6 +721,7 @@ function backupMenu() {
fi
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
MODEL=""
PRODUCTVER=""
@@ -746,6 +747,7 @@ function backupMenu() {
break
fi
fi
umount "${TMP_PATH}/mdX"
done
if [ -f "${USER_CONFIG_FILE}" ]; then
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
@@ -775,6 +777,7 @@ function backupMenu() {
fi
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
if [ -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" ]; then
cp -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" "${PART2_PATH}/machine.key"
@@ -783,6 +786,7 @@ function backupMenu() {
break
fi
done
umount "${TMP_PATH}/mdX"
if [ -f "${PART2_PATH}/machine.key" ]; then
dialog --backtitle "$(backtitle)" --title "Restore Encryption Key" --aspect 18 \
--msgbox "Encryption Key restore successful!" 0 0
@@ -802,6 +806,7 @@ function backupMenu() {
(
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
if [ -f "${PART2_PATH}/machine.key" ]; then
@@ -854,16 +859,12 @@ function backupMenu() {
exec init.sh
;;
5)
if [ -f "${USER_CONFIG_FILE}" ]; then
HWID="$(genHWID)"
curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}" 2>/dev/null
if [ $? -eq 0 ]; then
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup successful!" 5 40
else
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup failed!" 5 40
fi
HWID="$(genHWID)"
curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}" 2>/dev/null
if [ $? -eq 0 ]; then
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup successful!" 5 40
else
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "No User Config found!" 5 40
dialog --backtitle "$(backtitle)" --title "Online Backup" --msgbox "Online Backup failed!" 5 40
fi
;;
esac
@@ -971,7 +972,7 @@ function sysinfo() {
CPU="$(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}')"
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
ETHN=$(echo ${ETHX} | wc -w)
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
@@ -1020,10 +1021,11 @@ function sysinfo() {
TEXT+="\n Vendor: \Zb${VENDOR}\Zn"
TEXT+="\n CPU: \Zb${CPU}\Zn"
if [ $(lspci -d ::300 | wc -l) -gt 0 ]; then
GPUNAME=""
for PCI in $(lspci -d ::300 | awk '{print $1}'); do
GPUNAME=$(lspci -s ${PCI} | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
TEXT+="\n GPU: \Zb${GPUNAME}\Zn"
GPUNAME+="$(lspci -s ${PCI} | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')"
done
TEXT+="\n GPU: \Zb${GPUNAME}\Zn"
fi
TEXT+="\n Memory: \Zb$((${RAMTOTAL}))GB\Zn"
TEXT+="\n AES | ACPI: \Zb${AESSYS} | ${ACPISYS}\Zn"
@@ -1037,23 +1039,23 @@ function sysinfo() {
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
while true; do
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
TEXT+="\n${DRIVER}: \ZbDOWN\Zn"
TEXT+="\n ${DRIVER}: \ZbDOWN\Zn"
break
fi
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
TEXT+="\n${DRIVER}: \ZbNOT CONNECTED\Zn"
TEXT+="\n ${DRIVER}: \ZbNOT CONNECTED\Zn"
break
fi
if [ ${COUNT} -ge ${TIMEOUT} ]; then
TEXT+="\n${DRIVER}: \ZbTIMEOUT\Zn"
TEXT+="\n ${DRIVER}: \ZbTIMEOUT\Zn"
break
fi
COUNT=$((${COUNT} + 1))
IP="$(getIP ${N})"
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
TEXT+="\n$ {DRIVER} (${SPEED}): \ZbLINK LOCAL (No DHCP server found.)\Zn"
TEXT+="\n ${DRIVER} (${SPEED}): \ZbLINK LOCAL (No DHCP server found.)\Zn"
else
TEXT+="\n ${DRIVER} (${SPEED}): \Zb${IP}\Zn"
fi
@@ -1113,15 +1115,14 @@ function sysinfo() {
TEXT+="\n"
# Get Information for Sata Controller
NUMPORTS=0
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
TEXT+="\n SATA Controller:\n"
for PCI in $(lspci -d ::106 | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
TEXT+="\Zb ${NAME}\Zn\n Ports: "
PORTS=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
for P in ${PORTS}; do
if lsscsi -b | grep -v - | grep -q "\[${P}:"; then
DUMMY="$([ "$(cat /sys/class/scsi_host/host${P}/ahci_port_cmd)" = "0" ] && echo 1 || echo 2)"
if lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep -q "\[${P}:"; then
if [ "$(cat /sys/class/scsi_host/host${P}/ahci_port_cmd)" = "0" ]; then
TEXT+="\Z1\Zb$(printf "%02d" ${P})\Zn "
else
@@ -1139,7 +1140,7 @@ function sysinfo() {
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[${PORT}:" | wc -l)
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
done
@@ -1147,7 +1148,7 @@ function sysinfo() {
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[${PORT}:" | wc -l)
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
done
@@ -1163,12 +1164,12 @@ function sysinfo() {
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[${PORT}:" | wc -l)
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
[ ${PORTNUM} -eq 0 ] && continue
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
done
[ $(ls -l /sys/class/mmc_host 2>/dev/null | grep mmc_host | wc -l) -gt 0 ] && TEXT+="\n MMC Controller:\n"
[ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ] && TEXT+="\n MMC Controller:\n"
for PCI in $(lspci -d ::805 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORTNUM=$(ls -l /sys/block/mmc* 2>/dev/null | grep "${PCI}" | wc -l)
@@ -1180,7 +1181,7 @@ function sysinfo() {
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
PORT=$(ls -l /sys/class/nvme 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n)
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[N:${PORT}:" | wc -l)
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[N:${PORT}:" | wc -l)
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
done
@@ -1267,7 +1268,7 @@ function uploadDiag () {
# Shows Networkdiag to user
function networkdiag() {
(
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
for N in ${ETHX}; do
echo
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
@@ -1281,8 +1282,8 @@ function networkdiag() {
continue
fi
echo -e "Link: CONNECTED"
addr=$(getIP ${N})
netmask=$(ifconfig ${N} | grep inet | grep 255 | awk '{print $4}' | cut -f2 -d':')
addr=$(getIP "${N}")
netmask=$(ifconfig "${N}" | grep inet | grep 255 | awk '{print $4}' | cut -f2 -d':')
echo -e "IP Address: ${addr}"
echo -e "Netmask: ${netmask}"
echo
@@ -1296,7 +1297,7 @@ function networkdiag() {
else
websites=("google.com" "github.com" "auxxxilium.tech")
for website in "${websites[@]}"; do
if ping -I ${ETH} -c 1 "${website}" &> /dev/null; then
if ping -I "${N}" -c 1 "${website}" &> /dev/null; then
echo -e "Connection to ${website} is successful."
else
echo -e "Connection to ${website} failed."
@@ -1304,20 +1305,20 @@ function networkdiag() {
done
echo
HWID="$(genHWID)"
USERIDAPI="$(curl --interface ${N} -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)"
USERIDAPI="$(curl --interface "${N}" -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)"
if [[ $? -ne 0 || -z "${USERIDAPI}" ]]; then
echo -e "Arc UserID API not reachable!"
else
echo -e "Arc UserID API reachable! (${USERIDAPI})"
fi
GITHUBAPI=$(curl --interface ${N} -skL -m 10 "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1 2>/dev/null)
GITHUBAPI=$(curl --interface "${N}" -skL -m 10 "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1 2>/dev/null)
if [[ $? -ne 0 || -z "${GITHUBAPI}" ]]; then
echo -e "Github API not reachable!"
else
echo -e "Github API reachable!"
fi
if [ "${CONFDONE}" = "true" ]; then
SYNOAPI=$(curl --interface ${N} -skL -m 10 "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url')
SYNOAPI=$(curl --interface "${N}" -skL -m 10 "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url')
if [[ $? -ne 0 || -z "${SYNOAPI}" ]]; then
echo -e "Syno API not reachable!"
else
@@ -1350,7 +1351,7 @@ function credits() {
TEXT+="\n Redpill: \ZbTTG / Pocopico\Zn"
TEXT+="\n ARPL/RR: \Zbfbelavenuto / wjz304\Zn"
TEXT+="\n Others: \Zb007revad / more...\Zn"
TEXT+="\n System: \ZbBuildroot 2023.08.x / 2024.02.x\Zn"
TEXT+="\n System: \ZbBuildroot\Zn"
TEXT+="\n DSM: \ZbSynology Inc.\Zn"
TEXT+="\n"
TEXT+="\n\Z4>> Note:\Zn"
@@ -1371,7 +1372,7 @@ function credits() {
###############################################################################
# Setting Static IP for Loader
function staticIPMenu() {
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep -v lo)
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
IPCON=""
for N in ${ETHX}; do
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
@@ -1386,15 +1387,15 @@ function staticIPMenu() {
RET=$?
case ${RET} in
0) # ok-button
address="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
netmask="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
gateway="$(cat "${TMP_PATH}/resp" | sed -n '3p')"
dnsname="$(cat "${TMP_PATH}/resp" | sed -n '4p')"
address="$(sed -n '1p' "${TMP_PATH}/resp" 2>/dev/null)"
netmask="$(sed -n '2p' "${TMP_PATH}/resp" 2>/dev/null)"
gateway="$(sed -n '3p' "${TMP_PATH}/resp" 2>/dev/null)"
dnsname="$(sed -n '4p' "${TMP_PATH}/resp" 2>/dev/null)"
(
if [ -z "${address}" ]; then
if [ -n "$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")" ]; then
if [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
ip addr flush dev ${N}
ip addr flush dev "${N}"
fi
deleteConfigKey "network.${MACR}" "${USER_CONFIG_FILE}"
IP="$(getIP)"
@@ -1403,10 +1404,10 @@ function staticIPMenu() {
fi
else
if [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
ip addr flush dev ${N}
ip addr add ${address}/${netmask:-"255.255.255.0"} dev ${N}
ip addr flush dev "${N}"
ip addr add "${address}/${netmask:-"255.255.255.0"}" dev "${N}"
if [ -n "${gateway}" ]; then
ip route add default via ${gateway} dev ${N}
ip route add default via "${gateway}" dev "${N}"
fi
if [ -n "${dnsname:-${gateway}}" ]; then
sed -i "/nameserver ${dnsname:-${gateway}}/d" /etc/resolv.conf
@@ -1454,6 +1455,7 @@ function downgradeMenu() {
(
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
[ -f "${TMP_PATH}/mdX/etc/VERSION" ] && rm -f "${TMP_PATH}/mdX/etc/VERSION" >/dev/null
@@ -1463,7 +1465,7 @@ function downgradeMenu() {
done
rm -rf "${TMP_PATH}/mdX" >/dev/null
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Allow Downgrade" \
--progressbox "Removing ..." 20 70
--progressbox "Removing Version lock..." 20 70
dialog --backtitle "$(backtitle)" --title "Allow Downgrade" \
--msgbox "Allow Downgrade Settings completed." 0 0
return
@@ -1481,6 +1483,7 @@ function resetPassword() {
rm -f "${TMP_PATH}/menu" >/dev/null
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
if [ -f "${TMP_PATH}/mdX/etc/shadow" ]; then
@@ -1523,6 +1526,7 @@ function resetPassword() {
(
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
sed -i "s|^${USER}:[^:]*|${USER}:${NEWPASSWD}|" "${TMP_PATH}/mdX/etc/shadow"
@@ -1553,8 +1557,8 @@ function addNewDSMUser() {
--form "${MSG}" 8 60 3 "username:" 1 1 "user" 1 10 50 0 "password:" 2 1 "passwd" 2 10 50 0 \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return
username="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
password="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
username="$(sed -n '1p' "${TMP_PATH}/resp" 2>/dev/null)"
password="$(sed -n '2p' "${TMP_PATH}/resp" 2>/dev/null)"
(
ONBOOTUP=""
ONBOOTUP="${ONBOOTUP}if synouser --enum local | grep -q ^${username}\$; then synouser --setpw ${username} ${password}; else synouser --add ${username} ${password} arc 0 user@arc.arc 1; fi\n"
@@ -1563,6 +1567,7 @@ function addNewDSMUser() {
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
if [ -f "${TMP_PATH}/mdX/usr/syno/etc/esynoscheduler/esynoscheduler.db" ]; then
@@ -1599,10 +1604,24 @@ function loaderPassword() {
RDXZ_PATH="${TMP_PATH}/rdxz_tmp"
rm -rf "${RDXZ_PATH}"
mkdir -p "${RDXZ_PATH}"
[ -f "${ARC_RAMDISK_USER_FILE}" ] && (
cd "${RDXZ_PATH}"
xz -dc <"${ARC_RAMDISK_USER_FILE}" | cpio -idm
) >/dev/null 2>&1 || true
if [ -f "${ARC_RAMDISK_USER_FILE}" ]; then
INITRD_FORMAT=$(file -b --mime-type "${ARC_RAMDISK_USER_FILE}")
(
cd "${RDXZ_PATH}"
case "${INITRD_FORMAT}" in
*'x-cpio'*) cpio -idm <"${ARC_RAMDISK_USER_FILE}" ;;
*'x-xz'*) xz -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'x-lz4'*) lz4 -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'x-lzma'*) lzma -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'x-bzip2'*) bzip2 -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'gzip'*) gzip -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'zstd'*) zstd -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*) ;;
esac
) >/dev/null 2>&1 || true
else
INITRD_FORMAT="application/zstd"
fi
if [ "${STRPASSWD:-arc}" = "arc" ]; then
rm -f ${RDXZ_PATH}/etc/shadow* 2>/dev/null
else
@@ -1612,8 +1631,17 @@ function loaderPassword() {
if [ -n "$(ls -A "${RDXZ_PATH}" 2>/dev/null)" ] && [ -n "$(ls -A "${RDXZ_PATH}/etc" 2>/dev/null)" ]; then
(
cd "${RDXZ_PATH}"
RDSIZE=$(du -sb ${RDXZ_PATH} 2>/dev/null | awk '{print $1}')
find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | xz -9 --check=crc32 >"${ARC_RAMDISK_USER_FILE}"
local RDSIZE=$(du -sb ${RDXZ_PATH} 2>/dev/null | awk '{print $1}')
case "${INITRD_FORMAT}" in
*'x-cpio'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} >"${RR_RAMUSER_FILE}" ;;
*'x-xz'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | xz -9 -C crc32 -c - >"${RR_RAMUSER_FILE}" ;;
*'x-lz4'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | lz4 -9 -l -c - >"${RR_RAMUSER_FILE}" ;;
*'x-lzma'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | lzma -9 -c - >"${RR_RAMUSER_FILE}" ;;
*'x-bzip2'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | bzip2 -9 -c - >"${RR_RAMUSER_FILE}" ;;
*'gzip'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | gzip -9 -c - >"${RR_RAMUSER_FILE}" ;;
*'zstd'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | zstd -19 -T0 -f -c - >"${RR_RAMUSER_FILE}" ;;
*) ;;
esac
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Loader Password" \
--progressbox "Changing Loader password..." 30 100
else
@@ -1640,9 +1668,9 @@ function loaderPorts() {
RET=$?
case ${RET} in
0) # ok-button
HTTPPORT=$(sed -n '1p' "${TMP_PATH}/resp")
DUFSPORT=$(sed -n '2p' "${TMP_PATH}/resp")
TTYDPORT=$(sed -n '3p' "${TMP_PATH}/resp")
HTTP=$(sed -n '1p' "${TMP_PATH}/resp" 2>/dev/null)
DUFS=$(sed -n '2p' "${TMP_PATH}/resp" 2>/dev/null)
TTYD=$(sed -n '3p' "${TMP_PATH}/resp" 2>/dev/null)
EP=""
for P in "${HTTPPORT}" "${DUFSPORT}" "${TTYDPORT}"; do check_port "${P}" || EP="${EP} ${P}"; done
if [ -n "${EP}" ]; then
@@ -1651,16 +1679,30 @@ function loaderPorts() {
[ $? -eq 0 ] && continue || break
fi
rm -f "/etc/arc.conf"
if [ ! "${HTTPPORT:-8080}" = "8080" ]; then echo "HTTP_PORT=${HTTPPORT}" >>"/etc/arc.conf"; /etc/init.d/S90thttpd restart >/dev/null 2>&1; fi
if [ ! "${DUFSPORT:-7304}" = "7304" ]; then echo "DUFS_PORT=${DUFSPORT}" >>"/etc/arc.conf"; /etc/init.d/S99dufs restart >/dev/null 2>&1; fi
if [ ! "${TTYDPORT:-7681}" = "7681" ]; then echo "TTYD_PORT=${TTYDPORT}" >>"/etc/arc.conf"; /etc/init.d/S99ttyd restart >/dev/null 2>&1; fi
[ ! "${HTTPPORT:-8080}" = "8080" ] && (echo "HTTP_PORT=${HTTPPORT}" >>"/etc/arc.conf"; /etc/init.d/S90thttpd restart >/dev/null 2>&1)
[ ! "${DUFSPORT:-7304}" = "7304" ] && (echo "DUFS_PORT=${DUFSPORT}" >>"/etc/arc.conf"; /etc/init.d/S99dufs restart >/dev/null 2>&1)
[ ! "${TTYDPORT:-7681}" = "7681" ] && (echo "TTYD_PORT=${TTYDPORT}" >>"/etc/arc.conf"; /etc/init.d/S99ttyd restart >/dev/null 2>&1)
RDXZ_PATH="${TMP_PATH}/rdxz_tmp"
rm -rf "${RDXZ_PATH}"
mkdir -p "${RDXZ_PATH}"
[ -f "${ARC_RAMDISK_USER_FILE}" ] && (
cd "${RDXZ_PATH}"
xz -dc <"${ARC_RAMDISK_USER_FILE}" | cpio -idm
) >/dev/null 2>&1 || true
if [ -f "${ARC_RAMDISK_USER_FILE}" ]; then
INITRD_FORMAT=$(file -b --mime-type "${ARC_RAMDISK_USER_FILE}")
(
cd "${RDXZ_PATH}"
case "${INITRD_FORMAT}" in
*'x-cpio'*) cpio -idm <"${ARC_RAMDISK_USER_FILE}" ;;
*'x-xz'*) xz -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'x-lz4'*) lz4 -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'x-lzma'*) lzma -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'x-bzip2'*) bzip2 -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'gzip'*) gzip -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*'zstd'*) zstd -dc "${ARC_RAMDISK_USER_FILE}" | cpio -idm ;;
*) ;;
esac
) >/dev/null 2>&1 || true
else
INITRD_FORMAT="application/zstd"
fi
if [ ! -f "/etc/arc.conf" ]; then
rm -f "${RDXZ_PATH}/etc/arc.conf" 2>/dev/null
else
@@ -1670,8 +1712,17 @@ function loaderPorts() {
if [ -n "$(ls -A "${RDXZ_PATH}" 2>/dev/null)" ] && [ -n "$(ls -A "${RDXZ_PATH}/etc" 2>/dev/null)" ]; then
(
cd "${RDXZ_PATH}"
RDSIZE=$(du -sb ${RDXZ_PATH} 2>/dev/null | awk '{print $1}')
find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | xz -9 --check=crc32 >"${ARC_RAMDISK_USER_FILE}"
local RDSIZE=$(du -sb ${RDXZ_PATH} 2>/dev/null | awk '{print $1}')
case "${INITRD_FORMAT}" in
*'x-cpio'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} >"${ARC_RAMDISK_USER_FILE}" ;;
*'x-xz'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | xz -9 -C crc32 -c - >"${ARC_RAMDISK_USER_FILE}" ;;
*'x-lz4'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | lz4 -9 -l -c - >"${ARC_RAMDISK_USER_FILE}" ;;
*'x-lzma'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | lzma -9 -c - >"${ARC_RAMDISK_USER_FILE}" ;;
*'x-bzip2'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | bzip2 -9 -c - >"${ARC_RAMDISK_USER_FILE}" ;;
*'gzip'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | gzip -9 -c - >"${ARC_RAMDISK_USER_FILE}" ;;
*'zstd'*) find . 2>/dev/null | cpio -o -H newc -R root:root | pv -n -s ${RDSIZE:-1} | zstd -19 -T0 -f -c - >"${ARC_RAMDISK_USER_FILE}" ;;
*) ;;
esac
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Loader Ports" \
--progressbox "Changing Ports..." 30 100
else
@@ -1706,6 +1757,7 @@ function disablescheduledTasks {
(
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
if [ -f "${TMP_PATH}/mdX/usr/syno/etc/esynoscheduler/esynoscheduler.db" ]; then
@@ -1742,14 +1794,12 @@ function bootipwaittime() {
# let user format disks from inside arc
function formatDisks() {
rm -f "${TMP_PATH}/opts"
while read -r KNAME SIZE TYPE PKNAME; do
[ -z "${KNAME}" ] && continue
[ "${KNAME}" = "N/A" ] && continue
[[ "${KNAME}" = /dev/md* ]] && continue
[[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue
[ -z "${SIZE}" ] && SIZE="Unknown"
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts"
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
while read -r KNAME SIZE TYPE MODEL PKNAME; do
[ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue
[ "${KNAME:0:7}" = "/dev/md" ] && continue
[ "${KNAME}" = "${LOADER_DISK}" ] || [ "${PKNAME}" = "${LOADER_DISK}" ] && continue
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${MODEL}" >>"${TMP_PATH}/opts"
done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model) \(.pkname)"' 2>/dev/null)
if [ ! -f "${TMP_PATH}/opts" ]; then
dialog --backtitle "$(backtitle)" --title "Format Disks" \
--msgbox "No disk found!" 0 0
@@ -1759,20 +1809,20 @@ function formatDisks() {
--checklist "Select Disks" 0 0 0 --file "${TMP_PATH}/opts" \
2>${TMP_PATH}/resp
[ $? -ne 0 ] && return
RESP=$(cat "${TMP_PATH}/resp")
[ -z "${RESP}" ] && return
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return
dialog --backtitle "$(backtitle)" --title "Format Disks" \
--yesno "Warning:\nThis operation is irreversible. Please backup important data. Do you want to continue?" 0 0
[ $? -ne 0 ] && return
if [ $(ls /dev/md[0-9]* 2>/dev/null | wc -l) -gt 0 ]; then
dialog --backtitle "$(backtitle)" --title "Format Disks" \
--yesno "Warning:\nThe current hds is in raid, do you still want to format them?" 0 0
--yesno "Warning:\nThe current disks are in raid, do you still want to format them?" 0 0
[ $? -ne 0 ] && return
for I in $(ls /dev/md[0-9]* 2>/dev/null); do
mdadm -S "${I}" >/dev/null 2>&1
done
fi
for I in ${RESP}; do
for I in ${resp}; do
if [[ "${I}" = /dev/mmc* ]]; then
echo y | mkfs.ext4 -T largefile4 -E nodiscard "${I}"
else
@@ -1786,18 +1836,16 @@ function formatDisks() {
}
###############################################################################
# Clone Loader Disk
# Clone bootloader disk
function cloneLoader() {
rm -f "${TMP_PATH}/opts" >/dev/null
while read -r KNAME SIZE TYPE PKNAME; do
[ -z "${KNAME}" ] && continue
[ "${KNAME}" = "N/A" ] && continue
[ "${TYPE}" != "disk" ] && continue
[[ "${KNAME}" = /dev/md* ]] && continue
[[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue
[ -z "${SIZE}" ] && SIZE="Unknown"
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts"
done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null)
rm -f "${TMP_PATH}/opts" 2>/dev/null
while read -r KNAME SIZE TYPE MODEL PKNAME; do
[ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue
[ "${KNAME:0:7}" = "/dev/md" ] && continue
[ "${KNAME}" = "${LOADER_DISK}" ] || [ "${PKNAME}" = "${LOADER_DISK}" ] && continue
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${MODEL}" >>"${TMP_PATH}/opts"
done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model) \(.pkname)"' 2>/dev/null)
if [ ! -f "${TMP_PATH}/opts" ]; then
dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
--msgbox "No disk found!" 0 0
@@ -1826,36 +1874,80 @@ function cloneLoader() {
[ $? -ne 0 ] && return
fi
(
rm -rf "${PART3_PATH}/dl" >/dev/null
CLEARCACHE=0
gzip -dc "${ARC_PATH}/grub.img.gz" | dd of="${resp}" bs=1M conv=fsync status=progress
hdparm -z "${resp}" # reset disk cache
fdisk -l "${resp}"
sleep 3
sleep 1
mkdir -p "${TMP_PATH}/sdX1"
mount "$(lsblk "${resp}" -pno KNAME,LABEL 2>/dev/null | grep ARC1 | awk '{print $1}')" "${TMP_PATH}/sdX1"
cp -vRf "${PART1_PATH}/". "${TMP_PATH}/sdX1/"
sync
umount "${TMP_PATH}/sdX1"
NEW_BLDISK_P1="$(lsblk "${resp}" -pno KNAME,LABEL 2>/dev/null | grep 'ARC1' | awk '{print $1}')"
NEW_BLDISK_P2="$(lsblk "${resp}" -pno KNAME,LABEL 2>/dev/null | grep 'ARC2' | awk '{print $1}')"
NEW_BLDISK_P3="$(lsblk "${resp}" -pno KNAME,LABEL 2>/dev/null | grep 'ARC3' | awk '{print $1}')"
SIZEOFDISK=$(cat /sys/block/${resp/\/dev\//}/size)
ENDSECTOR=$(($(fdisk -l ${resp} | grep "${NEW_BLDISK_P3}" | awk '{print $3}') + 1))
mkdir -p "${TMP_PATH}/sdX2"
mount "$(lsblk "${resp}" -pno KNAME,LABEL 2>/dev/null | grep ARC2 | awk '{print $1}')" "${TMP_PATH}/sdX2"
cp -vRf "${PART2_PATH}/". "${TMP_PATH}/sdX2/"
sync
umount "${TMP_PATH}/sdX2"
if [ ${SIZEOFDISK}0 -ne ${ENDSECTOR}0 ]; then
echo -e "\033[1;36mResizing ${NEW_BLDISK_P3}\033[0m"
echo -e "d\n\nn\n\n\n\n\nn\nw" | fdisk "${resp}" >/dev/null 2>&1
resize2fs "${NEW_BLDISK_P3}"
fdisk -l "${resp}"
sleep 1
fi
mkdir -p "${TMP_PATH}/sdX3"
mount "$(lsblk "${resp}" -pno KNAME,LABEL 2>/dev/null | grep ARC3 | awk '{print $1}')" "${TMP_PATH}/sdX3"
cp -vRf "${PART3_PATH}/". "${TMP_PATH}/sdX3/"
mkdir -p "${TMP_PATH}/sdX1" "${TMP_PATH}/sdX2" "${TMP_PATH}/sdX3"
mount "${NEW_BLDISK_P1}" "${TMP_PATH}/sdX1" || {
printf "Can't mount %s." "${NEW_BLDISK_P1}" >"${LOG_FILE}"
__umountNewBlDisk
break
}
mount "${NEW_BLDISK_P2}" "${TMP_PATH}/sdX2" || {
printf "Can't mount %s." "${NEW_BLDISK_P2}" >"${LOG_FILE}"
__umountNewBlDisk
break
}
mount "${NEW_BLDISK_P3}" "${TMP_PATH}/sdX3" || {
printf "Can't mount %s." "${NEW_BLDISK_P3}" >"${LOG_FILE}"
__umountNewBlDisk
break
}
SIZEOLD1="$(du -sm "${PART1_PATH}" 2>/dev/null | awk '{print $1}')"
SIZEOLD2="$(du -sm "${PART2_PATH}" 2>/dev/null | awk '{print $1}')"
SIZEOLD3="$(du -sm "${PART3_PATH}" 2>/dev/null | awk '{print $1}')"
SIZENEW1="$(df -m "${NEW_BLDISK_P1}" 2>/dev/null | awk 'NR==2 {print $4}')"
SIZENEW2="$(df -m "${NEW_BLDISK_P2}" 2>/dev/null | awk 'NR==2 {print $4}')"
SIZENEW3="$(df -m "${NEW_BLDISK_P3}" 2>/dev/null | awk 'NR==2 {print $4}')"
if [ ${SIZEOLD1:-0} -ge ${SIZENEW1:-0} ] || [ ${SIZEOLD2:-0} -ge ${SIZENEW2:-0} ] || [ ${SIZEOLD3:-0} -ge ${SIZENEW3:-0} ]; then
MSG="Cloning failed due to insufficient remaining disk space on the selected hard drive."
echo "${MSG}" >"${LOG_FILE}"
__umountNewBlDisk
break
fi
cp -vRf "${PART1_PATH}/". "${TMP_PATH}/sdX1/" || {
printf "Can't copy to %s." "${NEW_BLDISK_P1}" >"${LOG_FILE}"
__umountNewBlDisk
break
}
cp -vRf "${PART2_PATH}/". "${TMP_PATH}/sdX2/" || {
printf "Can't copy to %s." "${NEW_BLDISK_P2}" >"${LOG_FILE}"
__umountNewBlDisk
break
}
cp -vRf "${PART3_PATH}/". "${TMP_PATH}/sdX3/" || {
printf "Can't copy to %s." "${NEW_BLDISK_P3}" >"${LOG_FILE}"
__umountNewBlDisk
break
}
sync
umount "${TMP_PATH}/sdX3"
__umountNewBlDisk
sleep 3
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
--progressbox "Cloning ..." 20 100
dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
--msgbox "Bootloader has been cloned to disk ${resp},\nplease remove the current bootloader disk!\nReboot?" 0 0
--msgbox "Bootloader has been cloned to Disk ${resp},\nremove the current Bootloader Disk!\nReboot?" 0 0
rebootTo config
return
}
@@ -1869,7 +1961,8 @@ function resetLoader() {
fi
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}" >/dev/null
[ -f "${USER_CONFIG_FILE}" ] && rm -f "${USER_CONFIG_FILE}" >/dev/null
dialog --backtitle "$(backtitle)" --title "Reset Loader" --aspect 18 \
[ -f "${ARC_RAMDISK_USER_FILE}" ] && rm -f "${ARC_RAMDISK_USER_FILE}" >/dev/null
dialog --backtitle "$(backtitle)" --title "Reset Loader" --aspect 18 \
--yesno "Reset successful.\nReboot required!" 0 0
[ $? -ne 0 ] && return
rebootTo config
@@ -1898,6 +1991,7 @@ function greplogs() {
if [ -n "${DSMROOTS}" ]; then
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
mkdir -p "${TMP_PATH}/logs/md0/log"
@@ -1906,7 +2000,7 @@ function greplogs() {
SYSLOG=1
umount "${TMP_PATH}/mdX"
done
rm -rf "${TMP_PATH}/mdX"
rm -rf "${TMP_PATH}/mdX" >/dev/null
fi
if [ ${SYSLOG} -eq 1 ]; then
MSG+="System logs found!\n"
@@ -1934,7 +2028,7 @@ function greplogs() {
tar -czf "${TMP_PATH}/logs.tar.gz" -C "${TMP_PATH}" logs
if [ -z "${SSH_TTY}" ]; then # web
mv -f "${TMP_PATH}/logs.tar.gz" "/var/www/data/logs.tar.gz"
URL="http://$(getIP)/logs.tar.gz"
URL="http://${IPCON}/logs.tar.gz"
MSG+="Please via ${URL} to download the logs,\nAnd go to Github or Discord to create an issue and upload the logs."
else
sz -be -B 536870912 "${TMP_PATH}/logs.tar.gz"
@@ -1955,7 +2049,7 @@ function getbackup() {
if [ -z "${SSH_TTY}" ]; then # web
mv -f "${TMP_PATH}/dsmconfig.tar.gz" "/var/www/data/dsmconfig.tar.gz"
chmod 644 "/var/www/data/dsmconfig.tar.gz"
URL="http://$(getIP)/dsmconfig.tar.gz"
URL="http://${IPCON}/dsmconfig.tar.gz"
dialog --backtitle "$(backtitle)" --colors --title "DSM Config" \
--msgbox "Please via ${URL}\nto download the dsmconfig and unzip it and back it up in order by file name." 0 0
else
@@ -2057,6 +2151,7 @@ function resetDSMNetwork {
(
mkdir -p "${TMP_PATH}/mdX"
for I in ${DSMROOTS}; do
# fixDSMRootPart "${I}"
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
[ $? -ne 0 ] && continue
rm -f "${TMP_PATH}/mdX/etc.defaults/sysconfig/network-scripts/ifcfg-bond"* "${TMP_PATH}/mdX/etc.defaults/sysconfig/network-scripts/ifcfg-eth"*
@@ -2281,14 +2376,14 @@ function genHardwareID() {
if echo "${USERID}" | grep -vq "Hardware ID"; then
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--msgbox "HardwareID: ${HWID}\nYour HardwareID is registered to UserID: ${USERID}!" 6 70
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
break
else
dialog --backtitle "$(backtitle)" --title "HardwareID" \
--yes-label "Retry" --no-label "Cancel" --yesno "HardwareID: ${HWID}\nRegister your HardwareID on\nhttps://arc.auxxxilium.tech (Discord Account needed).\nPress Retry after you registered it." 8 60
[ $? -ne 0 ] && USERID="" && break
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
[ $? -ne 0 ] && break
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
fi
done
@@ -2303,18 +2398,18 @@ function checkHardwareID() {
[ ! -f "${S_FILE}.bak" ] && cp -f "${S_FILE}" "${S_FILE}.bak" 2>/dev/null || true
if echo "${USERID}" | grep -vq "Hardware ID"; then
if curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" -o "${S_FILE}" 2>/dev/null; then
writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "${HWID}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null
[ -f "${S_FILE}.bak" ] && mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null
fi
else
USERID=""
writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"
mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null
[ -f "${S_FILE}.bak" ] && mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null
fi
return
}

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}")"
@@ -89,11 +88,7 @@ function backtitlep() {
# Model Selection
function arcModel() {
STEP="model"
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs
else
checkHardwareID
fi
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
dialog --backtitle "$(backtitlep)" --title "Model" \
--infobox "Reading Models..." 3 25
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
@@ -125,9 +120,9 @@ function arcModel() {
[ "${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}" = "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}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
[[ "${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
@@ -248,8 +243,8 @@ function arcVersion() {
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)
@@ -286,8 +281,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
@@ -369,6 +364,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
@@ -410,12 +408,12 @@ 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
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 [ "${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}"
elif [ "${ARCMODE}" = "config" ]; then
dialog --clear --backtitle "$(backtitlep)" \
--nocancel --title "SN/Mac Options"\
@@ -477,12 +475,14 @@ 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 [ "${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}")"
@@ -490,7 +490,7 @@ function arcSettings() {
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
@@ -531,7 +531,7 @@ function arcSettings() {
fi
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
@@ -712,7 +712,7 @@ function make() {
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
@@ -803,8 +803,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
}
@@ -819,7 +818,7 @@ if [ "${ARCMODE}" = "update" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Update" \
--infobox "Update is not possible in Offline Mode!" 5 40
sleep 3
reboot
exec reboot
fi
elif [ "${ARCMODE}" = "automated" ]; then
# Check for Custom Build
@@ -832,21 +831,21 @@ else
[ "${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
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"
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"
@@ -854,7 +853,7 @@ else
echo "4 \"\Z1Show Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${ARCOPTS}" = "true" ]; then
echo "= \"\Z4==== Arc DSM ====\Zn \" " >>"${TMP_PATH}/menu"
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"
@@ -874,6 +873,14 @@ else
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "sequentialio"; then
echo "Q \"SequentialIO Options \" " >>"${TMP_PATH}/menu"
fi
if [ "${PLATFORM}" = "epyc7002" ]; then
echo "K \"Kernel: \Z4${KERNEL}\Zn \" " >>"${TMP_PATH}/menu"
fi
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"
@@ -881,8 +888,8 @@ 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 "= \"\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"
@@ -895,26 +902,17 @@ else
echo "7 \"\Z1Show DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" = "true" ]; then
echo "= \"\Z4===== DSM =====\Zn \" " >>"${TMP_PATH}/menu"
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 "t \"Change User Password \" " >>"${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
echo "K \"Kernel: \Z4${KERNEL}\Zn \" " >>"${TMP_PATH}/menu"
fi
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
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
@@ -923,24 +921,25 @@ 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"
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"
@@ -1021,8 +1020,7 @@ 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
@@ -1074,14 +1072,16 @@ else
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
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}")"
@@ -1095,7 +1095,6 @@ else
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,7 +3,7 @@
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
@@ -15,8 +15,8 @@ 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
@@ -102,6 +102,20 @@ 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
@@ -150,21 +164,28 @@ 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['no_console_suspend']="1"
CMDLINE['root']="/dev/md0"
CMDLINE['rootwait']=""
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"]="disable"
[ $(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['intremap']="no_x2apic_optout"
# CMDLINE['split_lock_detect']="off" # no need
# 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']+=","
@@ -186,15 +207,15 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
CMDLINE["SASmodel"]="1"
fi
# Cmdline NIC Settings
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
# 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}
[ -z "${ETHM}" ] && ETHM="${ETHN}"
NIC=0
for N in ${ETHX}; do
MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:lower:]' '[:upper:]')" || NIC=$((${NIC} + 1))
[ -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
@@ -220,28 +241,6 @@ 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
@@ -275,8 +274,8 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
break
fi
COUNT=$((${COUNT} + 1))
IP="$(getIP ${N})"
COUNT=$((COUNT + 1))
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
@@ -304,16 +303,25 @@ elif [ "${DIRECTBOOT}" = "false" ]; 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,5 +334,6 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -e "\033[1;37mBooting DSM...\033[0m"
# Boot to DSM
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff
exit 0
fi
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

@@ -7,28 +7,22 @@
# 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
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/0x\1 0x\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%% *})
read -r sizeA offsetA sizeB offsetB <<<$(echo ${OUT} | awk '{printf "%d %d %d %d", strtonum($1), strtonum($2), strtonum($3), strtonum($4)}')
run_size=$((${offsetA} + ${sizeA} + ${sizeB}))
runSize=$((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
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
@@ -38,5 +32,5 @@ if [ "${offsetA}" -ne "${offsetB}" ]; then
fi
fi
printf "%d\n" ${run_size}
printf "%d\n" ${runSize}
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

@@ -1,8 +1,8 @@
[[ -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
@@ -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
}
@@ -229,7 +229,7 @@ function _set_conf_kv() {
# sort netif busid
function _sort_netif() {
local ETHLIST=""
local ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
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)"
@@ -277,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}"
@@ -493,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
[ $(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)" || NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "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
}
@@ -580,4 +586,52 @@ function check_port() {
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 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
}
###############################################################################
# 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

@@ -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

View File

@@ -1,6 +1,6 @@
# Get Network Config for Loader
function getnet() {
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | 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)"
@@ -21,16 +21,16 @@ function getnet() {
# User Mac
for N in ${ETHX}; do
while true; do
MAC="$(cat /sys/class/net/${N}/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!" 7 50\
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
MAC=$(cat "${TMP_PATH}/resp")
[ -z "${MAC}" ] && MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
MAC="$(echo "${MAC}" | tr '[:lower:]' '[:upper:]')"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')"
MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')"
if [ ${#MAC} -eq 12 ]; then
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Set Mac for ${N} to ${MAC}!" 5 50
writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}"
break
else
@@ -42,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,52 +2,50 @@
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 | 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
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::107 | 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)
@@ -57,7 +55,7 @@ function getmap() {
fi
# SCSI Disks
SCSIDRIVES=0
if [ $(lspci -d ::100 | wc -l) -gt 0 ]; then
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::100 | 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)
@@ -67,7 +65,7 @@ function getmap() {
fi
# Raid Disks
RAIDDRIVES=0
if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::104 | 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)
@@ -77,7 +75,7 @@ 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
if [ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::c03 | 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)
@@ -88,7 +86,7 @@ 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/\ .*://")
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null)
@@ -98,7 +96,7 @@ function getmap() {
fi
# NVMe Disks
NVMEDRIVES=0
if [ $(lspci -d ::108 | wc -l) -gt 0 ]; then
if [ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::108 | 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)

View File

@@ -26,27 +26,28 @@ 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
$/ = "\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
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--infobox "Updating Loader..." 3 50
if unzip -oq "${TMP_PATH}/update.zip" -d "/mnt"; 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
@@ -72,16 +73,16 @@ function updateLoader() {
[ -n "${ARCCONF}" ] && cp -f "${TMP_PATH}/bak.yml" "${S_FILE}"
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 +103,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 +134,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 +163,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
$/ = "\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 +187,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 +216,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
$/ = "\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 +240,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
@@ -271,28 +275,29 @@ function updateModules() {
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
$/ = "\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
@@ -338,21 +343,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
$/ = "\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,7 +366,7 @@ 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
@@ -394,21 +400,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
$/ = "\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}"
@@ -417,7 +424,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
@@ -463,11 +470,11 @@ function dependenciesUpdate() {
[ $? -ne 0 ] && FAILED="true"
if [ "${FAILED}" = "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update failed! Try again later." 3 40
--infobox "Update Dependencies failed! Try again later." 3 40
sleep 3
elif [ "${FAILED}" = "false" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update successful!" 3 40
--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
@@ -40,6 +38,8 @@ initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.dynamic" "false" "${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}"
@@ -95,27 +95,27 @@ if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}");
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
fi
# Read/Write IP/Mac to config
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
for N in ${ETHX}; do
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
IFS='/' read -r -a IPRA <<<"${IPR}"
ip addr flush dev ${N}
ip addr add ${IPRA[0]}/${IPRA[1]:-"255.255.255.0"} dev ${N}
if [ -n "${IPRA[2]}" ]; then
ip route add default via ${IPRA[2]} dev ${N}
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
for N in ${ETHX}; do
MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
IFS='/' read -r -a IPRA <<<"${IPR}"
ip addr flush dev "${N}"
ip addr add "${IPRA[0]}/${IPRA[1]:-"255.255.255.0"}" dev "${N}"
if [ -n "${IPRA[2]}" ]; then
ip route add default via "${IPRA[2]}" dev "${N}"
fi
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
fi
sleep 1
fi
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
echo "nameserver ${IPRA[3]:-${IPRA[2]}}" >>/etc/resolv.conf
fi
sleep 1
fi
[ "${N::3}" = "eth" ] && ethtool -s ${N} wol g 2>/dev/null || true
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
done
[ "${N::3}" = "eth" ] && ethtool -s "${N}" wol g 2>/dev/null || true
# [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true
initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}"
done
ETHN=$(echo ${ETHX} | wc -w)
writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
# No network devices
@@ -154,11 +154,7 @@ elif [ "${ARCMODE}" = "update" ]; then
echo -e "\033[1;34mStarting Update Mode...\033[0m"
elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then
echo -e "\033[1;34mStarting DSM Mode...\033[0m"
if [ -f "${ARC_PATH}/boot.sh" ]; then
exec 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
@@ -179,8 +175,8 @@ for N in ${ETHX}; do
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
break
fi
COUNT=$((${COUNT} + 1))
IP="$(getIP ${N})"
COUNT=$((COUNT + 1))
IP="$(getIP "${N}")"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
@@ -212,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
@@ -222,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

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
@@ -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
@@ -149,20 +149,22 @@ 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

View File

@@ -3,7 +3,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"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
@@ -14,61 +14,51 @@ KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver"
# 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
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}" | 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
else
# Kernel version 5.x
gzip -dc "${ARC_PATH}/bzImage-template-v5.gz" >"${ZIMAGE_MOD}" || exit 1
@@ -76,7 +66,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}" | 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
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
@@ -23,11 +23,11 @@ if [ "${KERNEL}" = "custom" ]; then
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

@@ -12,7 +12,6 @@ insmod fat
insmod ext2
insmod ata
insmod btrfs
insmod ntfs
insmod part_msdos
insmod part_gpt
@@ -78,7 +77,7 @@ 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 nomodeset intremap=no_x2apic_optout net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=passive amd_pstate=passive"
search --set=root --label "ARC3"
if [ -s /zImage-dsm -a -s /initrd-dsm ]; then

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,8 +36,6 @@ 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'`"
ARC_VERSION="13.37.dev"
ARC_BRANCH="next"
@@ -45,9 +44,14 @@ 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,8 +35,6 @@ 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'`"
ARC_VERSION="13.37.dev"
ARC_BRANCH="stable"
@@ -45,9 +43,14 @@ 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

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,99 @@ 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}"
}
function createvmc() {
cat <<_EOF_ >"${1:-arc.vmc}"
<?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">arc.vhd</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"
}