Compare commits

..

3 Commits

Author SHA1 Message Date
AuxXxilium
7f6b276a59 Merge pull request #4565 from AuxXxilium/dev
arc-functions: make hwid unique
2024-11-10 18:46:14 +01:00
AuxXxilium
23ba1abd70 Merge pull request #4563 from AuxXxilium/dev
Dev
2024-11-10 18:36:00 +01:00
AuxXxilium
d53d454828 Merge pull request #4553 from AuxXxilium/dev
build: update
2024-11-10 11:10:10 +01:00
23 changed files with 872 additions and 1108 deletions

View File

@@ -11,7 +11,7 @@ on:
workflow_dispatch:
inputs:
runs:
description: "runs-on"
description: "runs-on (ubuntu-latest / self-hosted)"
type: choice
options:
- ubuntu-latest
@@ -38,26 +38,22 @@ jobs:
# Install Dependencies
- name: Install Dependencies
if: ${{ inputs.runs == 'ubuntu-latest' }}
if: ${{ github.event.inputs.runs == 'ubuntu-latest' }}
run: |
git config --global user.email "info@auxxxilium.tech"
git config --global user.name "AuxXxilium"
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
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
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
sudo snap install yq
df -h
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get Buildroot
run: |
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
. scripts/func.sh
echo "Get Dependencies"
getAddons "files/p3/addons"
@@ -87,13 +83,13 @@ jobs:
# Build incremental
- name: Build Next Image
if: ${{ inputs.next == true }}
if: inputs.next == true
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}-dev"
ARC_BUILD="`date +'%y%m%d'`-dev"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="next"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
@@ -120,6 +116,7 @@ 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"
@@ -136,13 +133,12 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
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
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
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
# Zip image and generate checksum
- name: Pack Next Image
if: ${{ inputs.next == true }}
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
@@ -159,13 +155,13 @@ jobs:
# Build incremental
- name: Build Stable Image
if: ${{ inputs.stable }}
if: inputs.stable == true
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}-dev"
ARC_BUILD="`date +'%y%m%d'`-dev"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="stable"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
@@ -209,13 +205,12 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
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
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
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
# Zip image and generate checksum
- name: Pack Stable Image
if: ${{ inputs.stable }}
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
@@ -239,8 +234,7 @@ jobs:
- Development Build
### Information:
- Full Changelog is available in my Discord
- Discord Account for Arc Patch needed
- Full Changelog and Arc Patch (Decryption Key) are available in my Discord.
### Dependencies:
- Addons: ${{ env.ADDONTAG }}

View File

@@ -11,7 +11,7 @@ on:
workflow_dispatch:
inputs:
runs:
description: "runs-on"
description: "runs-on (ubuntu-latest / self-hosted)"
type: choice
options:
- ubuntu-latest
@@ -53,7 +53,7 @@ jobs:
uses: actions/checkout@main
- name: Delete releases and workflows runs
if: ${{ inputs.clean == true }}
if: ${{ inputs.clean }} == 'true'
uses: ophub/delete-releases-workflows@main
with:
delete_releases: true
@@ -64,26 +64,22 @@ jobs:
# Install Dependencies
- name: Install Dependencies
if: ${{ inputs.runs == 'ubuntu-latest' }}
if: ${{ github.event.inputs.runs == 'ubuntu-latest' }}
run: |
git config --global user.email "info@auxxxilium.tech"
git config --global user.name "AuxXxilium"
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
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
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
sudo snap install yq
df -h
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get Dependencies for all Image
run: |
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
. scripts/func.sh
echo "Get Dependencies"
getAddons "files/p3/addons"
@@ -94,7 +90,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
@@ -113,7 +109,7 @@ jobs:
# Build incremental
- name: Build Next Image
if: ${{ inputs.next == true }}
if: inputs.next == true
run: |
. scripts/func.sh
@@ -146,6 +142,7 @@ 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"
@@ -162,16 +159,16 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
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
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
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
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack Next Image
if: ${{ inputs.next == true }}
if: inputs.next == true
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
@@ -189,7 +186,7 @@ jobs:
# Build incremental
- name: Build Stable Image
if: ${{ inputs.stable == true }}
if: inputs.stable == true
run: |
. scripts/func.sh
@@ -239,16 +236,16 @@ jobs:
sudo losetup --detach ${LOOPX}
echo "Image Converter"
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
qemu-img convert -p -f raw -O vhdx ${IMAGE_FILE} arc.vhdx
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
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack Stable Image
if: ${{ inputs.stable == true }}
if: inputs.stable == true
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
@@ -273,8 +270,7 @@ jobs:
- ${{ inputs.notice }}
### Information:
- Full Changelog is available in my Discord
- Discord Account for Arc Patch needed
- Full Changelog and Arc Patch (Decryption Key) are available in my Discord.
### Versions:
- stable: Stable Image (Full Image, all dependencies are included, less hardware support)

File diff suppressed because it is too large Load Diff

View File

