diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 758f3608..9f741ce4 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -49,15 +49,15 @@ function addonSelection() { touch "${TMP_PATH}/opts" while read -r ADDON DESC; do arrayExistItem "${ADDON}" "${!ADDONS[@]}" && ACT="on" || ACT="off" - if [[ "${ADDON}" == "amepatch" || "${ADDON}" == "arcdns" ]] && [ -z "${ARCCONF}" ]; then + if [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]] && [ -z "${ARCCONF}" ]; then continue - elif [ "${ADDON}" == "codecpatch" ] && [ -n "${ARCCONF}" ]; then + elif [ "${ADDON}" = "codecpatch" ] && [ -n "${ARCCONF}" ]; then continue else echo -e "${ADDON} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/opts" fi done < <(availableAddons "${PLATFORM}") - if [ "${STEP}" == "addons" ]; then + if [ "${STEP}" = "addons" ]; then dialog --backtitle "$(backtitlep)" --title "Addons" --colors --aspect 18 \ --checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \ --file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp" @@ -78,7 +78,7 @@ function addonSelection() { writeConfigKey "addons.\"${ADDON}\"" "" "${USER_CONFIG_FILE}" done ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")" - if [ "${STEP}" == "addons" ]; then + if [ "${STEP}" = "addons" ]; then dialog --backtitle "$(backtitlep)" --title "Addons" \ --msgbox "Addons selected:\n${ADDONSINFO}" 7 70 else @@ -95,7 +95,7 @@ function modulesMenu() { PLATFORM="$(readConfigKey "platform" "${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}" # menu loop while true; do dialog --backtitle "$(backtitle)" --title "Modules" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \ @@ -207,7 +207,7 @@ function modulesMenu() { --ok-label "Proceed" --msgbox "Please upload the *.ko file to /tmp/users.\n- Use SFTP at ${IPCON}:22 User: root PW: arc\n- Use Webclient at http://${IPCON}:7304" 7 50 for F in $(ls "${TMP_UP_PATH}" 2>/dev/null); do USER_FILE="${F}" - if [ -n "${USER_FILE}" ] && [ "${USER_FILE##*.}" == "ko" ]; then + if [ -n "${USER_FILE}" ] && [ "${USER_FILE##*.}" = "ko" ]; then addToModules "${PLATFORM}" "${KVERP}" "${TMP_UP_PATH}/${USER_FILE}" dialog --backtitle "$(backtitle)" --title "External Modules" \ --msgbox "Module: ${USER_FILE}\nadded to ${PLATFORM}-${KVERP}" 7 50 @@ -252,7 +252,7 @@ function modulesMenu() { KOLIST=($(echo ${KOLIST} | tr ' ' '\n' | sort -u)) while read -r ID DESC; do for MOD in ${KOLIST[@]}; do - [ "${MOD}" == "${ID}" ] && echo "F ${ID}.ko" >>"${TMP_PATH}/modulelist.tmp" + [ "${MOD}" = "${ID}" ] && echo "F ${ID}.ko" >>"${TMP_PATH}/modulelist.tmp" done done < <(getAllModules "${PLATFORM}" "${KVERP}") [ ! -d "${USER_UP_PATH}" ] && mkdir -p "${USER_UP_PATH}" @@ -627,7 +627,7 @@ function keymapMenu() { # Shows storagepanel menu to user function storagepanelMenu() { CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" - if [ "${CONFDONE}" == "true" ]; then + if [ "${CONFDONE}" = "true" ]; then while true; do STORAGEPANELUSER="$(readConfigKey "addons.storagepanel" "${USER_CONFIG_FILE}")" [ -n "${STORAGEPANELUSER}" ] && DISKPANELUSER="$(echo ${STORAGEPANELUSER} | cut -d' ' -f1)" || DISKPANELUSER="RACK_24_Bay" @@ -660,7 +660,7 @@ function storagepanelMenu() { # Shows sequentialIO menu to user function sequentialIOMenu() { CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" - if [ "${CONFDONE}" == "true" ]; then + if [ "${CONFDONE}" = "true" ]; then while true; do dialog --backtitle "$(backtitle)" --title "SequentialIO" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \ 1 "Enable for SSD Cache" \ @@ -751,7 +751,7 @@ function backupMenu() { if [ -n "${PRODUCTVER}" ]; then PLATFORM="$(readConfigKey "platform" "${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}" fi if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" @@ -813,7 +813,7 @@ function backupMenu() { rm -rf "${TMP_PATH}/mdX" >/dev/null ) 2>&1 | dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \ --progressbox "Backup Encryption Key ..." 20 70 - if [ "${BACKUPKEY}" == "true" ]; then + if [ "${BACKUPKEY}" = "true" ]; then dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \ --msgbox "Encryption Key backup successful!" 0 0 else @@ -922,7 +922,7 @@ function storageMenu() { DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" # Get Portmap for Loader getmap - if [ "${DT}" == "false" ] && [ $(lspci -d ::106 | wc -l) -gt 0 ]; then + if [ "${DT}" = "false" ] && [ $(lspci -d ::106 | wc -l) -gt 0 ]; then getmapSelection fi writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" @@ -954,7 +954,7 @@ function sysinfo() { ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")" CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")" - if [ "${CONFDONE}" == "true" ]; then + if [ "${CONFDONE}" = "true" ]; then MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" @@ -964,18 +964,18 @@ function sysinfo() { 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 PORTMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")" - elif [ "${REMAP}" == "ahci" ]; then + elif [ "${REMAP}" = "ahci" ]; then AHCIPORTMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")" fi USERCMDLINEINFO="$(readConfigMap "cmdline" "${USER_CONFIG_FILE}")" USERSYNOINFO="$(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")" fi - [ "${CONFDONE}" == "true" ] && BUILDNUM="$(readConfigKey "buildnum" "${USER_CONFIG_FILE}")" + [ "${CONFDONE}" = "true" ] && BUILDNUM="$(readConfigKey "buildnum" "${USER_CONFIG_FILE}")" DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")" LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")" KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")" @@ -1045,8 +1045,8 @@ function sysinfo() { TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn" TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn" TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn" - [ "${ARCOFFLINE}" == "true" ] && TEXT+="\n Offline Mode: \Zb${ARCOFFLINE}\Zn" - if [ "${CONFDONE}" == "true" ]; then + [ "${ARCOFFLINE}" = "true" ] && TEXT+="\n Offline Mode: \Zb${ARCOFFLINE}\Zn" + if [ "${CONFDONE}" = "true" ]; then TEXT+="\n\Z4> DSM ${PRODUCTVER} (${BUILDNUM}): ${MODELID:-${MODEL}}\Zn" TEXT+="\n Kernel | LKM: \Zb${KVER} | ${LKM}\Zn" TEXT+="\n Platform | DeviceTree: \Zb${PLATFORM} | ${DT}\Zn" @@ -1059,26 +1059,26 @@ function sysinfo() { TEXT+="\n Config not completed!\n" fi TEXT+="\n Modules loaded: \Zb${MODULESINFO}\Zn" - if [ "${CONFDONE}" == "true" ]; then + if [ "${CONFDONE}" = "true" ]; then [ -n "${USERCMDLINEINFO}" ] && TEXT+="\n User Cmdline: \Zb${USERCMDLINEINFO}\Zn" TEXT+="\n User Synoinfo: \Zb${USERSYNOINFO}\Zn" fi TEXT+="\n" TEXT+="\n\Z4> Settings\Zn" - if [[ "${REMAP}" == "acports" || "${REMAP}" == "maxports" ]]; then + if [[ "${REMAP}" = "acports" || "${REMAP}" = "maxports" ]]; then TEXT+="\n SataPortMap | DiskIdxMap: \Zb${PORTMAP} | ${DISKMAP}\Zn" - elif [ "${REMAP}" == "remap" ]; then + elif [ "${REMAP}" = "remap" ]; then TEXT+="\n SataRemap: \Zb${PORTMAP}\Zn" - elif [ "${REMAP}" == "ahci" ]; then + elif [ "${REMAP}" = "ahci" ]; then TEXT+="\n AhciRemap: \Zb${AHCIPORTMAP}\Zn" - elif [ "${REMAP}" == "user" ]; then + elif [ "${REMAP}" = "user" ]; then TEXT+="\n PortMap: \Zb"User"\Zn" [ -n "${PORTMAP}" ] && TEXT+="\n SataPortmap: \Zb${PORTMAP}\Zn" [ -n "${DISKMAP}" ] && TEXT+="\n DiskIdxMap: \Zb${DISKMAP}\Zn" [ -n "${PORTREMAP}" ] && TEXT+="\n SataRemap: \Zb${PORTREMAP}\Zn" [ -n "${AHCIPORTREMAP}" ] && TEXT+="\n AhciRemap: \Zb${AHCIPORTREMAP}\Zn" fi - if [ "${DT}" == "true" ]; then + if [ "${DT}" = "true" ]; then TEXT+="\n Hotplug: \Zb${HDDSORT}\Zn" else TEXT+="\n USB Mount: \Zb${USBMOUNT}\Zn" @@ -1099,8 +1099,8 @@ function sysinfo() { PORTS=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n) for P in ${PORTS}; do if lsscsi -b | grep -v - | grep -q "\[${P}:"; then - DUMMY="$([ "$(cat /sys/class/scsi_host/host${P}/ahci_port_cmd)" == "0" ] && echo 1 || echo 2)" - if [ "$(cat /sys/class/scsi_host/host${P}/ahci_port_cmd)" == "0" ]; then + DUMMY="$([ "$(cat /sys/class/scsi_host/host${P}/ahci_port_cmd)" = "0" ] && echo 1 || echo 2)" + if [ "$(cat /sys/class/scsi_host/host${P}/ahci_port_cmd)" = "0" ]; then TEXT+="\Z1\Zb$(printf "%02d" ${P})\Zn " else TEXT+="\Z2\Zb$(printf "%02d" ${P})\Zn " @@ -1269,7 +1269,7 @@ function networkdiag() { dnsserver=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}') echo -e "DNS Server:\n${dnsserver}" echo - if [ "${ARCOFFLINE}" == "true" ]; then + if [ "${ARCOFFLINE}" = "true" ]; then echo -e "Offline Mode: ${ARCOFFLINE}" else websites=("google.com" "github.com" "auxxxilium.tech") @@ -1294,7 +1294,7 @@ function networkdiag() { else echo -e "Github API reachable!" fi - if [ "${CONFDONE}" == "true" ]; then + if [ "${CONFDONE}" = "true" ]; then SYNOAPI=$(curl --interface ${N} -skL -m 10 "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url') if [[ $? -ne 0 || -z "${SYNOAPI}" ]]; then echo -e "Syno API not reachable!" @@ -1465,7 +1465,7 @@ function resetPassword() { while read L; do U=$(echo "${L}" | awk -F ':' '{if ($2 != "*" && $2 != "!!") print $1;}') [ -z "${U}" ] && continue - E=$(echo "${L}" | awk -F ':' '{if ($8 == "1") print "disabled"; else print " ";}') + E=$(echo "${L}" | awk -F ':' '{if ($8 = "1") print "disabled"; else print " ";}') grep -q "status=on" "${TMP_PATH}/mdX/usr/syno/etc/packages/SecureSignIn/preference/${U}/method.config" 2>/dev/null [ $? -eq 0 ] && S="SecureSignIn" || S=" " printf "\"%-36s %-10s %-14s\"\n" "${U}" "${E}" "${S}" >>"${TMP_PATH}/menu" @@ -1557,7 +1557,7 @@ EOF rm -rf "${TMP_PATH}/mdX" >/dev/null ) 2>&1 | dialog --backtitle "$(backtitle)" --title "Add DSM User" \ --progressbox "Adding ..." 20 100 - [ "$(cat ${TMP_PATH}/isEnable 2>/dev/null)" == "true" ] && MSG="Add DSM User successful." || MSG="Add DSM User failed." + [ "$(cat ${TMP_PATH}/isEnable 2>/dev/null)" = "true" ] && MSG="Add DSM User successful." || MSG="Add DSM User failed." dialog --backtitle "$(backtitle)" --title "Add DSM User" \ --msgbox "${MSG}" 0 0 return @@ -1722,9 +1722,9 @@ function formatDisks() { rm -f "${TMP_PATH}/opts" while read -r KNAME SIZE TYPE PKNAME; do [ -z "${KNAME}" ] && continue - [ "${KNAME}" == "N/A" ] && continue - [[ "${KNAME}" == /dev/md* ]] && continue - [[ "${KNAME}" == "${LOADER_DISK}" || "${PKNAME}" == "${LOADER_DISK}" ]] && continue + [ "${KNAME}" = "N/A" ] && continue + [[ "${KNAME}" = /dev/md* ]] && continue + [[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue [ -z "${SIZE}" ] && SIZE="Unknown" printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts" done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null) @@ -1769,10 +1769,10 @@ function cloneLoader() { rm -f "${TMP_PATH}/opts" >/dev/null while read -r KNAME SIZE TYPE PKNAME; do [ -z "${KNAME}" ] && continue - [ "${KNAME}" == "N/A" ] && continue + [ "${KNAME}" = "N/A" ] && continue [ "${TYPE}" != "disk" ] && continue - [[ "${KNAME}" == /dev/md* ]] && continue - [[ "${KNAME}" == "${LOADER_DISK}" || "${PKNAME}" == "${LOADER_DISK}" ]] && continue + [[ "${KNAME}" = /dev/md* ]] && continue + [[ "${KNAME}" = "${LOADER_DISK}" || "${PKNAME}" = "${LOADER_DISK}" ]] && continue [ -z "${SIZE}" ] && SIZE="Unknown" printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" >>"${TMP_PATH}/opts" done < <(lsblk -Jpno KNAME,SIZE,TYPE,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.pkname)"' 2>/dev/null) @@ -1791,7 +1791,7 @@ function cloneLoader() { --msgbox "No disk selected!" 0 0 return else - SIZE=$(df -m ${resp} 2>/dev/null | awk 'NR==2 {print $2}') + SIZE=$(df -m ${resp} 2>/dev/null | awk 'NR=2 {print $2}') if [ ${SIZE:-0} -lt 1024 ]; then dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \ --msgbox "Disk ${resp} size is less than 1GB and cannot be cloned!" 0 0 @@ -1984,7 +1984,7 @@ function rebootMenu() { echo -e "config \"Arc: Config Mode\"" >>"${TMP_PATH}/opts" echo -e "update \"Arc: Automated Update Mode\"" >>"${TMP_PATH}/opts" echo -e "network \"Arc: Restart Network Service\"" >>"${TMP_PATH}/opts" - if [ "${BUILDDONE}" == "true" ]; then + if [ "${BUILDDONE}" = "true" ]; then echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/opts" echo -e "junior \"DSM: Reinstall Mode\"" >>"${TMP_PATH}/opts" fi @@ -2000,13 +2000,13 @@ function rebootMenu() { REDEST=${resp} dialog --backtitle "$(backtitle)" --title "Power Menu" \ --infobox "Option: ${REDEST} selected ...!" 3 50 - if [ "${REDEST}" == "poweroff" ]; then + if [ "${REDEST}" = "poweroff" ]; then poweroff exit 0 - elif [ "${REDEST}" == "shell" ]; then + elif [ "${REDEST}" = "shell" ]; then clear exit 0 - elif [ "${REDEST}" == "network" ]; then + elif [ "${REDEST}" = "network" ]; then clear /etc/init.d/S41dhcpcd restart exec init.sh @@ -2085,9 +2085,9 @@ function governorMenu () { function governorSelection () { rm -f "${TMP_PATH}/opts" >/dev/null touch "${TMP_PATH}/opts" - if [ "${ARCMODE}" == "config" ]; then + if [ "${ARCMODE}" = "config" ]; then # Selectable CPU governors - [ "${PLATFORM}" == "epyc7002" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts" + [ "${PLATFORM}" = "epyc7002" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts" [ "${PLATFORM}" != "epyc7002" ] && echo -e "ondemand \"use ondemand to scale frequency *\"" >>"${TMP_PATH}/opts" [ "${PLATFORM}" != "epyc7002" ] && echo -e "conservative \"use conservative to scale frequency\"" >>"${TMP_PATH}/opts" echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts" @@ -2100,7 +2100,7 @@ function governorSelection () { [ -z "${resp}" ] && return CPUGOVERNOR=${resp} else - [ "${PLATFORM}" == "epyc7002" ] && CPUGOVERNOR="schedutil" + [ "${PLATFORM}" = "epyc7002" ] && CPUGOVERNOR="schedutil" [ "${PLATFORM}" != "epyc7002" ] && CPUGOVERNOR="ondemand" fi writeConfigKey "addons.cpufreqscaling" "${CPUGOVERNOR}" "${USER_CONFIG_FILE}" @@ -2213,7 +2213,7 @@ function getpatfiles() { mkdir -p "${USER_UP_PATH}" DSM_FILE="${USER_UP_PATH}/${PAT_HASH}.tar" VALID="false" - if [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" == "false" ]; then + if [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" = "false" ]; then rm -f ${USER_UP_PATH}/*.tar dialog --backtitle "$(backtitlep)" --colors --title "DSM Boot Files" \ --infobox "Downloading DSM Boot Files..." 3 40 @@ -2222,7 +2222,7 @@ function getpatfiles() { if curl -skL "${DSM_URL}" -o "${DSM_FILE}" 2>/dev/null; then VALID="true" fi - elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" == "true" ]; then + elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" = "true" ]; then rm -f ${USER_UP_PATH}/*.tar dialog --backtitle "$(backtitlep)" --colors --title "DSM Boot Files" \ --msgbox "Please upload the DSM Boot File to ${USER_UP_PATH}.\nUse ${IPCON}:7304 to upload and press OK after it's finished.\nLink: https://github.com/AuxXxilium/arc-dsm/blob/main/files/${MODEL}/${PRODUCTVER}/${PAT_HASH}.tar" 8 120 @@ -2234,7 +2234,7 @@ function getpatfiles() { VALID="true" fi mkdir -p "${UNTAR_PAT_PATH}" - if [ "${VALID}" == "true" ]; then + if [ "${VALID}" = "true" ]; then dialog --backtitle "$(backtitlep)" --title "DSM Boot Files" --aspect 18 \ --infobox "Copying DSM Boot Files..." 3 40 tar -xf "${DSM_FILE}" -C "${UNTAR_PAT_PATH}" 2>/dev/null diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 0420ca8a..a997ae25 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -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}" } @@ -105,7 +105,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 @@ -116,16 +116,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 @@ -134,18 +134,18 @@ 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 @@ -194,7 +194,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}" @@ -243,7 +243,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)" \ @@ -276,7 +276,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" @@ -322,11 +322,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 @@ -338,27 +338,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 @@ -375,7 +375,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 @@ -383,7 +383,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" @@ -410,11 +410,11 @@ 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 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 \ @@ -470,14 +470,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 @@ -486,7 +486,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" \ @@ -495,17 +495,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 @@ -516,24 +516,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 @@ -545,7 +545,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 \ @@ -585,12 +585,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}")" @@ -607,7 +607,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 @@ -622,7 +622,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" @@ -631,7 +631,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" @@ -676,7 +676,7 @@ function make() { # Check for Arc Patch ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" - if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" == "false" ]; then + if [ -z "${ARCCONF}" ] || [ "${ARCPATCH}" = "false" ]; then deleteConfigKey "addons.amepatch" "${USER_CONFIG_FILE}" deleteConfigKey "addons.arcdns" "${USER_CONFIG_FILE}" fi @@ -694,7 +694,7 @@ function make() { sleep 2 return 1 fi - if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" == "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then + if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" = "true" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then ( livepatch sleep 3 @@ -734,7 +734,7 @@ 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 @@ -760,7 +760,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 @@ -780,7 +780,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 @@ -799,7 +799,7 @@ function boot() { ############################################################################### # Main loop # Check for Arc Mode -if [ "${ARCMODE}" == "update" ]; then +if [ "${ARCMODE}" = "update" ]; then if [ "${ARCOFFLINE}" != "true" ]; then updateLoader else @@ -808,48 +808,48 @@ if [ "${ARCMODE}" == "update" ]; then sleep 3 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" ] && [ -n "${IPCON}" ]; 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 @@ -862,27 +862,27 @@ else echo "Q \"SequentialIO Options \" " >>"${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" + 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 "l \"Edit User Config \" " >>"${TMP_PATH}/menu" @@ -892,10 +892,10 @@ else echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu" echo "M \"Mount DSM Storage Pool (not SHR) \" " >>"${TMP_PATH}/menu" echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu" - if [ "${PLATFORM}" == "epyc7002" ]; then + if [ "${PLATFORM}" = "epyc7002" ]; then echo "K \"Kernel: \Z4${KERNEL}\Zn \" " >>"${TMP_PATH}/menu" fi - if [ "${DT}" == "true" ]; then + if [ "${DT}" = "true" ]; then echo "H \"Hotplug/SortDrives: \Z4${HDDSORT}\Zn \" " >>"${TMP_PATH}/menu" else echo "h \"USB Mount: \Z4${USBMOUNT}\Zn \" " >>"${TMP_PATH}/menu" @@ -904,14 +904,14 @@ else echo "B \"Grep DSM Config from Backup \" " >>"${TMP_PATH}/menu" fi fi - if [ "${LOADEROPTS}" == "true" ]; then + if [ "${LOADEROPTS}" = "true" ]; then echo "8 \"\Z1Hide Loader Options\Zn \" " >>"${TMP_PATH}/menu" else echo "8 \"\Z1Show Loader Options\Zn \" " >>"${TMP_PATH}/menu" fi - if [ "${LOADEROPTS}" == "true" ]; then - echo "= \"\Z4========= Loader =========\Zn \" " >>"${TMP_PATH}/menu" - echo "= \"\Z1=== Edit with caution! ===\Zn \" " >>"${TMP_PATH}/menu" + 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" @@ -927,7 +927,7 @@ else 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" @@ -948,7 +948,7 @@ 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" ;; @@ -962,22 +962,22 @@ else 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}" @@ -989,13 +989,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" ;; @@ -1009,11 +1009,11 @@ else M) mountDSM; NEXT="M" ;; T) disablescheduledTasks; NEXT="T" ;; Z) loaderPorts; NEXT="Z" ;; - K) [ "${KERNEL}" == "official" ] && KERNEL='custom' || KERNEL='official' + 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 @@ -1021,7 +1021,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}" @@ -1031,17 +1031,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}" @@ -1049,7 +1049,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}")" @@ -1057,25 +1057,25 @@ else ;; B) getbackup; NEXT="B" ;; # Loader Section - 8) [ "${LOADEROPTS}" == "true" ] && LOADEROPTS='false' || LOADEROPTS='true' + 8) [ "${LOADEROPTS}" = "true" ] && LOADEROPTS='false' || LOADEROPTS='true' LOADEROPTS="${LOADEROPTS}" NEXT="8" ;; D) staticIPMenu; NEXT="D" ;; - c) [ "${ARCOFFLINE}" == "true" ] && ARCOFFLINE='false' || ARCOFFLINE='true' + c) [ "${ARCOFFLINE}" = "true" ] && ARCOFFLINE='false' || ARCOFFLINE='true' writeConfigKey "arc.offline" "${ARCOFFLINE}" "${USER_CONFIG_FILE}" - [ "${ARCOFFLINE}" == "false" ] && exec arc.sh + [ "${ARCOFFLINE}" = "false" ] && exec arc.sh NEXT="c" ;; f) bootScreen; NEXT="f" ;; - W) [ "${RD_COMPRESSED}" == "true" ] && RD_COMPRESSED='false' || RD_COMPRESSED='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}")" diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index ff53d6ba..e93a9d03 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -9,7 +9,7 @@ set -e 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 @@ -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 @@ -167,13 +167,13 @@ CMDLINE['modprobe.blacklist']="${MODBLACKLIST}" #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 @@ -244,7 +244,7 @@ function _bootwait() { # 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" @@ -252,14 +252,14 @@ if [ "${DIRECTBOOT}" == "true" ]; then echo -e "\033[1;34mReboot with Directboot\033[0m" 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" @@ -301,7 +301,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then _bootwait || true DSMLOGO="$(readConfigKey "boot.dsmlogo" "${USER_CONFIG_FILE}")" - if [ "${DSMLOGO}" == "true" ] && [ -c "/dev/fb0" ]; then + if [ "${DSMLOGO}" = "true" ] && [ -c "/dev/fb0" ]; then [[ "${IPCON}" =~ ^169\.254\..* ]] && IPCON="" [ -n "${IPCON}" ] && URL="http://${IPCON}:5000" || URL="http://find.synology.com/" python ${ARC_PATH}/include/functions.py makeqr -d "${URL}" -l "6" -o "${TMP_PATH}/qrcode_boot.png" @@ -325,6 +325,6 @@ elif [ "${DIRECTBOOT}" == "false" ]; then echo -e "\033[1;37mBooting DSM...\033[0m" # Boot to DSM - [ "${KERNELLOAD}" == "kexec" ] && kexec -e || poweroff + [ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff exit 0 fi \ No newline at end of file diff --git a/files/initrd/opt/arc/include/addons.sh b/files/initrd/opt/arc/include/addons.sh index fdae7677..5bbb12b3 100755 --- a/files/initrd/opt/arc/include/addons.sh +++ b/files/initrd/opt/arc/include/addons.sh @@ -15,19 +15,24 @@ function availableAddons() { [ "${AVAILABLE}" = false ] && continue local SYSTEM=$(readConfigKey "system" "${D}/manifest.yml") [ "${SYSTEM}" = true ] && continue - if [[ "${ARCOFFLINE}" == "true" || -z "${ARCCONF}" ]] && [[ "${ADDON}" == "amepatch" || "${ADDON}" == "arcdns" ]]; then + if [[ "${ARCOFFLINE}" = "true" || -z "${ARCCONF}" ]] && [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]]; then continue fi - if [ "${MACHINE}" != "Native" ] && [ "${ADDON}" == "cpufreqscaling" ]; then + if [ "${MACHINE}" != "Native" ] && [ "${ADDON}" = "cpufreqscaling" ]; then continue fi + if echo "${PAT_URL}" 2>/dev/null | grep -vq "7.2.2"; then + if [ "${ADDON}" = "allowdowngrade" ]; then + continue + fi + fi local DESC="$(readConfigKey "description" "${D}/manifest.yml")" local BETA="$(readConfigKey "beta" "${D}/manifest.yml")" local TARGET="$(readConfigKey "target" "${D}/manifest.yml")" [ "${BETA}" = true ] && BETA="(Beta) " || BETA="" - if [ "${TARGET}" == "app" ]; then + if [ "${TARGET}" = "app" ]; then [ "${AVAILABLE}" = true ] && echo -e "${ADDON}\t\Z4${BETA}${DESC}\Zn" - elif [ "${TARGET}" == "system" ]; then + elif [ "${TARGET}" = "system" ]; then [ "${AVAILABLE}" = true ] && echo -e "${ADDON}\t\Z1${BETA}${DESC}\Zn" else [ "${AVAILABLE}" = true ] && echo -e "${ADDON}\t${BETA}${DESC}" diff --git a/files/initrd/opt/arc/include/configFile.sh b/files/initrd/opt/arc/include/configFile.sh index 1ac1ed20..06d99cfc 100755 --- a/files/initrd/opt/arc/include/configFile.sh +++ b/files/initrd/opt/arc/include/configFile.sh @@ -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}" } ############################################################################### diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index 47e62375..106e56cf 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -9,7 +9,7 @@ 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 @@ -382,7 +382,7 @@ function rebootTo() { local MODES="config recovery junior automated update bios memtest" [ -z "${1}" ] && exit 1 if ! echo "${MODES}" | grep -qw "${1}"; then exit 1; fi - [ "${1}" == "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated" + [ "${1}" = "automated" ] && echo "arc-${MODEL}-${PRODUCTVER}-${ARC_VERSION}" >"${PART3_PATH}/automated" [ ! -f "${USER_GRUBENVFILE}" ] && grub-editenv ${USER_GRUBENVFILE} create # echo -e "Rebooting to ${1} mode..." grub-editenv ${USER_GRUBENVFILE} set next_entry="${1}" @@ -437,7 +437,7 @@ function extractDSMFiles() { echo -e "Could not determine if pat file is encrypted or not, maybe corrupted, try again!" ;; esac - if [ "${isencrypted}" == "yes" ]; then + if [ "${isencrypted}" = "yes" ]; then # Uses the extractor to untar PAT file LD_LIBRARY_PATH="${EXTRACTOR_PATH}" "${EXTRACTOR_PATH}/${EXTRACTOR_BIN}" "${PAT_PATH}" "${EXT_PATH}" >"${LOG_FILE}" 2>&1 else @@ -465,7 +465,7 @@ function livepatch() { echo -e " - failed!" PVALID="false" fi - if [ "${PVALID}" == "true" ]; then + if [ "${PVALID}" = "true" ]; then # Patch Ramdisk echo -n "Patching Ramdisk" if ${ARC_PATH}/ramdisk-patch.sh; then @@ -476,12 +476,12 @@ function livepatch() { PVALID="false" fi fi - if [ "${PVALID}" == "false" ]; then + if [ "${PVALID}" = "false" ]; then echo echo -e "Patching DSM Files failed! Please stay patient for Update." sleep 5 exit 1 - elif [ "${PVALID}" == "true" ]; then + elif [ "${PVALID}" = "true" ]; then ZIMAGE_HASH="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')" writeConfigKey "zimage-hash" "${ZIMAGE_HASH}" "${USER_CONFIG_FILE}" RAMDISK_HASH="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')" @@ -517,7 +517,7 @@ function onlineCheck() { [ -z "${KEYMAP}" ] && KEYMAP="us" loadkeys ${KEYMAP} fi - if [ "${KEYMAP}" == "ua" ]; then + if [ "${KEYMAP}" = "ua" ]; then poweroff fi } @@ -551,7 +551,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" diff --git a/files/initrd/opt/arc/include/modules.sh b/files/initrd/opt/arc/include/modules.sh index 989a6153..9c45df4c 100755 --- a/files/initrd/opt/arc/include/modules.sh +++ b/files/initrd/opt/arc/include/modules.sh @@ -14,7 +14,7 @@ function getAllModules() { rm -rf "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules" local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")" - if [ "${KERNEL}" == "custom" ]; then + if [ "${KERNEL}" = "custom" ]; then tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" else tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" @@ -49,7 +49,7 @@ function installModules() { rm -rf "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules" local KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")" - if [ "${KERNEL}" == "custom" ]; then + if [ "${KERNEL}" = "custom" ]; then tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}" else tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" 2>"${LOG_FILE}" @@ -61,7 +61,7 @@ function installModules() { local ODP="$(readConfigKey "odp" "${USER_CONFIG_FILE}")" for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do local M=$(basename ${F}) - [ "${ODP}" == "true" -a -f "${RAMDISK_PATH}/usr/lib/modules/${M}" ] && continue + [ "${ODP}" = "true" -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" diff --git a/files/initrd/opt/arc/include/network.sh b/files/initrd/opt/arc/include/network.sh index 39b343de..41c35899 100755 --- a/files/initrd/opt/arc/include/network.sh +++ b/files/initrd/opt/arc/include/network.sh @@ -5,19 +5,19 @@ function getnet() { 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 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 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 while true; do diff --git a/files/initrd/opt/arc/include/storage.sh b/files/initrd/opt/arc/include/storage.sh index bdc9ba2b..16b18f84 100755 --- a/files/initrd/opt/arc/include/storage.sh +++ b/files/initrd/opt/arc/include/storage.sh @@ -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}" diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index 57d306ec..cf0b2a95 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -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)" @@ -34,7 +34,7 @@ function updateLoader() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -49,7 +49,7 @@ function updateLoader() { --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 @@ -59,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 @@ -70,7 +70,7 @@ function updateLoader() { fi fi [ -n "${ARCCONF}" ] && cp -f "${TMP_PATH}/bak.yml" "${S_FILE}" - if [ "${ARCMODE}" == "update" ] && [ "${CONFDONE}" == "true" ]; then + if [ "${ARCMODE}" = "update" ] && [ "${CONFDONE}" = "true" ]; then dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \ --infobox "Update successful! -> Reboot to automated Build Mode..." 3 60 sleep 3 @@ -110,7 +110,7 @@ function updateAddons() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -169,7 +169,7 @@ function updatePatches() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -221,7 +221,7 @@ function updateCustom() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -255,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)" @@ -279,7 +279,7 @@ function updateModules() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -346,7 +346,7 @@ function updateConfigs() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -402,7 +402,7 @@ function updateLKMs() { s/ /\xa0/g; if ($. <= 3) { $header .= "$_\n"; - $/ = "\r" if $. == 2 + $/ = "\r" if $. = 2 } else { print "XXX\n$pcent\n$header$_\nXXX" }' | @@ -461,11 +461,11 @@ function dependenciesUpdate() { [ $? -ne 0 ] && FAILED="true" updateOffline [ $? -ne 0 ] && FAILED="true" - if [ "${FAILED}" == "true" ]; then + if [ "${FAILED}" = "true" ]; then dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \ --infobox "Update failed! Try again later." 3 40 sleep 3 - elif [ "${FAILED}" == "false" ]; then + elif [ "${FAILED}" = "false" ]; then dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \ --infobox "Update successful!" 3 40 writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 9eeb3f7b..96d82bc0 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -112,8 +112,8 @@ 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 + [ "${N::3}" = "eth" ] && ethtool -s ${N} wol g 2>/dev/null || true + # [ "${N::3}" = "eth" ] && ethtool -K ${N} rxhash off 2>/dev/null || true initConfigKey "${N}" "${MACR}" "${USER_CONFIG_FILE}" done ETHN=$(echo ${ETHX} | wc -w) @@ -127,7 +127,7 @@ VID="0x46f4" PID="0x0001" BUSLIST="usb sata sas scsi nvme mmc ide virtio vmbus xen" -if [ "${BUS}" == "usb" ]; then +if [ "${BUS}" = "usb" ]; then VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)" PID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_MODEL_ID | cut -d= -f2)" elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then @@ -146,13 +146,13 @@ 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 diff --git a/files/initrd/opt/arc/ramdisk-patch.sh b/files/initrd/opt/arc/ramdisk-patch.sh index cd27175a..9823e5c5 100755 --- a/files/initrd/opt/arc/ramdisk-patch.sh +++ b/files/initrd/opt/arc/ramdisk-patch.sh @@ -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 @@ -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 diff --git a/files/initrd/opt/arc/zimage-patch.sh b/files/initrd/opt/arc/zimage-patch.sh index bec27c41..020a2339 100755 --- a/files/initrd/opt/arc/zimage-patch.sh +++ b/files/initrd/opt/arc/zimage-patch.sh @@ -12,13 +12,13 @@ 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