arc-a: sync with arc

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-03-09 20:31:19 +01:00
parent 27de602d31
commit e6bfade359
13 changed files with 393 additions and 3012 deletions

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,7 @@ elif [ "${MACSYS}" = "hardware" ]; then
MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")" MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")"
[ -n "${MAC}" ] && NIC=$((${NIC} + 1)) && CMDLINE["mac${NIC}"]="${MAC}" [ -n "${MAC}" ] && NIC=$((${NIC} + 1)) && CMDLINE["mac${NIC}"]="${MAC}"
done done
CMDLINE['netif_num']="${N}" CMDLINE['netif_num']="${NIC}"
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7" CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
elif [ "${MACSYS}" = "custom" ]; then elif [ "${MACSYS}" = "custom" ]; then
for ETH in ${ETHX}; do for ETH in ${ETHX}; do

View File

@ -57,12 +57,12 @@ function installAddon() {
local HAS_FILES=0 local HAS_FILES=0
# First check generic files # First check generic files
if [ -f "${ADDONS_PATH}/${ADDON}/all.tgz" ]; then if [ -f "${ADDONS_PATH}/${ADDON}/all.tgz" ]; then
tar -zxf "${ADDONS_PATH}/${ADDON}/all.tgz" -C "${TMP_PATH}/${ADDON}" tar zxf "${ADDONS_PATH}/${ADDON}/all.tgz" -C "${TMP_PATH}/${ADDON}"
HAS_FILES=1 HAS_FILES=1
fi fi
# Now check specific platform files # Now check specific platform files
if [ -f "${ADDONS_PATH}/${ADDON}/${2}-${3}.tgz" ]; then if [ -f "${ADDONS_PATH}/${ADDON}/${2}-${3}.tgz" ]; then
tar -zxf "${ADDONS_PATH}/${ADDON}/${2}-${3}.tgz" -C "${TMP_PATH}/${ADDON}" tar zxf "${ADDONS_PATH}/${ADDON}/${2}-${3}.tgz" -C "${TMP_PATH}/${ADDON}"
HAS_FILES=1 HAS_FILES=1
fi fi
# If has files to copy, copy it, else return error # If has files to copy, copy it, else return error
@ -85,7 +85,7 @@ function untarAddon() {
fi fi
rm -rf "${TMP_PATH}/addon" rm -rf "${TMP_PATH}/addon"
mkdir -p "${TMP_PATH}/addon" mkdir -p "${TMP_PATH}/addon"
tar -xaf "${1}" -C "${TMP_PATH}/addon" || return tar xaf "${1}" -C "${TMP_PATH}/addon" || return
local ADDON=$(readConfigKey "name" "${TMP_PATH}/addon/manifest.yml") local ADDON=$(readConfigKey "name" "${TMP_PATH}/addon/manifest.yml")
[ -z "${ADDON}" ] && return [ -z "${ADDON}" ] && return
rm -rf "${ADDONS_PATH}/${ADDON:?}" rm -rf "${ADDONS_PATH}/${ADDON:?}"
@ -101,7 +101,7 @@ function updateAddons() {
rm -rf "${ADDONS_PATH}/${ADDON:?}" rm -rf "${ADDONS_PATH}/${ADDON:?}"
mkdir -p "${ADDONS_PATH}/${ADDON}" mkdir -p "${ADDONS_PATH}/${ADDON}"
echo "Installing ${F} to ${ADDONS_PATH}/${ADDON}" echo "Installing ${F} to ${ADDONS_PATH}/${ADDON}"
tar -xaf "${F}" -C "${ADDONS_PATH}/${ADDON}" tar xaf "${F}" -C "${ADDONS_PATH}/${ADDON}"
rm -f "${F}" rm -f "${F}"
done done
} }

View File

@ -35,7 +35,7 @@ function readModelArray() {
############################################################################### ###############################################################################
# Just show error message and dies # Just show error message and dies
function die() { function die() {
echo -e "\033[1;41m$*\033[0m" echo -e "\033[1;41m$@\033[0m"
exit 1 exit 1
} }
@ -72,9 +72,9 @@ function generateRandomLetter() {
############################################################################### ###############################################################################
# Generate a random digit (0-9A-Z) # Generate a random digit (0-9A-Z)
function generateRandomValue() { function generateRandomValue() {
for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F G H J K L M N P Q R S T V W X Y Z; do for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F G H J K L M N P Q R S T V W X Y Z; do
echo $i echo ${i}
done | sort -R | tail -1 done | sort -R | tail -1
} }
############################################################################### ###############################################################################
@ -85,12 +85,12 @@ function generateSerial() {
SERIAL="$(readModelArray "${1}" "serial.prefix" | sort -R | tail -1)" SERIAL="$(readModelArray "${1}" "serial.prefix" | sort -R | tail -1)"
SERIAL+=$(readModelKey "${1}" "serial.middle") SERIAL+=$(readModelKey "${1}" "serial.middle")
case "$(readModelKey "${1}" "serial.suffix")" in case "$(readModelKey "${1}" "serial.suffix")" in
numeric) numeric)
SERIAL+=$(random) SERIAL+=$(random)
;; ;;
alpha) alpha)
SERIAL+=$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter) SERIAL+=$(generateRandomLetter)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomValue)$(generateRandomLetter)
;; ;;
esac esac
echo ${SERIAL} echo ${SERIAL}
} }
@ -332,7 +332,7 @@ function livepatch() {
# Looking for Update # Looking for Update
if [ ${FAIL} -eq 1 ]; then if [ ${FAIL} -eq 1 ]; then
# Update Configs # Update Configs
TAG="$(curl --insecure -s https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')" TAG="$(curl --insecure -m 5 -s https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')"
if [[ $? -ne 0 || -z "${TAG}" ]]; then if [[ $? -ne 0 || -z "${TAG}" ]]; then
return 1 return 1
fi fi
@ -345,7 +345,7 @@ function livepatch() {
unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}" >/dev/null 2>&1 unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}" >/dev/null 2>&1
rm -f "${TMP_PATH}/configs.zip" rm -f "${TMP_PATH}/configs.zip"
# Update Patches # Update Patches
TAG="$(curl --insecure -s https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')" TAG="$(curl --insecure -m 5 -s https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')"
if [[ $? -ne 0 || -z "${TAG}" ]]; then if [[ $? -ne 0 || -z "${TAG}" ]]; then
return 1 return 1
fi fi

View File

@ -15,9 +15,9 @@ function getAllModules() {
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "arc.kernel" "${USER_CONFIG_FILE}")" local KERNEL="$(readConfigKey "arc.kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules.tgz" -C "${TMP_PATH}/modules" tar zxf "${CUSTOM_PATH}/modules.tgz" -C "${TMP_PATH}/modules"
else else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" tar zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
fi fi
# Get list of all modules # Get list of all modules
for F in $(ls ${TMP_PATH}/modules/*.ko 2>/dev/null); do for F in $(ls ${TMP_PATH}/modules/*.ko 2>/dev/null); do
@ -50,9 +50,9 @@ function installModules() {
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
local KERNEL="$(readConfigKey "arc.kernel" "${USER_CONFIG_FILE}")" local KERNEL="$(readConfigKey "arc.kernel" "${USER_CONFIG_FILE}")"
if [ "${KERNEL}" = "custom" ]; then if [ "${KERNEL}" = "custom" ]; then
tar -zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" tar zxf "${CUSTOM_PATH}/modules-${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
else else
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" tar zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
fi fi
local ODP="$(readConfigKey "arc.odp" "${USER_CONFIG_FILE}")" local ODP="$(readConfigKey "arc.odp" "${USER_CONFIG_FILE}")"
for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do for F in $(ls "${TMP_PATH}/modules/"*.ko 2>/dev/null); do
@ -66,9 +66,9 @@ function installModules() {
done done
mkdir -p "${RAMDISK_PATH}/usr/lib/firmware" 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" tar zxf "${CUSTOM_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
else else
tar -zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware" tar zxf "${MODULES_PATH}/firmware.tgz" -C "${RAMDISK_PATH}/usr/lib/firmware"
fi fi
# Clean # Clean
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
@ -91,9 +91,9 @@ function addToModules() {
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" tar zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
cp -f ${KOFILE} ${TMP_PATH}/modules cp -f ${KOFILE} ${TMP_PATH}/modules
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" . tar zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
} }
############################################################################### ###############################################################################
@ -113,9 +113,9 @@ function delToModules() {
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" tar zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
rm -f ${TMP_PATH}/modules/${KONAME} rm -f ${TMP_PATH}/modules/${KONAME}
tar -zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" . tar zcf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" .
} }
############################################################################### ###############################################################################
@ -146,7 +146,7 @@ function getdepends() {
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
tar -zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules" tar zxf "${MODULES_PATH}/${PLATFORM}-${KVER}.tgz" -C "${TMP_PATH}/modules"
DPS=($(_getdepends ${KONAME} | tr ' ' '\n' | sort -u)) DPS=($(_getdepends ${KONAME} | tr ' ' '\n' | sort -u))
echo ${DPS[@]} echo ${DPS[@]}
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"

View File

@ -13,5 +13,6 @@ ETHX=$(ls /sys/class/net/ | grep -v lo) || true
# Get actual IP # Get actual IP
for ETH in ${ETHX}; do for ETH in ${ETHX}; do
IPCON="$(readConfigKey "ip.${ETH}" "${USER_CONFIG_FILE}")" IPCON="$(readConfigKey "ip.${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${IPCON}" ] && IPCON="$(getIP ${ETH})"
[ -n "${IPCON}" ] && break [ -n "${IPCON}" ] && break
done done

View File

@ -1,6 +1,8 @@
# Get PortMap for Loader # Get PortMap for Loader
function getmap() { function getmap() {
if [ ! "${DT}" = "true" ] && [ ${SATACONTROLLER} -gt 0 ]; then # Sata Disks
SATADRIVES=0
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
# Clean old files # Clean old files
[ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax" [ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax"
touch "${TMP_PATH}/drivesmax" touch "${TMP_PATH}/drivesmax"
@ -10,8 +12,6 @@ function getmap() {
touch "${TMP_PATH}ports" touch "${TMP_PATH}ports"
[ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap" [ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap"
touch "${TMP_PATH}/remap" touch "${TMP_PATH}/remap"
# Sata Disks
SATADRIVES=0
let DISKIDXMAPIDX=0 let DISKIDXMAPIDX=0
DISKIDXMAP="" DISKIDXMAP=""
let DISKIDXMAPIDXMAX=0 let DISKIDXMAPIDXMAX=0
@ -44,128 +44,155 @@ function getmap() {
let DISKIDXMAPIDXMAX=$DISKIDXMAPIDXMAX+$NUMPORTS let DISKIDXMAPIDXMAX=$DISKIDXMAPIDXMAX+$NUMPORTS
SATADRIVES=$((${SATADRIVES} + ${CONPORTS})) SATADRIVES=$((${SATADRIVES} + ${CONPORTS}))
done done
# SAS Disks fi
SASDRIVES=0 # SAS Disks
if [ $(lspci -d ::107 | wc -l) -gt 0 ]; then SASDRIVES=0
for PCI in $(lspci -d ::107 | awk '{print $1}'); do if [ $(lspci -d ::107 | wc -l) -gt 0 ]; then
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") for PCI in $(lspci -d ::107 | awk '{print $1}'); do
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n) NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
SASDRIVES=$((${SASDRIVES} + ${PORTNUM})) PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
done SASDRIVES=$((${SASDRIVES} + ${PORTNUM}))
fi done
# SCSI Disks fi
SCSIDRIVES=0 # SCSI Disks
if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then SCSIDRIVES=0
for PCI in $(lspci -d ::104 | awk '{print $1}'); do if [ $(lspci -d ::100 | wc -l) -gt 0 ]; then
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") for PCI in $(lspci -d ::100 | awk '{print $1}'); do
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n) NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
SCSIDRIVES=$((${SCSIDRIVES} + ${PORTNUM})) PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
done SCSIDRIVES=$((${SCSIDRIVES} + ${PORTNUM}))
fi done
# USB Disks fi
USBDRIVES=0 # Raid Disks
if [[ -d "/sys/class/scsi_host" && $(ls -l /sys/class/scsi_host | grep usb | wc -l) -gt 0 ]]; then RAIDDRIVES=0
for PCI in $(lspci -d ::c03 | awk '{print $1}'); do if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") for PCI in $(lspci -d ::104 | awk '{print $1}'); do
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n) NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
[ ${PORTNUM} -eq 0 ] && continue PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
USBDRIVES=$((${USBDRIVES} + ${PORTNUM})) RAIDDRIVES=$((${RAIDDRIVES} + ${PORTNUM}))
done done
fi fi
# MMC Disks # USB Disks
MMCDRIVES=0 USBDRIVES=0
if [[ -d "/sys/class/mmc_host" && $(ls -l /sys/class/mmc_host | grep mmc_host | wc -l) -gt 0 ]]; then if [[ -d "/sys/class/scsi_host" && $(ls -l /sys/class/scsi_host | grep usb | wc -l) -gt 0 ]]; then
for PCI in $(lspci -d ::805 | awk '{print $1}'); do for PCI in $(lspci -d ::c03 | awk '{print $1}'); do
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l) PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
[ ${PORTNUM} -eq 0 ] && continue PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
MMCDRIVES=$((${MMCDRIVES} + ${PORTNUM})) [ ${PORTNUM} -eq 0 ] && continue
done USBDRIVES=$((${USBDRIVES} + ${PORTNUM}))
fi done
# NVMe Disks fi
NVMEDRIVES=0 # MMC Disks
if [ $(lspci -d ::108 | wc -l) -gt 0 ]; then MMCDRIVES=0
for PCI in $(lspci -d ::108 | awk '{print $1}'); do if [[ -d "/sys/class/mmc_host" && $(ls -l /sys/class/mmc_host | grep mmc_host | wc -l) -gt 0 ]]; then
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") for PCI in $(lspci -d ::805 | awk '{print $1}'); do
PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n) NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l) PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l)
NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM})) [ ${PORTNUM} -eq 0 ] && continue
done MMCDRIVES=$((${MMCDRIVES} + ${PORTNUM}))
fi done
# Disk Count for MaxDisks fi
DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES})) # NVMe Disks
[ ${SATADRIVES} -gt 0 ] && writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}" NVMEDRIVES=0
[ ${SASDRIVES} -gt 0 ] && writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}" if [ $(lspci -d ::108 | wc -l) -gt 0 ]; then
[ ${SCSIDRIVES} -gt 0 ] && writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}" for PCI in $(lspci -d ::108 | awk '{print $1}'); do
[ ${USBDRIVES} -gt 0 ] && writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}" NAME=$(lspci -s "${PCI}" | sed "s/\ .*://")
[ ${MMCDRIVES} -gt 0 ] && writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}" PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n)
[ ${NVMEDRIVES} -gt 0 ] && writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}" PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l)
if [ ${DRIVES} -gt 26 ]; then NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM}))
DRIVES=26 done
fi fi
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}" # Disk Count for MaxDisks
# Check for Sata Boot DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES}))
LASTDRIVE=0 HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES}))
while read -r LINE; do [ ${SATADRIVES} -gt 0 ] && writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}"
if [[ "${BUS}" != "usb" && ${LINE} -eq 0 && "${LOADER_DISK}" = "/dev/sda" ]]; then [ ${SASDRIVES} -gt 0 ] && writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}"
MAXDISKS="$(readModelKey "${MODEL}" "disks")" [ ${SCSIDRIVES} -gt 0 ] && writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}"
if [ ${MAXDISKS} -lt ${DRIVES} ]; then [ ${RAIDDRIVES} -gt 0 ] && writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}"
MAXDISKS=${DRIVES} [ ${USBDRIVES} -gt 0 ] && writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}"
fi [ ${MMCDRIVES} -gt 0 ] && writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}"
echo -n "${LINE}>${MAXDISKS}:">>"${TMP_PATH}/remap" [ ${NVMEDRIVES} -gt 0 ] && writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
elif [ ! ${LINE} = ${LASTDRIVE} ]; then writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
echo -n "${LINE}>${LASTDRIVE}:">>"${TMP_PATH}/remap" writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
LASTDRIVE=$((${LASTDRIVE} + 1)) }
elif [ ${LINE} = ${LASTDRIVE} ]; then
LASTDRIVE=$((${LINE} + 1)) function getmapSelection() {
# Check for Sata Boot
LASTDRIVE=0
while read -r LINE; do
if [[ "${BUS}" != "usb" && ${LINE} -eq 0 && "${LOADER_DISK}" = "/dev/sda" ]]; then
MAXDISKS="$(readModelKey "${MODEL}" "disks")"
if [ ${MAXDISKS} -lt ${DRIVES} ]; then
MAXDISKS=${DRIVES}
fi fi
done < <(cat "${TMP_PATH}/ports") echo -n "${LINE}>${MAXDISKS}:">>"${TMP_PATH}/remap"
# Compute PortMap Options elif [ ! ${LINE} = ${LASTDRIVE} ]; then
SATAPORTMAPMAX=$(awk '{print $1}' "${TMP_PATH}/drivesmax") echo -n "${LINE}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
SATAPORTMAP=$(awk '{print $1}' "${TMP_PATH}/drivescon") LASTDRIVE=$((${LASTDRIVE} + 1))
SATAREMAP=$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//') elif [ ${LINE} = ${LASTDRIVE} ]; then
# Show recommended Option to user LASTDRIVE=$((${LINE} + 1))
if [ -n "${SATAREMAP}" ] && [[ ${SASCONTROLLER} -gt 0 || ${SCSICONTROLLER} -gt 0 ]] && [ "${MACHINE}" = "NATIVE" ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ -n "${SATAREMAP}" ] && [[ ${SASCONTROLLER} -eq 0 && ${SCSICONTROLLER} -eq 0 ]]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
fi
# 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
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
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}"
elif [ "${REMAP}" = "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
fi fi
done < <(cat "${TMP_PATH}/ports")
# Compute PortMap Options
SATAPORTMAPMAX=$(awk '{print $1}' "${TMP_PATH}/drivesmax")
SATAPORTMAP=$(awk '{print $1}' "${TMP_PATH}/drivescon")
SATAREMAP=$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')
EXTERNALCONTROLLER="$(readConfigKey "arc.externalcontroller" "${USER_CONFIG_FILE}")"
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "NATIVE" ]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
elif [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ]; then
writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
fi
# 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
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
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}"
elif [ "${REMAP}" = "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
fi fi
} }
# Check for Controller # Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB
SATACONTROLLER=$(lspci -d ::106 | wc -l) if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
writeConfigKey "device.satacontroller" "${SATACONTROLLER}" "${USER_CONFIG_FILE}" SATACONTROLLER=$(lspci -d ::106 | wc -l)
SASCONTROLLER=$(lspci -d ::107 | wc -l) writeConfigKey "device.satacontroller" "${SATACONTROLLER}" "${USER_CONFIG_FILE}"
writeConfigKey "device.sascontroller" "${SASCONTROLLER}" "${USER_CONFIG_FILE}" fi
SCSICONTROLLER=$(lspci -d ::104 | wc -l) if [ $(lspci -d ::107 | wc -l) -gt 0 ]; then
writeConfigKey "device.scsicontroller" "${SCSICONTROLLER}" "${USER_CONFIG_FILE}" SASCONTROLLER=$(lspci -d ::107 | wc -l)
writeConfigKey "device.sascontroller" "${SASCONTROLLER}" "${USER_CONFIG_FILE}"
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
if [ $(lspci -d ::100 | wc -l) -gt 0 ]; then
SCSICONTROLLER=$(lspci -d ::100 | wc -l)
writeConfigKey "device.scsicontroller" "${SCSICONTROLLER}" "${USER_CONFIG_FILE}"
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi
if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then
RAIDCONTROLLER=$(lspci -d ::104 | wc -l)
writeConfigKey "device.raidcontroller" "${RAIDCONTROLLER}" "${USER_CONFIG_FILE}"
writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}"
fi

View File

@ -44,7 +44,6 @@ initConfigKey "arc.ipv6" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.emmcboot" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.emmcboot" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.directboot" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.directboot" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.usbmount" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.pathash" "" "${USER_CONFIG_FILE}" initConfigKey "arc.pathash" "" "${USER_CONFIG_FILE}"
initConfigKey "arc.paturl" "" "${USER_CONFIG_FILE}" initConfigKey "arc.paturl" "" "${USER_CONFIG_FILE}"
@ -55,9 +54,11 @@ initConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
initConfigKey "arc.odp" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.odp" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.modulescopy" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.modulescopy" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.hddsort" "false" "${USER_CONFIG_FILE}" initConfigKey "arc.hddsort" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.usbmount" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.kernel" "official" "${USER_CONFIG_FILE}" initConfigKey "arc.kernel" "official" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}" initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
initConfigKey "device" "{}" "${USER_CONFIG_FILE}" initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
initConfigKey "device.externalcontroller" "false" "${USER_CONFIG_FILE}"
initConfigKey "ip" "{}" "${USER_CONFIG_FILE}" initConfigKey "ip" "{}" "${USER_CONFIG_FILE}"
initConfigKey "netmask" "{}" "${USER_CONFIG_FILE}" initConfigKey "netmask" "{}" "${USER_CONFIG_FILE}"
initConfigKey "mac" "{}" "${USER_CONFIG_FILE}" initConfigKey "mac" "{}" "${USER_CONFIG_FILE}"
@ -207,4 +208,5 @@ updateAddons
echo -e "\033[1;34mLoading Arc Overlay...\033[0m" echo -e "\033[1;34mLoading Arc Overlay...\033[0m"
sleep 2 sleep 2
# Load Arc Overlay
arc.sh arc.sh

View File

@ -71,15 +71,15 @@ declare -A SYNOINFO
declare -A ADDONS declare -A ADDONS
declare -A MODULES declare -A MODULES
# Read synoinfo, addons and extensions from config # Read synoinfo from config
while IFS=': ' read -r KEY VALUE; do while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}" [ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}") done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
# Read synoinfo from config
while IFS=': ' read -r KEY VALUE; do while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}" [ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}") done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
# Read modules from config
# Read modules from user config
while IFS=': ' read -r KEY VALUE; do while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && MODULES["${KEY}"]="${VALUE}" [ -n "${KEY}" ] && MODULES["${KEY}"]="${VALUE}"
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}") done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")

Binary file not shown.

View File

@ -32,8 +32,8 @@ sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3" sudo mount ${LOOPX}p3 "/tmp/p3"
echo "Get Buildroot" echo "Get Buildroot"
# read -rp 'Version (2023.02.x): ' br_version # read -rp 'Version (2023.08.x): ' br_version
[ -z "${br_version}" ] && br_version="2023.02.x" [ -z "${br_version}" ] && br_version="2023.08.x"
getBuildroot "${br_version}" "br" getBuildroot "${br_version}" "br"
[[ ! -f "br/bzImage-arc" || ! -f "br/initrd-arc" ]] && return 1 [[ ! -f "br/bzImage-arc" || ! -f "br/initrd-arc" ]] && return 1