@@ -4,14 +4,14 @@
# 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
onlineCheck
@@ -69,19 +69,19 @@ function backtitle() {
BACKTITLE+="Build: ${BUILDDONE} | "
BACKTITLE+="${MACHINE}(${BUS}) | "
[ -n "${KEYMAP}" ] && BACKTITLE+="KB: ${KEYMAP}"
[ "${ARCOFFLINE}" = "true" ] && BACKTITLE+=" | Offline"
[ "${ARCOFFLINE}" == "true" ] && BACKTITLE+=" | Offline"
echo "${BACKTITLE}"
}
function backtitlep() {
[ "${STEP}" = "model" ] && BACKTITLEP="CHOOSE MODEL >>> " || BACKTITLEP="Choose Model >>> "
[ "${STEP}" = "version" ] && BACKTITLEP+="CHOOSE VERSION >>> " || BACKTITLEP+="Choose Version >>> "
[ "${STEP}" = "snmac" ] && BACKTITLEP+="SET SN/MAC >>> " || BACKTITLEP+="Set SN/Mac >>> "
[ "${STEP}" = "network" ] && BACKTITLEP+="SET NETWORK >>> " || BACKTITLEP+="Set Network >>> "
[ "${STEP}" = "storagemap" ] && BACKTITLEP+="SET STORAGEMAP >>> " || BACKTITLEP+="Set StorageMap >>> "
[ "${STEP}" = "addons" ] && BACKTITLEP+="SET ADDONS >>> " || BACKTITLEP+="Set Addons >>> "
[ "${STEP}" = "build" ] && BACKTITLEP+="BUILD LOADER >>> " || BACKTITLEP+="Build Loader >>> "
[ "${STEP}" = "boot" ] && BACKTITLEP+="BOOT DSM" || BACKTITLEP+="Boot DSM"
[ "${STEP}" == "model" ] && BACKTITLEP="CHOOSE MODEL >>> " || BACKTITLEP="Choose Model >>> "
[ "${STEP}" == "version" ] && BACKTITLEP+="CHOOSE VERSION >>> " || BACKTITLEP+="Choose Version >>> "
[ "${STEP}" == "snmac" ] && BACKTITLEP+="SET SN/MAC >>> " || BACKTITLEP+="Set SN/Mac >>> "
[ "${STEP}" == "network" ] && BACKTITLEP+="SET NETWORK >>> " || BACKTITLEP+="Set Network >>> "
[ "${STEP}" == "storagemap" ] && BACKTITLEP+="SET STORAGEMAP >>> " || BACKTITLEP+="Set StorageMap >>> "
[ "${STEP}" == "addons" ] && BACKTITLEP+="SET ADDONS >>> " || BACKTITLEP+="Set Addons >>> "
[ "${STEP}" == "build" ] && BACKTITLEP+="BUILD LOADER >>> " || BACKTITLEP+="Build Loader >>> "
[ "${STEP}" == "boot" ] && BACKTITLEP+="BOOT DSM" || BACKTITLEP+="Boot DSM"
echo "${BACKTITLEP}"
}
@@ -89,14 +89,11 @@ function backtitlep() {
# Model Selection
function arcModel() {
STEP="model"
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs
else
checkHardwareID
fi
dialog --backtitle "$(backtitlep)" --title "Model" \
--infobox "Reading Models..." 3 25
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then
updateConfigs
fi
# Loop menu
RESTRICT=1
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
@@ -107,7 +104,7 @@ function arcModel() {
echo "${M} ${P}" >>"${TMP_PATH}/modellist"
done < <(echo "${PM}")
done < <(echo "${PS}")
if [ "${ARCMODE}" = "config" ]; then
if [ "${ARCMODE}" == "config" ]; then
while true; do
echo -n "" >"${TMP_PATH}/menu"
while read -r M A; do
@@ -118,16 +115,16 @@ function arcModel() {
ARC=""
BETA=""
[ -n "${ARCCONFM}" ] && ARC="x" || ARC=""
[ "${DT}" = "true" ] && DTS="x" || DTS=""
[ "${DT}" == "true" ] && DTS="x" || DTS=""
IGPUS=""
[[ "${A}" = "apollolake" || "${A}" = "geminilake" ]] && IGPUS="up to 9th"
[ "${A}" = "epyc7002" ] && IGPUS="up to 14th"
[ "${DT}" = "true" ] && HBAS="" || HBAS="x"
[ "${M}" = "SA6400" ] && HBAS="x"
[ "${DT}" = "false" ] && USBS="int/ext" || USBS="ext"
[[ "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_CACHE="+" || M_2_CACHE="x"
[[ "${M}" = "DS220+" || "${M}" = "DS224+" ]] && M_2_CACHE=""
[[ "${M}" = "DS220+" || "${M}" = "DS224+" || "${M}" = "DS918+" || "${M}" = "DS1019+" || "${M}" = "DS1621xs+" || "${M}" = "RS1619xs+" ]] && M_2_STORAGE="" || M_2_STORAGE="+"
[[ "${A}" == "apollolake" || "${A}" == "geminilake" ]] && IGPUS="up to 9th"
[ "${A}" == "epyc7002" ] && IGPUS="up to 14th"
[ "${DT}" == "true" ] && HBAS="" || HBAS="x"
[ "${M}" == "SA6400" ] && HBAS="x"
[ "${DT}" == "false" ] && USBS="int/ext" || USBS="ext"
[[ "${M}" == "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="+"
# Check id model is compatible with CPU
if [ ${RESTRICT} -eq 1 ]; then
for F in "${FLAGS}"; do
@@ -136,33 +133,32 @@ function arcModel() {
break
fi
done
if [ "${A}" != "epyc7002" ] && [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
if [ "${A}" != "epyc7002" ] && [ "${DT}" == "true" ] && [ "${EXTERNALCONTROLLER}" == "true" ]; then
COMPATIBLE=0
fi
if [ "${A}" != "epyc7002" ] && [ ${SATACONTROLLER} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
if [ "${A}" != "epyc7002" ] && [ ${SATACONTROLLER} -eq 0 ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
COMPATIBLE=0
fi
if [ "${A}" = "epyc7002" ] && [[ ${SCSICONTROLLER} -ne 0 || ${RAIDCONTROLLER} -ne 0 ]]; then
if [ "${A}" == "epyc7002" ] && [[ ${SCSICONTROLLER} -ne 0 || ${RAIDCONTROLLER} -ne 0 ]]; then
COMPATIBLE=0
fi
if [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "usb" ] && [ ${SATADRIVES} -eq 0 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
if [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" == "usb" ] && [ ${SATADRIVES} -eq 0 ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
COMPATIBLE=0
elif [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" = "sata" ] && [ ${SATADRIVES} -eq 1 ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
elif [ "${A}" != "epyc7002" ] && [ ${NVMEDRIVES} -gt 0 ] && [ "${BUS}" == "sata" ] && [ ${SATADRIVES} -eq 1 ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
COMPATIBLE=0
fi
[ -z "$(grep -w "${M}" "${S_FILE}")" ] && COMPATIBLE=0
fi
[ -n "$(grep -w "${M}" "${S_FILE}")" ] && BETA="Arc" || BETA="Syno"
[ -z "$(grep -w "${A}" "${P_FILE}")" ] && COMPATIBLE=0
if [ -n "${ARCCONF}" ]; then
if [ -n "${ARCKEY}" ]; then
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
else
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${A}" "${DTS}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
fi
done < <(cat "${TMP_PATH}/modellist")
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
[ -n "${ARCKEY}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-12s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Intel iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
[ -n "${ARCKEY}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
dialog --backtitle "$(backtitlep)" --title "${TITLEMSG}" --colors \
--cancel-label "Show all" --help-button --help-label "Exit" \
--extra-button --extra-label "Info" \
@@ -196,7 +192,7 @@ function arcModel() {
done
fi
# Reset Model Config if changed
if [ "${ARCMODE}" = "config" ] && [ "${MODEL}" != "${resp}" ]; then
if [ "${ARCMODE}" == "config" ] && [ "${MODEL}" != "${resp}" ]; then
MODEL="${resp}"
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
@@ -245,7 +241,7 @@ function arcVersion() {
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" = "config" ] && [ "${ARCRESTORE}" != "true" ]; then
if [ "${ARCMODE}" == "config" ] && [ "${ARCRESTORE}" != "true" ]; then
# Select Build for DSM
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
dialog --clear --no-items --nocancel --title "Version" --backtitle "$(backtitlep)" \
@@ -278,7 +274,7 @@ function arcVersion() {
PVS="$(readConfigEntriesArray "${PLATFORM}.\"${MODEL}\"" "${D_FILE}" | sort -r)"
echo -n "" >"${TMP_PATH}/versions"
while read -r V; do
if [ "${V:0:3}" != "${PRODUCTVER}" ] || [ "${V}" = "${PREV}" ]; then
if [ "${V:0:3}" != "${PRODUCTVER}" ] || [ "${V}" == "${PREV}" ]; then
continue
else
echo "${V}" >>"${TMP_PATH}/versions"
@@ -324,11 +320,11 @@ function arcVersion() {
dialog --backtitle "$(backtitlep)" --colors --title "Automated Mode" \
--yesno "${MSG}" 6 55
[ $? -eq 0 ] && ARCMODE="automated" || ARCMODE="config"
elif [ "${ARCMODE}" = "automated" ] || [ "${ARCRESTORE}" = "true" ]; then
elif [ "${ARCMODE}" == "automated" ] || [ "${ARCRESTORE}" == "true" ]; then
VALID="true"
fi
# Change Config if Files are valid
if [ "${VALID}" = "true" ]; then
if [ "${VALID}" == "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Config" \
--infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60
# Reset Synoinfo
@@ -340,27 +336,27 @@ function arcVersion() {
ADDONS="$(readConfigKey "addons" "${USER_CONFIG_FILE}")"
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
if [ "${ADDONS}" = "{}" ]; then
if [ "${ADDONS}" == "{}" ]; then
initConfigKey "addons.acpid" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.updatenotify" "" "${USER_CONFIG_FILE}"
if [ ${NVMEDRIVES} -gt 0 ]; then
if [ "${PLATFORM}" = "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
if [ "${PLATFORM}" == "epyc7002" ] && [ ${SATADRIVES} -eq 0 ] && [ ${SASDRIVES} -eq 0 ]; then
initConfigKey "addons.nvmesystem" "" "${USER_CONFIG_FILE}"
elif [ "${MODEL}" = "DS918+" ] || [ "${MODEL}" = "DS1019+" ] || [ "${MODEL}" = "DS1621xs+" ] || [ "${MODEL}" = "RS1619xs+" ]; then
elif [ "${MODEL}" == "DS918+" ] || [ "${MODEL}" == "DS1019+" ] || [ "${MODEL}" == "DS1621xs+" ] || [ "${MODEL}" == "RS1619xs+" ]; then
initConfigKey "addons.nvmecache" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
else
initConfigKey "addons.nvmevolume" "" "${USER_CONFIG_FILE}"
fi
fi
if [ "${MACHINE}" = "Native" ]; then
if [ "${MACHINE}" == "Native" ]; then
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.powersched" "" "${USER_CONFIG_FILE}"
initConfigKey "addons.sensors" "" "${USER_CONFIG_FILE}"
fi
if [ "${PLATFORM}" = "apollolake" ] || [ "${PLATFORM}" = "geminilake" ]; then
if [ "${PLATFORM}" == "apollolake" ] || [ "${PLATFORM}" == "geminilake" ]; then
initConfigKey "addons.i915" "" "${USER_CONFIG_FILE}"
fi
if echo "${PAT_URL}" 2>/dev/null | grep -q "7.2.2"; then
@@ -369,9 +365,6 @@ function arcVersion() {
if [ -n "${ARCCONF}" ]; then
initConfigKey "addons.arcdns" "" "${USER_CONFIG_FILE}"
fi
if [ ${SASDRIVES} -gt 0 ]; then
initConfigKey "addons.smartctl" "" "${USER_CONFIG_FILE}"
fi
fi
while IFS=': ' read -r ADDON PARAM; do
[ -z "${ADDON}" ] && continue
@@ -380,7 +373,7 @@ function arcVersion() {
fi
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do
@@ -388,7 +381,7 @@ function arcVersion() {
done < <(getAllModules "${PLATFORM}" "${KVERP}")
fi
# Check for Only Version
if [ "${ONLYVERSION}" = "true" ]; then
if [ "${ONLYVERSION}" == "true" ]; then
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYVERSION="false"
@@ -415,14 +408,16 @@ function arcPatch() {
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" = "automated" ]; then
if [ "${ARCMODE}" == "automated" ]; then
[ -z "${ARCCONF}" ] && checkHardwareID || true
sleep 1
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")"
[ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" = "config" ]; then
elif [ "${ARCMODE}" == "config" ]; then
dialog --clear --backtitle "$(backtitlep)" \
--nocancel --title "SN/Mac Options"\
--menu "Choose an Option" 7 60 0 \
--menu "Choose an Option." 7 60 0 \
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
2 "Use random SN/Mac (Reduced DSM Features)" \
3 "Use my own SN/Mac (Be sure your Data is valid)" \
@@ -430,20 +425,11 @@ function arcPatch() {
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
[ -z "${ARCCONF}" ] && checkHardwareID || true
sleep 1
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
if [ -n "${ARCCONF}" ]; then
dialog --backtitle "$(backtitlep)" --colors --title "Arc Patch" \
--infobox "Arc Patch successful!" 3 30
sleep 2
SN="$(generateSerial "${MODEL}" "true")"
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
else
dialog --backtitle "$(backtitlep)" --colors --title "Arc Patch" \
--infobox "Arc Patch failed!" 3 30
sleep 2
SN="$(generateSerial "${MODEL}" "false")"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
fi
[ -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 [ ${resp} -eq 2 ]; then
# Generate random Serial
SN="$(generateSerial "${MODEL}" "false")"
@@ -486,14 +472,14 @@ function arcSettings() {
sleep 2
getnet
[ $? -ne 0 ] && return 1
if [ "${ONLYPATCH}" = "true" ]; then
if [ "${ONLYPATCH}" == "true" ]; then
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYPATCH="false"
return 0
fi
# Select Portmap for Loader
if [ "${DT}" = "false" ] && [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
if [ "${DT}" == "false" ] && [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
STEP="storagemap"
dialog --backtitle "$(backtitlep)" --colors --title "Storage Map" \
--infobox "Generating Storage Map..." 3 40
@@ -502,7 +488,7 @@ function arcSettings() {
[ $? -ne 0 ] && return 1
fi
# Check for Custom Build
if [ "${ARCMODE}" = "config" ]; then
if [ "${ARCMODE}" == "config" ]; then
# Select Addons
STEP="addons"
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
@@ -511,17 +497,17 @@ function arcSettings() {
[ $? -ne 0 ] && return 1
fi
# Check for CPU Frequency Scaling & Governor
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [ "${ARCMODE}" == "config" ] && [ "${MACHINE}" == "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
governorSelection
[ $? -ne 0 ] && return 1
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
[ "${PLATFORM}" = "epyc7002" ] && writeConfigKey "addons.cpufreqscaling" "schedutil" "${USER_CONFIG_FILE}" || writeConfigKey "addons.cpufreqscaling" "conservative" "${USER_CONFIG_FILE}"
elif [ "${ARCMODE}" == "automated" ] && [ "${MACHINE}" == "Native" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
[ "${PLATFORM}" == "epyc7002" ] && writeConfigKey "addons.cpufreqscaling" "schedutil" "${USER_CONFIG_FILE}" || writeConfigKey "addons.cpufreqscaling" "conservative" "${USER_CONFIG_FILE}"
fi
if [ "${ARCMODE}" = "config" ]; then
if [ "${ARCMODE}" == "config" ]; then
# Check for DT and HBA/Raid Controller
if [ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
if [ "${DT}" == "true" ] && [ "${EXTERNALCONTROLLER}" == "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
fi
@@ -532,24 +518,24 @@ function arcSettings() {
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You have more NIC (${DEVICENIC}) then 8 NIC.\nOnly 8 supported by DSM." 6 60
fi
if [ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ]; then
if [ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" == "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly ${MODELNIC} are used by Arc Patch." 6 80
fi
# Check for AES
if [ "${AESSYS}" = "false" ]; then
if [ "${AESSYS}" == "false" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: Your System doesn't support Hardwareencryption in DSM. (AES)" 5 70
fi
# Check for CPUFREQ
if [[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [[ "${CPUFREQ}" == "false" || "${ACPISYS}" == "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitlep)" --title "Arc Warning" \
--msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
fi
fi
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
# eMMC Boot Support
if [ "${EMMCBOOT}" = "true" ]; then
if [ "${EMMCBOOT}" == "true" ]; then
writeConfigKey "modules.mmc_block" "" "${USER_CONFIG_FILE}"
writeConfigKey "modules.mmc_core" "" "${USER_CONFIG_FILE}"
else
@@ -561,7 +547,7 @@ function arcSettings() {
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${ARCMODE}" = "config" ]; then
if [ "${ARCMODE}" == "config" ]; then
# Ask for Build
dialog --clear --backtitle "$(backtitlep)" --title "Config done" \
--no-cancel --menu "Build now?" 7 40 0 \
@@ -601,12 +587,12 @@ function arcSummary() {
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
if [ "${REMAP}" = "acports" ] || [ "${REMAP}" = "maxports" ]; then
if [ "${REMAP}" == "acports" ] || [ "${REMAP}" == "maxports" ]; then
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")"
elif [ "${REMAP}" = "remap" ]; then
elif [ "${REMAP}" == "remap" ]; then
PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")"
elif [ "${REMAP}" = "ahci" ]; then
elif [ "${REMAP}" == "ahci" ]; then
AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")"
else
PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")"
@@ -623,7 +609,7 @@ function arcSummary() {
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${DT}" = "false" ] && [ "${REMAP}" = "user" ]; then
if [ "${DT}" == "false" ] && [ "${REMAP}" == "user" ]; then
if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Error" \
--msgbox "ERROR: You selected Portmap: User and not set any values. -> Can't build Loader!\nGo need to go Cmdline Options and add your Values." 6 80
@@ -638,7 +624,7 @@ function arcSummary() {
SUMMARY+="\n>> DT: \Zb${DT}\Zn"
SUMMARY+="\n>> PAT URL: \Zb${PAT_URL}\Zn"
SUMMARY+="\n>> PAT Hash: \Zb${PAT_HASH}\Zn"
[ "${MODEL}" = "SA6400" ] && SUMMARY+="\n>> Kernel: \Zb${KERNEL}\Zn"
[ "${MODEL}" == "SA6400" ] && SUMMARY+="\n>> Kernel: \Zb${KERNEL}\Zn"
SUMMARY+="\n>> Kernel Version: \Zb${KVER}\Zn"
SUMMARY+="\n"
SUMMARY+="\n\Z4> Arc Information\Zn"
@@ -647,7 +633,7 @@ function arcSummary() {
[ -n "${DISKMAP}" ] && SUMMARY+="\n>> DiskIdxMap: \Zb${DISKMAP}\Zn"
[ -n "${PORTREMAP}" ] && SUMMARY+="\n>> SataRemap: \Zb${PORTREMAP}\Zn"
[ -n "${AHCIPORTREMAP}" ] && SUMMARY+="\n>> AhciRemap: \Zb${AHCIPORTREMAP}\Zn"
[ "${DT}" = "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn"
[ "${DT}" == "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn"
SUMMARY+="\n>> Directboot: \Zb${DIRECTBOOT}\Zn"
SUMMARY+="\n>> eMMC Boot: \Zb${EMMCBOOT}\Zn"
SUMMARY+="\n>> Kernelload: \Zb${KERNELLOAD}\Zn"
@@ -681,6 +667,19 @@ function arcSummary() {
# Building Loader
function make() {
STEP="build"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)"
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
BOOTMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${BOOTMODE}" != "automated" ] && [ "${ARCOFFLINE}" != "true" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then
if ! curl -skL "https://auxxxilium.tech/check.yml" -o "${TMP_PATH}/check.yml" 2>/dev/null; then
SN=$(generateSerial "${MODEL}" "false")
else
if grep -q "${SN}" "${TMP_PATH}/check.yml"; then
SN=$(generateSerial "${MODEL}" "false")
fi
fi
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
fi
# Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
@@ -692,25 +691,15 @@ function make() {
# Check for Arc Patch
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" = "false" ]; then
if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" == "false" ]; then
deleteConfigKey "addons.amepatch" "${USER_CONFIG_FILE}"
deleteConfigKey "addons.arcdns" "${USER_CONFIG_FILE}"
fi
# Max Memory for DSM
RAMCONFIG="$((${RAMTOTAL} * 1024 * 2))"
writeConfigKey "synoinfo.mem_max_mb" "${RAMCONFIG}" "${USER_CONFIG_FILE}"
if [ -n "${IPCON}" ]; then
getpatfiles
else
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
--infobox "Could not build Loader!\nNetwork Connection needed." 4 40
# Set Build to false
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
sleep 2
return 1
fi
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" = "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
getpatfiles
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" == "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
(
livepatch
sleep 3
@@ -750,13 +739,13 @@ function arcFinish() {
if [ -n "${MODELID}" ]; then
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "automated" ] || [ "${UPDATEMODE}" = "true" ]; then
if [ "${ARCMODE}" == "automated" ] || [ "${UPDATEMODE}" == "true" ]; then
boot
else
# Ask for Boot
dialog --clear --backtitle "$(backtitle)" --title "Build done"\
--no-cancel --menu "Boot now?" 7 40 0 \
1 "Yes - Boot DSM now" \
1 "Yes - Boot Arc Loader now" \
2 "No - I want to make changes" \
2>"${TMP_PATH}/resp"
resp=$(cat ${TMP_PATH}/resp)
@@ -776,7 +765,7 @@ function juniorboot() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
if [[ "${BUILDDONE}" == "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
if [ $? -eq 0 ]; then
@@ -796,7 +785,7 @@ function boot() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
if [[ "${BUILDDONE}" == "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
if [ $? -eq 0 ]; then
@@ -815,57 +804,57 @@ function boot() {
###############################################################################
# Main loop
# Check for Arc Mode
if [ "${ARCMODE}" = "update" ]; then
if [ "${ARCMODE}" == "update" ]; then
if [ "${ARCOFFLINE}" != "true" ]; then
updateLoader
else
dialog --backtitle "$(backtitle)" --title "Arc Update" \
--infobox "Update is not possible in Offline Mode!" 5 40
sleep 3
reboot
exec reboot
fi
elif [ "${ARCMODE}" = "automated" ]; then
elif [ "${ARCMODE}" == "automated" ]; then
# Check for Custom Build
if [ "${BUILDDONE}" = "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
if [ "${BUILDDONE}" == "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
arcModel
else
make
fi
else
[ "${CONFDONE}" = "true" ] && NEXT="2" || NEXT="1"
[ "${BUILDDONE}" = "true" ] && NEXT="3" || NEXT="1"
[ "${CONFDONE}" == "true" ] && NEXT="2" || NEXT="1"
[ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1"
while true; do
echo "= \"\Z4===== Main =====\Zn \" " >"${TMP_PATH}/menu"
echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu"
if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then
echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu"
fi
echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" = "true" ] && [ -n "${IPCON}" ]; then
if [ "${CONFDONE}" == "true" ]; then
echo "2 \"Build Loader \" " >>"${TMP_PATH}/menu"
fi
if [ "${BUILDDONE}" = "true" ]; then
if [ "${BUILDDONE}" == "true" ]; then
echo "3 \"Boot Loader \" " >>"${TMP_PATH}/menu"
fi
echo "= \"\Z4===== Info =====\Zn \" " >>"${TMP_PATH}/menu"
echo "= \"\Z4========== Info ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "a \"Sysinfo \" " >>"${TMP_PATH}/menu"
echo "A \"Networkdiag \" " >>"${TMP_PATH}/menu"
echo "= \"\Z4===== System ====\Zn \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" = "true" ]; then
if [ "${ARCOPTS}" = "true" ]; then
echo "= \"\Z4========== System ========\Zn \" " >>"${TMP_PATH}/menu"
if [ "${CONFDONE}" == "true" ]; then
if [ "${ARCOPTS}" == "true" ]; then
echo "4 \"\Z1Hide Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "4 \"\Z1Show Arc DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${ARCOPTS}" = "true" ]; then
echo "= \"\Z4==== Arc DSM ====\Zn \" " >>"${TMP_PATH}/menu"
if [ "${ARCOPTS}" == "true" ]; then
echo "= \"\Z4======== Arc DSM ========\Zn \" " >>"${TMP_PATH}/menu"
echo "b \"Addons \" " >>"${TMP_PATH}/menu"
echo "d \"Modules \" " >>"${TMP_PATH}/menu"
echo "e \"Version \" " >>"${TMP_PATH}/menu"
echo "p \"SN/Mac Options \" " >>"${TMP_PATH}/menu"
if [ "${DT}" = "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then
if [ "${DT}" == "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then
echo "S \"Sata PortMap \" " >>"${TMP_PATH}/menu"
fi
if [ "${DT}" = "true" ]; then
if [ "${DT}" == "true" ]; then
echo "o \"DTS Map Options \" " >>"${TMP_PATH}/menu"
fi
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
@@ -877,73 +866,73 @@ 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
if [ "${BOOTOPTS}" == "true" ]; then
echo "6 \"\Z1Hide Boot Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "6 \"\Z1Show Boot Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${BOOTOPTS}" = "true" ]; then
echo "= \"\Z4===== Boot =====\Zn \" " >>"${TMP_PATH}/menu"
echo "m \"Boot Kernelload: \Z4${KERNELLOAD}\Zn \" " >>"${TMP_PATH}/menu"
if [ "${BOOTOPTS}" == "true" ]; then
echo "= \"\Z4========== Boot =========\Zn \" " >>"${TMP_PATH}/menu"
echo "m \"Boot Kernelload: \Z4${KERNELLOAD}\Zn \" " >>"${TMP_PATH}/menu"
echo "E \"eMMC Boot Support: \Z4${EMMCBOOT}\Zn \" " >>"${TMP_PATH}/menu"
if [ "${DIRECTBOOT}" = "false" ]; then
if [ "${DIRECTBOOT}" == "false" ]; then
echo "i \"Boot IP Waittime: \Z4${BOOTIPWAIT}\Zn \" " >>"${TMP_PATH}/menu"
fi
echo "q \"Directboot: \Z4${DIRECTBOOT}\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" = "true" ]; then
if [ "${DSMOPTS}" == "true" ]; then
echo "7 \"\Z1Hide DSM Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "7 \"\Z1Show DSM Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${DSMOPTS}" = "true" ]; then
echo "= \"\Z4===== DSM =====\Zn \" " >>"${TMP_PATH}/menu"
if [ "${DSMOPTS}" == "true" ]; then
echo "= \"\Z4========== DSM ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "j \"Cmdline \" " >>"${TMP_PATH}/menu"
echo "k \"Synoinfo \" " >>"${TMP_PATH}/menu"
echo "N \"Add new User\" " >>"${TMP_PATH}/menu"
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
echo "s \"Allow Downgrade Version \" " >>"${TMP_PATH}/menu"
echo "s \"Allow Downgrade \" " >>"${TMP_PATH}/menu"
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
echo "N \"Add new User\" " >>"${TMP_PATH}/menu"
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu"
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
if [ "${PLATFORM}" == "epyc7002" ]; then
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 "O \"Official Driver Priority: \Z4${ODP}\Zn \" " >>"${TMP_PATH}/menu"
echo "B \"Grep DSM Config from Backup \" " >>"${TMP_PATH}/menu"
fi
fi
if [ "${LOADEROPTS}" = "true" ]; then
if [ "${LOADEROPTS}" == "true" ]; then
echo "8 \"\Z1Hide Loader Options\Zn \" " >>"${TMP_PATH}/menu"
else
echo "8 \"\Z1Show Loader Options\Zn \" " >>"${TMP_PATH}/menu"
fi
if [ "${LOADEROPTS}" = "true" ]; then
echo "= \"\Z4===== Loader =====\Zn \" " >>"${TMP_PATH}/menu"
echo "c \"Offline Mode: \Z4${ARCOFFLINE}\Zn \" " >>"${TMP_PATH}/menu"
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 "c \"Offline Mode: \Z4${ARCOFFLINE}\Zn \" " >>"${TMP_PATH}/menu"
echo "f \"Bootscreen Options \" " >>"${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 "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 "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"
@@ -964,36 +953,36 @@ else
A) networkdiag; NEXT="A" ;;
# System Section
# Arc Section
4) [ "${ARCOPTS}" = "true" ] && ARCOPTS='false' || ARCOPTS='true'
4) [ "${ARCOPTS}" == "true" ] && ARCOPTS='false' || ARCOPTS='true'
ARCOPTS="${ARCOPTS}"
NEXT="4"
;;
b) addonMenu; NEXT="b" ;;
d) modulesMenu; NEXT="d" ;;
e) ONLYVERSION="true" && arcVersion; NEXT="e" ;;
p) ONLYPATCH="true" && checkHardwareID && arcPatch; NEXT="p" ;;
p) ONLYPATCH="true" && arcPatch; NEXT="p" ;;
S) storageMenu; NEXT="S" ;;
o) dtsMenu; NEXT="o" ;;
g) governorMenu; NEXT="g" ;;
P) storagepanelMenu; NEXT="P" ;;
Q) sequentialIOMenu; NEXT="Q" ;;
# Boot Section
6) [ "${BOOTOPTS}" = "true" ] && BOOTOPTS='false' || BOOTOPTS='true'
6) [ "${BOOTOPTS}" == "true" ] && BOOTOPTS='false' || BOOTOPTS='true'
BOOTOPTS="${BOOTOPTS}"
NEXT="6"
;;
m) [ "${KERNELLOAD}" = "kexec" ] && KERNELLOAD='power' || KERNELLOAD='kexec'
m) [ "${KERNELLOAD}" == "kexec" ] && KERNELLOAD='power' || KERNELLOAD='kexec'
writeConfigKey "kernelload" "${KERNELLOAD}" "${USER_CONFIG_FILE}"
NEXT="m"
;;
E) [ "${EMMCBOOT}" = "true" ] && EMMCBOOT='false' || EMMCBOOT='true'
if [ "${EMMCBOOT}" = "false" ]; then
E) [ "${EMMCBOOT}" == "true" ] && EMMCBOOT='false' || EMMCBOOT='true'
if [ "${EMMCBOOT}" == "false" ]; then
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.disk_swap" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.supportraid" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.support_emmc_boot" "${USER_CONFIG_FILE}"
deleteConfigKey "synoinfo.support_install_only_dev" "${USER_CONFIG_FILE}"
elif [ "${EMMCBOOT}" = "true" ]; then
elif [ "${EMMCBOOT}" == "true" ]; then
writeConfigKey "emmcboot" "true" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo.disk_swap" "no" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo.supportraid" "no" "${USER_CONFIG_FILE}"
@@ -1005,13 +994,13 @@ else
NEXT="E"
;;
i) bootipwaittime; NEXT="i" ;;
q) [ "${DIRECTBOOT}" = "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
q) [ "${DIRECTBOOT}" == "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
grub-editenv ${USER_GRUBENVFILE} create
writeConfigKey "directboot" "${DIRECTBOOT}" "${USER_CONFIG_FILE}"
NEXT="q"
;;
# DSM Section
7) [ "${DSMOPTS}" = "true" ] && DSMOPTS='false' || DSMOPTS='true'
7) [ "${DSMOPTS}" == "true" ] && DSMOPTS='false' || DSMOPTS='true'
DSMOPTS="${DSMOPTS}"
NEXT="7"
;;
@@ -1024,11 +1013,12 @@ else
J) resetDSMNetwork; NEXT="J" ;;
M) mountDSM; NEXT="M" ;;
T) disablescheduledTasks; NEXT="T" ;;
K) KERNEL=$([ "${KERNEL}" = "official" ] && echo 'custom' || echo 'official')
Z) loaderPorts; NEXT="Z" ;;
K) [ "${KERNEL}" == "official" ] && KERNEL='custom' || KERNEL='official'
writeConfigKey "kernel" "${KERNEL}" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "Kernel" \
--infobox "Switching Kernel to ${KERNEL}! Stay patient..." 4 50
if [ "${ODP}" = "true" ]; then
if [ "${ODP}" == "true" ]; then
ODP="false"
writeConfigKey "odp" "${ODP}" "${USER_CONFIG_FILE}"
fi
@@ -1036,7 +1026,7 @@ else
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
if [ -n "${PLATFORM}" ] && [ -n "${KVER}" ]; then
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
@@ -1046,17 +1036,17 @@ else
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="K"
;;
H) [ "${HDDSORT}" = "true" ] && HDDSORT='false' || HDDSORT='true'
H) [ "${HDDSORT}" == "true" ] && HDDSORT='false' || HDDSORT='true'
writeConfigKey "hddsort" "${HDDSORT}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="H"
;;
h) if [ "${USBMOUNT}" = "auto" ]; then
h) if [ "${USBMOUNT}" == "auto" ]; then
USBMOUNT='internal'
elif [ "${USBMOUNT}" = "internal" ]; then
elif [ "${USBMOUNT}" == "internal" ]; then
USBMOUNT='external'
elif [ "${USBMOUNT}" = "external" ]; then
elif [ "${USBMOUNT}" == "external" ]; then
USBMOUNT='auto'
fi
writeConfigKey "usbmount" "${USBMOUNT}" "${USER_CONFIG_FILE}"
@@ -1064,7 +1054,7 @@ else
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="h"
;;
O) [ "${ODP}" = "false" ] && ODP='true' || ODP='false'
O) [ "${ODP}" == "false" ] && ODP='true' || ODP='false'
writeConfigKey "odp" "${ODP}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
@@ -1072,33 +1062,32 @@ else
;;
B) getbackup; NEXT="B" ;;
# Loader Section
8) [ "${LOADEROPTS}" = "true" ] && LOADEROPTS='false' || LOADEROPTS='true'
8) [ "${LOADEROPTS}" == "true" ] && LOADEROPTS='false' || LOADEROPTS='true'
LOADEROPTS="${LOADEROPTS}"
NEXT="8"
;;
c) ARCOFFLINE=$([ "${ARCOFFLINE}" = "true" ] && echo 'false' || echo 'true')
D) staticIPMenu; NEXT="D" ;;
c) [ "${ARCOFFLINE}" == "true" ] && ARCOFFLINE='false' || ARCOFFLINE='true'
writeConfigKey "arc.offline" "${ARCOFFLINE}" "${USER_CONFIG_FILE}"
[ "${ARCOFFLINE}" = "false" ] && exec arc.sh
[ "${ARCOFFLINE}" == "false" ] && exec arc.sh
NEXT="c"
;;
D) staticIPMenu; NEXT="D" ;;
f) bootScreen; NEXT="f" ;;
Z) loaderPorts; NEXT="Z" ;;
U) loaderPassword; NEXT="U" ;;
W) RD_COMPRESSED=$([ "${RD_COMPRESSED}" = "true" ] && echo 'false' || echo 'true')
W) [ "${RD_COMPRESSED}" == "true" ] && RD_COMPRESSED='false' || RD_COMPRESSED='true'
writeConfigKey "rd-compressed" "${RD_COMPRESSED}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="W"
;;
X) satadomMenu; NEXT="X" ;;
u) [ "${LKM}" = "prod" ] && LKM='dev' || LKM='prod'
u) [ "${LKM}" == "prod" ] && LKM='dev' || LKM='prod'
writeConfigKey "lkm" "${LKM}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
NEXT="u"
;;
L) greplogs; NEXT="L" ;;
U) loaderPassword; NEXT="U" ;;
w) resetLoader; NEXT="w" ;;
C) cloneLoader; NEXT="C" ;;
n) editGrubCfg; NEXT="n" ;;

View File

@@ -3,20 +3,20 @@
set -e
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
. "${ARC_PATH}/include/functions.sh"
. ${ARC_PATH}/include/functions.sh
# Clear logs for dbgutils addons
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!"
[ "${BUILDDONE}" == "false" ] && die "Loader build not completed!"
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
BUS=$(getBus "${LOADER_DISK}")
FBI=$(cat /sys/class/graphics/fb*/name 2>/dev/null | head -1)
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
# Check if machine has EFI
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
# Print Title centralized
clear
@@ -59,7 +59,7 @@ DSMINFO="$(readConfigKey "boot.dsminfo" "${USER_CONFIG_FILE}")"
SYSTEMINFO="$(readConfigKey "boot.systeminfo" "${USER_CONFIG_FILE}")"
DISKINFO="$(readConfigKey "boot.diskinfo" "${USER_CONFIG_FILE}")"
if [ "${DSMINFO}" = "true" ]; then
if [ "${DSMINFO}" == "true" ]; then
echo -e "\033[1;37mDSM:\033[0m"
echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m"
echo -e "Platform: \033[1;37m${PLATFORM}\033[0m"
@@ -67,14 +67,14 @@ if [ "${DSMINFO}" = "true" ]; then
echo -e "LKM: \033[1;37m${LKM}\033[0m"
echo
fi
if [ "${SYSTEMINFO}" = "true" ]; then
if [ "${SYSTEMINFO}" == "true" ]; then
echo -e "\033[1;37mSystem:\033[0m"
echo -e "Vendor: \033[1;37m${VENDOR}\033[0m"
echo -e "CPU: \033[1;37m${CPU}\033[0m"
echo -e "Memory: \033[1;37m${RAMTOTAL}GB\033[0m"
echo
fi
if [ "${DISKINFO}" = "true" ]; then
if [ "${DISKINFO}" == "true" ]; then
echo -e "\033[1;37mDisks:\033[0m"
echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m"
fi
@@ -82,7 +82,7 @@ fi
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
HASATA=0
for D in $(lsblk -dpno NAME); do
[ "${D}" = "${LOADER_DISK}" ] && continue
[ "${D}" == "${LOADER_DISK}" ] && continue
if echo "sata sas scsi" | grep -qw "$(getBus "${D}")"; then
HASATA=1
break
@@ -139,7 +139,7 @@ if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then
else
CMDLINE["split_lock_detect"]="off"
fi
if [ "${DT}" = "true" ]; then
if [ "${DT}" == "true" ]; then
CMDLINE["syno_ttyS0"]="serial,0x3f8"
CMDLINE["syno_ttyS1"]="serial,0x2f8"
else
@@ -150,37 +150,30 @@ 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"]="passive"
# CMDLINE['nointremap']="" # no need
# CMDLINE['split_lock_detect']="off" # no need
# CMDLINE['nox2apic']="" # check platform
# CMDLINE['nomodeset']=""
if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then
CMDLINE["nox2apic"]=""
fi
#[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable"
#if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ "${BUS}" != "mmc" ] && [ "${EMMCBOOT}" != "true" ]; then
# if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "sdhci"; then
# [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
# [ ! "${CMDLINE['modprobe.blacklist']}" == "" ] && CMDLINE['modprobe.blacklist']+=","
# CMDLINE['modprobe.blacklist']+="sdhci,sdhci_pci,sdhci_acpi"
# fi
# fi
if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
if [ "${DT}" == "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "mpt3sas"; then
[ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
[ ! "${CMDLINE['modprobe.blacklist']}" == "" ] && CMDLINE['modprobe.blacklist']+=","
CMDLINE['modprobe.blacklist']+="mpt3sas"
fi
fi
@@ -193,15 +186,16 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then
CMDLINE["SASmodel"]="1"
fi
# NIC Cmdline
ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)
ETHN=$(echo ${ETHX} | wc -w)
[ -z "${ETHM}" ] && ETHM=${ETHN}
# Cmdline NIC Settings
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
ETHM="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
ETHN="$(echo ${ETHX} | wc -w)"
[ -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))
for ETH in ${ETHX}; do
MAC="$(readConfigKey "${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | tr '[:lower:]' '[:upper:]')"
NIC=$((${NIC} + 1))
[ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}"
[ ${NIC} -ge ${ETHM} ] && break
done
@@ -227,24 +221,46 @@ done
CMDLINE_LINE=$(echo "${CMDLINE_LINE}" | sed 's/^ //') # Remove leading space
echo "${CMDLINE_LINE}" >"${PART1_PATH}/cmdline.yml"
function _bootwait() {
# Exec Bootwait to check SSH/Web connection
BOOTWAIT=5
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WB
MSG=""
while test ${BOOTWAIT} -ge 0; do
MSG="\033[1;33mAccess SSH/Web will interrupt boot...\033[0m"
echo -en "\r${MSG}"
busybox w 2>/dev/null | awk '{print $1" "$2" "$4" "$5" "$6}' >WC
if ! diff WB WC >/dev/null 2>&1; then
echo -en "\r\033[1;33mAccess SSH/Web detected and boot is interrupted.\033[0m\n"
rm -f WB WC
exit 0
fi
sleep 1
BOOTWAIT=$((BOOTWAIT - 1))
done
rm -f WB WC
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
return 0
}
# Boot
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
if [ "${DIRECTBOOT}" = "true" ]; then
if [ "${DIRECTBOOT}" == "true" ]; then
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}"
grub-editenv ${USER_GRUBENVFILE} set next_entry="direct"
_bootwait || true
echo -e "\033[1;34mReboot with Directboot\033[0m"
reboot
exec reboot
exit 0
elif [ "${DIRECTBOOT}" = "false" ]; then
elif [ "${DIRECTBOOT}" == "false" ]; then
grub-editenv ${USER_GRUBENVFILE} unset dsm_cmdline
grub-editenv ${USER_GRUBENVFILE} unset next_entry
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
IPCON=""
if [ "${ARCPATCH}" = "true" ]; then
if [ "${ARCPATCH}" == "true" ]; then
echo -e "\033[1;37mDetected ${ETHN} NIC\033[0m | \033[1;34mUsing ${NIC} NIC for Arc Patch:\033[0m"
else
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
@@ -252,18 +268,18 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
for N in ${ETHX}; do
for ETH in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
while true; do
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
break
fi
COUNT=$((${COUNT} + 1))
IP="$(getIP ${N})"
IP="$(getIP ${ETH})"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
else
@@ -272,7 +288,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
fi
break
fi
if [ -z "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
break
fi
@@ -286,28 +302,19 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
_bootwait || true
DSMLOGO="$(readConfigKey "boot.dsmlogo" "${USER_CONFIG_FILE}")"
if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ]; then
if [ "${DSMLOGO}" == "true" ] && [ -c "/dev/fb0" ]; then
[[ "${IPCON}" =~ ^169\.254\..* ]] && IPCON=""
[ -n "${IPCON}" ] && URL="http://${IPCON}:5000" || URL="http://find.synology.com/"
python3 ${ARC_PATH}/include/functions.py makeqr -d "${URL}" -l "6" -o "${TMP_PATH}/qrcode_boot.png"
python ${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 $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
for T in $(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 $(readlink /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"
@@ -319,6 +326,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -e "\033[1;37mBooting DSM...\033[0m"
# Boot to DSM
[ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff
exit 0
fi
[ "${KERNELLOAD}" == "kexec" ] && kexec -e || poweroff
fi
exit 0

View File

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

View File

@@ -7,22 +7,28 @@
# 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}"'.*/0x\1 0x\4/p')
if [ -z "${OUT}" ]; then
OUT=$(sed -n 's/^[ \t0-9]*.b[sr][sk][ \t]*'"${NUM}${NUM}${NUM}${NUM}"'.*/\1\4/p')
if [ -z "$OUT" ]; then
echo "Never found .bss or .brk file offset" >&2
exit 1
fi
read -r sizeA offsetA sizeB offsetB <<<$(echo ${OUT} | awk '{printf "%d %d %d %d", strtonum($1), strtonum($2), strtonum($3), strtonum($4)}')
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%% *})
runSize=$((offsetA + sizeA + sizeB))
run_size=$((${offsetA} + ${sizeA} + ${sizeB}))
# BFD linker shows the same file offset in ELF.
if [ "${offsetA}" -ne "${offsetB}" ]; then
# Gold linker shows them as consecutive.
endSize=$((offsetB + sizeB))
if [ "${endSize}" -ne "${runSize}" ]; then
endB=$((${offsetB} + ${sizeB}))
if [ "$endB" != "$run_size" ]; then
printf "sizeA: 0x%x\n" ${sizeA} >&2
printf "offsetA: 0x%x\n" ${offsetA} >&2
printf "sizeB: 0x%x\n" ${sizeB} >&2
@@ -32,5 +38,5 @@ if [ "${offsetA}" -ne "${offsetB}" ]; then
fi
fi
printf "%d\n" ${runSize}
printf "%d\n" ${run_size}
exit 0

View File

@@ -10,34 +10,38 @@
#
# ----------------------------------------------------------------------
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 ] || [ ! -s "$img" ]; then
echo "Usage: $me <kernel-image>" >&2
exit 2
if [ $# -ne 1 -o ! -s "$img" ]
then
echo "Usage: $me <kernel-image>" >&2
exit 2
fi
# Prepare temp files:
@@ -57,4 +61,4 @@ try_decompress '(\265/\375' xxx unzstd
check_vmlinux $img
# Bail out:
echo "$me: Cannot find vmlinux." >&2
echo "$me: Cannot find vmlinux." >&2

View File

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

View File

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

View File

@@ -1,15 +1,15 @@
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" 2>/dev/null && pwd)"
. "${ARC_PATH}/include/consts.sh"
. "${ARC_PATH}/include/configFile.sh"
. "${ARC_PATH}/include/addons.sh"
. ${ARC_PATH}/include/consts.sh
. ${ARC_PATH}/include/configFile.sh
. ${ARC_PATH}/include/addons.sh
###############################################################################
# Check loader disk
function checkBootLoader() {
while read KNAME RO; do
[ -z "${KNAME}" ] && continue
[ "${RO}" = "0" ] && continue
[ "${RO}" == "0" ] && continue
hdparm -r0 "${KNAME}" >/dev/null 2>&1 || true
done <<<$(lsblk -pno KNAME,RO 2>/dev/null)
[ ! -w "${PART1_PATH}" ] && return 1
@@ -49,7 +49,7 @@ function arrayExistItem() {
ITEM="${1}"
shift
for i in "$@"; do
[ "${i}" = "${ITEM}" ] || continue
[ "${i}" == "${ITEM}" ] || continue
EXISTS=0
break
done
@@ -92,7 +92,7 @@ function genRandomValue() {
function generateSerial() {
PREFIX="$(readConfigArray "${1}.prefix" "${S_FILE}" 2>/dev/null | sort -R | tail -1)"
MIDDLE="$(readConfigArray "${1}.middle" "${S_FILE}" 2>/dev/null | sort -R | tail -1)"
if [ "${2}" = "true" ]; then
if [ "${2}" == "true" ]; then
SUFFIX="arc"
else
SUFFIX="$(readConfigKey "${1}.suffix" "${S_FILE}" 2>/dev/null)"
@@ -124,7 +124,7 @@ function generateSerial() {
# Returns serial number
function generateMacAddress() {
MACPRE="$(readConfigKey "${1}.macpre" "${S_FILE}")"
if [ "${3}" = "true" ]; then
if [ "${3}" == "true" ]; then
MACSUF="$(readConfigKey "${1}.mac" "${S_FILE}" 2>/dev/null)"
else
MACSUF="$(printf '%02x%02x%02x' $((${RANDOM} % 256)) $((${RANDOM} % 256)) $((${RANDOM} % 256)))"
@@ -188,7 +188,7 @@ function arrayExistItem() {
ITEM="${1}"
shift
for i in "$@"; do
[ "${i}" = "${ITEM}" ] || continue
[ "${i}" == "${ITEM}" ] || continue
EXISTS=0
break
done
@@ -229,17 +229,18 @@ function _set_conf_kv() {
# sort netif busid
function _sort_netif() {
local ETHLIST=""
local ETHX=$(ip -o link show | awk -F': ' '{print $2}' | grep eth)
for N in ${ETHX}; do
local MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
local BUS="$(ethtool -i ${N} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${N}\n"
local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
for ETH in ${ETHX}; do
local MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
local BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
done
local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)"
local ETHLIST="$(echo -e "${ETHLISTTMPB}" | grep -v '^$')"
local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')"
local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)"
# echo "${ETHSEQ}" >"/tmp/ethseq"
# sort
if [ ! "${ETHSEQ}" = "$(seq 0 $((${ETHNUM:0} - 1)))" ]; then
/etc/init.d/S41dhcpcd stop >/dev/null 2>&1
@@ -382,7 +383,7 @@ function rebootTo() {
local MODES="config recovery junior automated update bios memtest"
[ -z "${1}" ] && exit 1
if ! echo "${MODES}" | grep -qw "${1}"; then exit 1; fi
[ "${1}" = "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated"
[ "${1}" == "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated"
[ ! -f "${USER_GRUBENVFILE}" ] && grub-editenv ${USER_GRUBENVFILE} create
# echo -e "Rebooting to ${1} mode..."
grub-editenv ${USER_GRUBENVFILE} set next_entry="${1}"
@@ -437,7 +438,7 @@ function extractDSMFiles() {
echo -e "Could not determine if pat file is encrypted or not, maybe corrupted, try again!"
;;
esac
if [ "${isencrypted}" = "yes" ]; then
if [ "${isencrypted}" == "yes" ]; then
# Uses the extractor to untar PAT file
LD_LIBRARY_PATH="${EXTRACTOR_PATH}" "${EXTRACTOR_PATH}/${EXTRACTOR_BIN}" "${PAT_PATH}" "${EXT_PATH}" >"${LOG_FILE}" 2>&1
else
@@ -465,7 +466,7 @@ function livepatch() {
echo -e " - failed!"
PVALID="false"
fi
if [ "${PVALID}" = "true" ]; then
if [ "${PVALID}" == "true" ]; then
# Patch Ramdisk
echo -n "Patching Ramdisk"
if ${ARC_PATH}/ramdisk-patch.sh; then
@@ -476,12 +477,12 @@ function livepatch() {
PVALID="false"
fi
fi
if [ "${PVALID}" = "false" ]; then
if [ "${PVALID}" == "false" ]; then
echo
echo -e "Patching DSM Files failed! Please stay patient for Update."
sleep 5
exit 1
elif [ "${PVALID}" = "true" ]; then
elif [ "${PVALID}" == "true" ]; then
ZIMAGE_HASH="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')"
writeConfigKey "zimage-hash" "${ZIMAGE_HASH}" "${USER_CONFIG_FILE}"
RAMDISK_HASH="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')"
@@ -493,34 +494,32 @@ 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)"
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}")"
[ -z "${KEYMAP}" ] && KEYMAP="$(curl -m 10 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
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}
fi
[ $(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}"
if [ "${KEYMAP}" == "ua" ] || [ "${REGION}" == "Kyiv" ] || [ "${REGION}" == "Kiev" ]; then
poweroff
fi
}
@@ -553,7 +552,7 @@ function systemCheck () {
fi
# Check for CPU Frequency Scaling
CPUFREQUENCIES=$(ls -ltr /sys/devices/system/cpu/cpufreq/* 2>/dev/null | wc -l)
if [ ${CPUFREQUENCIES} -gt 1 ] && [ "${ACPISYS}" = "true" ]; then
if [ ${CPUFREQUENCIES} -gt 1 ] && [ "${ACPISYS}" == "true" ]; then
CPUFREQ="true"
else
CPUFREQ="false"
@@ -561,57 +560,4 @@ function systemCheck () {
# Check for Arc Patch
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
[ -z "${ARCCONF}" ] && writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
}
###############################################################################
# Generate HardwareID
function genHWID () {
HWID="$(echo $(dmidecode -t 4 | grep ID | sed 's/.*ID://;s/ //g' | head -1) $(ifconfig | grep eth | awk '{print $NF}' | sed 's/://g' | sort | head -1) | sha256sum | awk '{print $1}' | cut -c1-16)" 2>/dev/null
echo "${HWID}"
}
###############################################################################
# Check if port is valid
function check_port() {
if [ -z "${1}" ]; then
return 0
else
if [[ "${1}" =~ ^[0-9]+$ ]] && [ "${1}" -ge 0 ] && [ "${1}" -le 65535 ]; then
return 0
else
return 1
fi
fi
}
###############################################################################
# Unmount new boot loader disk
function __umountNewBlDisk() {
umount "${TMP_PATH}/sdX1" 2>/dev/null
umount "${TMP_PATH}/sdX2" 2>/dev/null
umount "${TMP_PATH}/sdX3" 2>/dev/null
}
###############################################################################
# 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
}

View File

@@ -14,7 +14,7 @@ function getAllModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
@@ -49,7 +49,7 @@ function installModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}"
@@ -61,7 +61,7 @@ function installModules() {
local ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")"
for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do
local M=$(basename ${F})
[ "${ODP}" = "true" ] && [ -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue
[ "${ODP}" == "true" -a -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue
if echo "${MLIST}" | grep -wq "${M:0:-3}"; then
cp -f "${F}" "${RAMDISK_PATH}/usr/lib/modules/${M}" 2>"${LOG_FILE}"
else
@@ -69,7 +69,7 @@ function installModules() {
fi
done
mkdir -p "${RAMDISK_PATH}/usr/lib/firmware"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
else
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" 2>"${LOG_FILE}"
@@ -101,13 +101,13 @@ function addToModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
fi
cp -f ${KOFILE} ${TMP_PATH}/modules
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
else
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
@@ -132,13 +132,13 @@ function delToModules() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
fi
rm -f ${TMP_PATH}/modules/${KONAME}
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zcf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
else
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
@@ -174,7 +174,7 @@ function getdepends() {
rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"

View File

@@ -1,37 +1,38 @@
# 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)"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
ETHN=$(echo ${ETHX} | wc -w)
if [ "${ARCPATCH}" = "true" ]; then
if [ "${ARCPATCH}" == "true" ]; then
ETHN="$(echo ${ETHX} | wc -w)"
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true"))
for I in $(seq 1 ${ETHN}); do
eval MAC${I}="${MACS[$((${I} - 1))]}"
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" = "false" ]; then
elif [ "${ARCPATCH}" == "false" ]; then
ETHN="$(echo ${ETHX} | wc -w)"
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false"))
for I in $(seq 1 ${ETHN}); do
eval MAC${I}="${MACS[$((${I} - 1))]}"
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" = "user" ]; then
elif [ "${ARCPATCH}" == "user" ]; then
# User Mac
for N in ${ETHX}; do
for ETH in ${ETHX}; do
while true; do
MAC="$(cat /sys/class/net/${N}/address | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
MAC="$(cat /sys/class/net/${ETH}/address | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
--inputbox "Type a custom MAC for ${ETH} (Eq. 001132abc123)." 7 50 "${MAC}"\
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:]')"
[ -z "${MAC}" ] && MAC="$(readConfigKey "${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
MAC="$(echo "${MAC}" | tr '[:lower:]' '[:upper:]')"
if [ ${#MAC} -eq 12 ]; then
writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}"
writeConfigKey "${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
break
else
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Invalid MAC - Try again!" 5 50

View File

@@ -122,13 +122,13 @@ function getmap() {
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
LASTDRIVE=0
while read -r D; do
if [ "${BUS}" = "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then
if [ "${BUS}" == "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then
MAXDISKS=${DRIVES}
echo -n "${D}>${MAXDISKS}:">>"${TMP_PATH}/remap"
elif [ ${D} != ${LASTDRIVE} ]; then
echo -n "${D}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
LASTDRIVE=$((${LASTDRIVE} + 1))
elif [ ${D} = ${LASTDRIVE} ]; then
elif [ ${D} == ${LASTDRIVE} ]; then
LASTDRIVE=$((${D} + 1))
fi
done < <(cat "${TMP_PATH}/ports")
@@ -142,17 +142,17 @@ function getmapSelection() {
SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "config" ]; then
if [ "${ARCMODE}" == "config" ]; then
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "true" ] && [ "${MACHINE}" == "Native" ]; then
REMAP2="*"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
REMAP3="*"
else
REMAP1="*"
fi
# Ask for Portmap
if [ "${STEP}" = "storagemap" ]; then
if [ "${STEP}" == "storagemap" ]; then
dialog --backtitle "$(backtitlep)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
@@ -190,9 +190,9 @@ function getmapSelection() {
fi
else
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "true" ] && [ "${MACHINE}" == "Native" ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "false" ]; then
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" == "false" ]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
@@ -201,27 +201,27 @@ function getmapSelection() {
# Check Remap for correct config
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
# Write Map to config and show Map to User
if [ "${REMAP}" = "acports" ]; then
if [ "${REMAP}" == "acports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "maxports" ]; then
elif [ "${REMAP}" == "maxports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "remap" ]; then
elif [ "${REMAP}" == "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
elif [ "${REMAP}" == "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
elif [ "${REMAP}" == "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"

View File

@@ -10,7 +10,7 @@ function updateLoader() {
if [ -z "${TAG}" ]; then
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
if [ "${ARC_BRANCH}" = "dev" ]; then
if [ "${ARC_BRANCH}" == "dev" ]; then
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
else
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
@@ -26,31 +26,30 @@ 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>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/update.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
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; # replacing space with nbsp as dialog squashes spaces
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download Update: ${TAG}..." 14 72 4>&-
} 4>&1
}' |
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--gauge "Download Loader: $TAG ..." 14 72
}
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 Loader successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
else
if [ "${ARCMODE}" = "update" ]; then
if [ "${ARCMODE}" == "update" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
sleep 3
@@ -60,7 +59,7 @@ function updateLoader() {
fi
fi
else
if [ "${ARCMODE}" = "update" ]; then
if [ "${ARCMODE}" == "update" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
sleep 3
@@ -71,15 +70,15 @@ function updateLoader() {
fi
fi
[ -n "${ARCCONF}" ] && cp -f "${TMP_PATH}/bak.yml" "${S_FILE}"
if [ "${ARCMODE}" = "update" ] && [ "${CONFDONE}" = "true" ]; then
if [ "${ARCMODE}" == "update" ] && [ "${CONFDONE}" == "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update Loader successful! -> Reboot to automated Build Mode..." 3 60
--infobox "Update successful! -> Reboot to automated Build Mode..." 3 60
sleep 3
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
rebootTo "automated"
else
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update Loader successful! -> Reboot to Config Mode..." 3 50
--infobox "Update successful! -> Reboot to Config Mode..." 3 50
sleep 3
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
rebootTo "config"
@@ -103,22 +102,21 @@ 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>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/addons.zip 2>&1 |
perl -C -lane '
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
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
}
if [ -f "${TMP_PATH}/addons.zip" ]; then
rm -rf "${ADDONS_PATH}"
mkdir -p "${ADDONS_PATH}"
@@ -134,7 +132,7 @@ function updateAddons() {
rm -f "${F}"
done
dialog --backtitle "$(backtitle)" --title "Update Addons" \
--infobox "Update Addons successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
else
return 1
@@ -163,22 +161,21 @@ 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>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/patches.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
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; # replacing space with nbsp as dialog squashes spaces
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download Patches: ${TAG}..." 14 72 4>&-
} 4>&1
}' |
dialog --backtitle "$(backtitle)" --title "Update Patches" \
--gauge "Download Patches: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/patches.zip" ]; then
rm -rf "${PATCH_PATH}"
mkdir -p "${PATCH_PATH}"
@@ -187,7 +184,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 Patches successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
else
return 1
@@ -216,22 +213,21 @@ 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>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/custom.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
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; # replacing space with nbsp as dialog squashes spaces
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download Custom: ${TAG}..." 14 72 4>&-
} 4>&1
}' |
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
--gauge "Download Custom Kernel: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/custom.zip" ]; then
rm -rf "${CUSTOM_PATH}"
mkdir -p "${CUSTOM_PATH}"
@@ -240,7 +236,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 Custom successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
else
return 1
@@ -259,7 +255,7 @@ function updateModules() {
local PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
local PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
local KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
@@ -269,35 +265,34 @@ function updateModules() {
sleep 3
idx=$((${idx} + 1))
done
if [ -n "${TAG}" ] && [ "${MODULESVERSION}" != "${TAG}" ]; then
if [ -n "${TAG}" ] && [[ "${MODULESVERSION}" != "${TAG}" || ! -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ]]; then
rm -rf "${MODULES_PATH}"
mkdir -p "${MODULES_PATH}"
export URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip"
export TAG="${TAG}"
{
{
curl -kL "${URL}" -o ${TMP_PATH}/modules.zip 2>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/modules.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
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; # replacing space with nbsp as dialog squashes spaces
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download Modules: ${TAG}..." 14 72 4>&-
} 4>&1
}' |
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--gauge "Download Modules: $TAG ..." 14 72
}
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 Modules successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
else
return 1
@@ -324,8 +319,8 @@ function updateModules() {
###############################################################################
# Update Configs
function updateConfigs() {
local ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
[ -f "${MODEL_CONFIG_PATH}/VERSION" ] && local CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")" || CONFIGSVERSION="0.0.0"
local USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
if [ -z "${1}" ]; then
idx=0
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
@@ -343,22 +338,21 @@ 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>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/configs.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
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; # replacing space with nbsp as dialog squashes spaces
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download Configs: ${TAG}..." 14 72 4>&-
} 4>&1
}' |
dialog --backtitle "$(backtitle)" --title "Update Configs" \
--gauge "Download Configs: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/configs.zip" ]; then
mkdir -p "${MODEL_CONFIG_PATH}"
dialog --backtitle "$(backtitle)" --title "Update Configs" \
@@ -366,9 +360,8 @@ 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 Configs successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
[ -n "${USERID}" ] && checkHardwareID || true
else
return 1
fi
@@ -400,22 +393,21 @@ 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>&3 3>&-
} 3>&1 >&4 4>&- |
curl -kL "$URL" -o ${TMP_PATH}/rp-lkms.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{URL}...\n\n"; $| = 1}
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; # replacing space with nbsp as dialog squashes spaces
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' 4>&- |
dialog --gauge "Download LKMs: ${TAG}..." 14 72 4>&-
} 4>&1
}' |
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--gauge "Download LKMs: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/rp-lkms.zip" ]; then
rm -rf "${LKMS_PATH}"
mkdir -p "${LKMS_PATH}"
@@ -424,7 +416,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 LKMs successful!" 3 50
--infobox "Update successful!" 3 50
sleep 2
else
return 1
@@ -454,7 +446,7 @@ function dependenciesUpdate() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
FAILED="false"
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Updating Dependencies..." 3 40
--infobox "Updating Dependencies..." 0 0
sleep 2
updateAddons
[ $? -ne 0 ] && FAILED="true"
@@ -468,13 +460,13 @@ function dependenciesUpdate() {
[ $? -ne 0 ] && FAILED="true"
updateOffline
[ $? -ne 0 ] && FAILED="true"
if [ "${FAILED}" = "true" ]; then
if [ "${FAILED}" == "true" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update Dependencies failed! Try again later." 3 40
--infobox "Update failed!\nTry again later." 0 0
sleep 3
elif [ "${FAILED}" = "false" ]; then
elif [ "${FAILED}" == "false" ]; then
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update Dependencies successful!" 3 40
--infobox "Update successful!" 0 0
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
sleep 3

View File

@@ -3,13 +3,15 @@
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}")
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
# Check if machine has EFI
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
# Print Title centralized
clear
@@ -36,6 +38,7 @@ initConfigKey "arc" "{}" "${USER_CONFIG_FILE}"
initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
@@ -93,16 +96,16 @@ 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:]')"
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
for ETH in ${ETHX}; do
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
if [ -n "${IPR}" ]; 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}
ip addr flush dev ${ETH}
ip addr add ${IPRA[0]}/${IPRA[1]:-"255.255.255.0"} dev ${ETH}
if [ -n "${IPRA[2]}" ]; then
ip route add default via ${IPRA[2]} dev ${N}
ip route add default via ${IPRA[2]} dev ${ETH}
fi
if [ -n "${IPRA[3]:-${IPRA[2]}}" ]; then
sed -i "/nameserver ${IPRA[3]:-${IPRA[2]}}/d" /etc/resolv.conf
@@ -110,11 +113,11 @@ for N in ${ETHX}; do
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}"
[ "${ETH::3}" == "eth" ] && ethtool -s ${ETH} wol g 2>/dev/null || true
# [ "${ETH::3}" == "eth" ] && ethtool -K ${ETH} rxhash off 2>/dev/null || true
initConfigKey "${ETH}" "${MACR}" "${USER_CONFIG_FILE}"
done
ETHN=$(echo ${ETHX} | wc -w)
ETHN="$(echo ${ETHX} | wc -w)"
writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}"
# No network devices
echo
@@ -125,7 +128,7 @@ VID="0x46f4"
PID="0x0001"
BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen"
if [ "${BUS}" = "usb" ]; then
if [ "${BUS}" == "usb" ]; then
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)"
PID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_MODEL_ID | cut -d= -f2)"
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
@@ -144,16 +147,16 @@ writeConfigKey "pid" "${PID}" "${USER_CONFIG_FILE}"
# Decide if boot automatically
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "config" ]; then
if [ "${ARCMODE}" == "config" ]; then
echo -e "\033[1;34mStarting Config Mode...\033[0m"
elif [ "${ARCMODE}" = "automated" ]; then
elif [ "${ARCMODE}" == "automated" ]; then
echo -e "\033[1;34mStarting automated Build Mode...\033[0m"
elif [ "${ARCMODE}" = "update" ]; then
elif [ "${ARCMODE}" == "update" ]; then
echo -e "\033[1;34mStarting Update Mode...\033[0m"
elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then
elif [ "${BUILDDONE}" == "true" ] && [ "${ARCMODE}" == "dsm" ]; then
echo -e "\033[1;34mStarting DSM Mode...\033[0m"
if [ -f "${ARC_PATH}/boot.sh" ]; then
exec boot.sh && exit 0
boot.sh && exit 0
else
echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m"
fi
@@ -169,18 +172,18 @@ IPCON=""
echo
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
sleep 3
for N in ${ETHX}; do
for ETH in ${ETHX}; do
COUNT=0
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
while true; do
if [ "0" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
break
fi
COUNT=$((${COUNT} + 1))
IP="$(getIP ${N})"
IP="$(getIP ${ETH})"
if [ -n "${IP}" ]; then
SPEED=$(ethtool ${N} 2>/dev/null | grep "Speed:" | awk '{print $2}')
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
if [[ "${IP}" =~ ^169\.254\..* ]]; then
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
else
@@ -189,7 +192,7 @@ for N in ${ETHX}; do
fi
break
fi
if [ -z "$(cat /sys/class/net/${N}}/carrier 2>/dev/null)" ]; then
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
break
fi

View File

@@ -2,9 +2,9 @@
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
. "${ARC_PATH}/include/functions.sh"
. "${ARC_PATH}/include/addons.sh"
. "${ARC_PATH}/include/modules.sh"
. ${ARC_PATH}/include/functions.sh
. ${ARC_PATH}/include/addons.sh
. ${ARC_PATH}/include/modules.sh
set -o pipefail # Get exit code from process piped
@@ -43,8 +43,8 @@ ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
[ "${PATURL:0:1}" = "#" ] && PATURL=""
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
[ "${PATURL:0:1}" == "#" ] && PATURL=""
[ "${PATSUM:0:1}" == "#" ] && PATSUM=""
# Check if DSM Version changed
. "${RAMDISK_PATH}/etc/VERSION"
@@ -67,7 +67,7 @@ writeConfigKey "smallnum" "${SMALLNUM}" "${USER_CONFIG_FILE}"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Sanity check
if [ -z "${PLATFORM}" ] || [ -z "${KVER}" ]; then
@@ -106,7 +106,7 @@ for PE in ${PATCHES[@]}; do
echo "Patching with ${PF}" >>"${LOG_FILE}"
(
cd "${RAMDISK_PATH}"
busybox patch -p1 -i "${PF}" >>"${LOG_FILE}" 2>&1 # busybox patch and gun patch have different processing methods and parameters.
patch -p1 -i "${PF}" >>"${LOG_FILE}" 2>&1 # busybox patch and gun patch have different processing methods and parameters.
)
RET=$?
[ ${RET} -eq 0 ] && break
@@ -168,7 +168,7 @@ chmod +x "${RAMDISK_PATH}/addons/addons.sh"
# System Addons
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "wol" "mountloader"; do
PARAMS=""
if [ "${ADDON}" = "disks" ]; then
if [ "${ADDON}" == "disks" ]; then
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
PARAMS="${HDDSORT} ${USBMOUNT}"
@@ -190,7 +190,7 @@ echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "Modify files" >"${LOG_FILE}"
# Remove function from scripts
[ "2" = "${PRODUCTVER:0:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
[ "2" == "${PRODUCTVER:0:1}" ] && sed -i 's/function //g' $(find "${RAMDISK_PATH}/addons/" -type f -name "*.sh")
# Build modules dependencies
# ${ARC_PATH}/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
@@ -228,14 +228,14 @@ for N in $(seq 0 7); do
done
# SA6400 patches
if [ "${PLATFORM}" = "epyc7002" ]; then
if [ "${PLATFORM}" == "epyc7002" ]; then
echo -n " - Apply Epyc7002 Fixes"
sed -i 's#/dev/console#/var/log/lrc#g' ${RAMDISK_PATH}/usr/bin/busybox
sed -i '/^echo "START/a \\nmknod -m 0666 /dev/console c 1 3' ${RAMDISK_PATH}/linuxrc.syno
fi
# Broadwellntbap patches
if [ "${PLATFORM}" = "broadwellntbap" ]; then
if [ "${PLATFORM}" == "broadwellntbap" ]; then
echo -n " - Apply Broadwellntbap Fixes"
sed -i 's/IsUCOrXA="yes"/XIsUCOrXA="yes"/g; s/IsUCOrXA=yes/XIsUCOrXA=yes/g' ${RAMDISK_PATH}/usr/syno/share/environments.sh
fi
@@ -247,7 +247,7 @@ for F in $(ls -1 ${USER_UP_PATH}/*.sh 2>/dev/null); do
done
# Reassembly ramdisk
if [ "${RD_COMPRESSED}" = "true" ]; then
if [ "${RD_COMPRESSED}" == "true" ]; then
(cd "${RAMDISK_PATH}" && find . 2>/dev/null | cpio -o -H newc -R root:root | xz -9 --format=lzma >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || exit 1
else
(cd "${RAMDISK_PATH}" && find . 2>/dev/null | cpio -o -H newc -R root:root >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || exit 1

View File

@@ -3,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,51 +14,61 @@ KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver"
# Output: LE HEX with size of file in bytes (to STDOUT)
file_size_le() {
printf $(
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
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
}
)
}
size_le() {
printf $(
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
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
}
)
}
VMLINUX_MOD=${1}
ZIMAGE_MOD=${2}
if [ "$(echo "${KVER:-4}" | cut -d'.' -f1)" -lt 5 ]; then
KVER_MAJOR=${KVER:0:1}
if [ ${KVER_MAJOR} -eq 4 ]; 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
@@ -66,7 +76,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
@@ -12,22 +12,22 @@ set -o pipefail # Get exit code from process piped
rm -f "${MOD_ZIMAGE_FILE}"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then
if [ "${KERNEL}" == "custom" ]; then
echo -n " - Using customized Kernel"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" = "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Extract bzImage
gzip -dc "${CUSTOM_PATH}/bzImage-${PLATFORM}-${KVERP}.gz" >"${MOD_ZIMAGE_FILE}"
else
# Extract vmlinux
"${ARC_PATH}/bzImage-to-vmlinux.sh" "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
${ARC_PATH}/bzImage-to-vmlinux.sh "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
# Patch boot params and ramdisk check
"${ARC_PATH}/kpatch" "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
${ARC_PATH}/kpatch "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
# rebuild zImage
"${ARC_PATH}/vmlinux-to-bzImage.sh" "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
${ARC_PATH}/vmlinux-to-bzImage.sh "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
fi
sync

View File

@@ -12,6 +12,7 @@ insmod fat
insmod ext2
insmod ata
insmod btrfs
insmod ntfs
insmod part_msdos
insmod part_gpt
@@ -77,7 +78,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 nointremap net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=passive nox2apic nomodeset"
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"
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 "${AUX_TOKEN}"
. scripts/func.sh
# Get extractor, LKM, addons and Modules
echo "Get Dependencies"
@@ -17,8 +17,7 @@ getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
mkdir -p "brx"
[ ! -f "../brx/bzImage" ] && getBuildrootx "brx" || copyBuildroot "brx"
getBuildrootx "brx"
# Sbase
IMAGE_FILE="arc.img"
@@ -36,22 +35,19 @@ mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.37.dev"
[[ ! -f "brx/bzImage-arc" || ! -f "brx/initrd-arc" ]] && return 1
ARC_BUILD="`date +'%y%m%d'`-dev"
ARC_VERSION="13.11"
ARC_BRANCH="next"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
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
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"
sudo cp -rf "files/p1/"* "/tmp/p1"
@@ -66,4 +62,4 @@ rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk

View File

@@ -5,7 +5,7 @@ set -e
# Clean cached Files
sudo git clean -fdx
. scripts/func.sh "${AUX_TOKEN}"
. scripts/func.sh
# 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"
[ -f "../brs/bzImage" ] && copyBuildroot "brs" || getBuildroots "brs"
getBuildroots "brs"
# Sbase
IMAGE_FILE="arc.img"
@@ -35,22 +35,19 @@ mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.37.dev"
[[ ! -f "brs/bzImage-arc" || ! -f "brs/initrd-arc" ]] && return 1
ARC_BUILD="`date +'%y%m%d'`-dev"
ARC_VERSION="13.11"
ARC_BRANCH="stable"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
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
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"
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
@@ -65,4 +62,4 @@ rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
qemu-img convert ${IMAGE_FILE} -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat arc.vmdk

View File

@@ -6,7 +6,30 @@
# See /LICENSE for more information.
#
[ -n "${1}" ] && export TOKEN="${1}"
# 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
}
# Get latest LKMs
# $1 path
@@ -175,44 +198,52 @@ function getBuildrootx() {
echo "Getting Buildroot-X begin"
local DEST_PATH="${1}"
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)
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
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"
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)"')
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
}
# Get latest Buildroot-S
# Get latest Buildroot-X
# $1 path
function getBuildroots() {
echo "Getting Buildroot-S begin"
local DEST_PATH="${1}"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
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"
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)"')
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
}
# Get latest Offline
@@ -232,49 +263,33 @@ function getOffline() {
}
# repack initrd
# $1 initrd file
# $1 initrd file
# $2 plugin path
# $3 output file
function repackInitrd() {
local INITRD_FILE="${1}"
local PLUGIN_PATH="${2}"
local OUTPUT_PATH="${3:-${INITRD_FILE}}"
INITRD_FILE="${1}"
PLUGIN_PATH="${2}"
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}")"
local RDXZ_PATH="rdxz_tmp"
RDXZ_PATH="rdxz_tmp"
mkdir -p "${RDXZ_PATH}"
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
(
cd "${RDXZ_PATH}"
sudo xz -dc <"${INITRD_FILE}" | sudo cpio -idm
) || true
sudo cp -rf "${PLUGIN_PATH}/"* "${RDXZ_PATH}/"
[ -f "${OUTPUT_PATH}" ] && rm -rf "${OUTPUT_PATH}"
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
(
cd "${RDXZ_PATH}"
sudo find . 2>/dev/null | sudo cpio -o -H newc -R root:root | xz -9 --check=crc32 >"${OUTPUT_PATH}"
) || true
sudo rm -rf "${RDXZ_PATH}"
}
@@ -398,9 +413,6 @@ 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"
@@ -412,12 +424,3 @@ _EOF_
ovftool/ovftool "OVA_${VMNAME}/${VMNAME}.vmx" "${OVAPATH}"
rm -rf "OVA_${VMNAME}"
}
# 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"
}