From 430f31edcc1ce44f670150b0b9891d844fc82939 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 17 Sep 2024 18:48:05 +0200 Subject: [PATCH 1/2] tree: fix syntax Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 4 ++-- files/initrd/opt/arc/arc.sh | 4 ++-- files/initrd/opt/arc/init.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index bd9c29e7..e40b3330 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1496,7 +1496,7 @@ function staticIPMenu() { 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}")" - IFS='/' read -r -a IPRA <<<"$IPR" + IFS='/' read -r -a IPRA <<<"${IPR}" MSG="$(printf "Set to %s: (Delete if empty)" "${ETH}(${MACR})")" while true; do @@ -1538,7 +1538,7 @@ function staticIPMenu() { MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')" IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")" if [ -n "${IPR}" ]; then - IFS='/' read -r -a IPRA <<<"$IPR" + IFS='/' read -r -a IPRA <<<"${IPR}" ip addr flush dev ${ETH} ip addr add ${IPRA[0]}/${IPRA[1]:-"255.255.255.0"} dev ${ETH} [ -z "${IPCON}" ] && IPCON="${IPRA[0]}" diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index fff5c10d..69c2e13a 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -101,8 +101,8 @@ function arcModel() { fi echo -n "" >"${TMP_PATH}/modellist" echo "${MJ}" | jq -c '.[]' | while read -r item; do - name=$(echo "$item" | jq -r '.name') - arch=$(echo "$item" | jq -r '.arch') + name=$(echo "${item}" | jq -r '.name') + arch=$(echo "${item}" | jq -r '.arch') echo "${name} ${arch}" >>"${TMP_PATH}/modellist" done if [ "${AUTOMATED}" == "false" ]; then diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index bf2eacfa..823c08e6 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -106,7 +106,7 @@ for ETH in ${ETHX}; do MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')" IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")" if [ -n "${IPR}" ]; then - IFS='/' read -r -a IPRA <<<"$IPR" + IFS='/' read -r -a IPRA <<<"${IPR}" ip addr flush dev ${ETH} ip addr add ${IPRA[0]}/${IPRA[1]:-"255.255.255.0"} dev ${ETH} if [ -n "${IPRA[2]}" ]; then From 20d65f42e9b3dbd0dc60f7562fa7cce7ee84493a Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 17 Sep 2024 18:56:39 +0200 Subject: [PATCH 2/2] tree: fix more syntax Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 14 +++++++------- files/initrd/opt/arc/arc.sh | 6 +++--- files/initrd/opt/arc/boot.sh | 8 ++++---- files/initrd/opt/arc/include/update.sh | 4 ++-- files/initrd/opt/arc/init.sh | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index e40b3330..3507146d 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1745,9 +1745,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) @@ -1847,10 +1847,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) @@ -2069,7 +2069,7 @@ function satadomMenu() { # Decrypt Menu function decryptMenu() { OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")" - if [ "${OFFLINE}" = "false" ]; then + if [ "${OFFLINE}" == "false" ]; then local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-configs/releases" | jq -r ".[].tag_name" | sort -rV | head -1)" if [ -n "${TAG}" ]; then ( diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 69c2e13a..98387725 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -140,7 +140,7 @@ function arcModel() { 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 @@ -281,7 +281,7 @@ function arcVersion() { URLVER="" while true; do PJ="$(python ${ARC_PATH}/include/functions.py getpats4mv -m "${MODEL}" -v "${PRODUCTVER}")" - if [[ -z "${PJ}" || "${PJ}" = "{}" ]]; then + if [[ -z "${PJ}" || "${PJ}" == "{}" ]]; then MSG="Unable to connect to Synology API, Please check the network and try again!" dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \ --yes-label "Retry" \ @@ -900,7 +900,7 @@ else [ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1" while true; do echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu" - if [ -z "${ARCKEY}" ] && [ "${OFFLINE}" = "false" ]; then + if [ -z "${ARCKEY}" ] && [ "${OFFLINE}" == "false" ]; then echo "0 \"Enable Arc Patch\" " >>"${TMP_PATH}/menu" fi echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu" diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index dd5f898f..ff4dc09a 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -11,7 +11,7 @@ rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true rm -rf /sys/fs/pstore/* >/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!" ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")" # Get Loader Disk Bus @@ -86,7 +86,7 @@ if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then break fi done - [ ${HASATA} = "0" ] && echo -e "\033[1;31m*** Please insert at least one Sata/SAS/SCSI Disk for System installation, except for the Bootloader Disk. ***\033[0m" + [ ${HASATA} -eq 0 ] && echo -e "\033[1;31m*** Please insert at least one Sata/SAS/SCSI Disk for System installation, except for the Bootloader Disk. ***\033[0m" fi # Read necessary variables @@ -163,13 +163,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 ! 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 diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index 2ea41489..ba35ffe6 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -647,7 +647,7 @@ function updateLKMs() { # Update Failed function updateFailed() { local AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")" - if [ "${AUTOMATED}" = "true" ]; then + if [ "${AUTOMATED}" == "true" ]; then echo "Update failed!" sleep 5 exec reboot @@ -660,7 +660,7 @@ function updateFailed() { function updateFaileddialog() { local AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")" - if [ "${AUTOMATED}" = "true" ]; then + if [ "${AUTOMATED}" == "true" ]; then dialog --backtitle "$(backtitle)" --title "Update Failed" \ --infobox "Update failed!" 0 0 sleep 5 diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 823c08e6..d7a0c97c 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -118,8 +118,8 @@ for ETH in ${ETHX}; do fi sleep 1 fi - [ "${ETH::3}" = "eth" ] && ethtool -s ${ETH} wol g 2>/dev/null || true - # [ "${ETH::3}" = "eth" ] && ethtool -K ${ETH} rxhash off 2>/dev/null || true + [ "${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)"