mirror of
https://github.com/AuxXxilium/arc-c.git
synced 2024-11-23 15:01:07 +07:00
arc-c: sync with arc
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
8682846b34
commit
2c044d4e75
2048
files/initrd/opt/arc/arc-functions.sh
Executable file
2048
files/initrd/opt/arc/arc-functions.sh
Executable file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
###############################################################################
|
||||
# Overlay Init Section
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
@ -7,17 +9,14 @@
|
||||
. ${ARC_PATH}/include/modules.sh
|
||||
. ${ARC_PATH}/include/storage.sh
|
||||
. ${ARC_PATH}/include/network.sh
|
||||
. ${ARC_PATH}/arc-functions.sh
|
||||
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
|
||||
# Memory: Check Memory installed
|
||||
RAMTOTAL=0
|
||||
while read -r LINE; do
|
||||
RAMSIZE=${LINE}
|
||||
RAMTOTAL=$((${RAMTOTAL} + ${RAMSIZE}))
|
||||
done < <(dmidecode -t memory | grep -i "Size" | cut -d" " -f2 | grep -i "[1-9]")
|
||||
RAMTOTAL=$((${RAMTOTAL} * 1024))
|
||||
[ -z "${RAMTOTAL}" ] || [ ${RAMTOTAL} -le 0 ] && RAMMAX=8192
|
||||
RAMFREE=$(($(free -m | grep -i mem | awk '{print$2}') / 1024 + 1))
|
||||
RAMTOTAL=$((${RAMFREE} * 1024))
|
||||
[ -z "${RAMTOTAL}" ] || [ ${RAMTOTAL} -le 0 ] && RAMTOTAL=8192
|
||||
RAMMAX=$((${RAMTOTAL} * 2))
|
||||
RAMMIN=$((${RAMTOTAL} / 2))
|
||||
|
||||
@ -161,7 +160,7 @@ function arcModel() {
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Shows menu to user type one or generate randomly
|
||||
# Arc Version Section
|
||||
function arcVersion() {
|
||||
# read model values for arcbuild
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
@ -178,25 +177,26 @@ function arcVersion() {
|
||||
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
writeConfigKey "synoinfo.\"${KEY}\"" "${VALUE}" "${USER_CONFIG_FILE}"
|
||||
done < <(readModelMap "${MODEL}" "productvers.[${PRODUCTVER}].synoinfo")
|
||||
done <<<$(readModelMap "${MODEL}" "productvers.[${PRODUCTVER}].synoinfo")
|
||||
# Reset modules
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVER}")
|
||||
arcSettings
|
||||
done <<<$(getAllModules "${PLATFORM}" "${KVER}")
|
||||
arcPatch
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Make Arc Settings
|
||||
function arcSettings() {
|
||||
# Arc Patch Section
|
||||
function arcPatch() {
|
||||
# Read Model Values
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
DT="$(readModelKey "${MODEL}" "dt")"
|
||||
# Read Arc Patch from File
|
||||
SN="$(readModelKey "${MODEL}" "arc.serial")"
|
||||
writeConfigKey "arc.sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
# Addon Selection
|
||||
writeConfigKey "addons.acpid" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "addons.expands" "" "${USER_CONFIG_FILE}"
|
||||
@ -210,6 +210,12 @@ function arcSettings() {
|
||||
deleteConfigKey "addons.acpid" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
arcSettings
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Arc Settings Section
|
||||
function arcSettings() {
|
||||
# Get Network Config for Loader
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
|
||||
--infobox "Network Config..." 3 30
|
||||
@ -299,7 +305,7 @@ function make() {
|
||||
--infobox "Addon ${ADDON} not found!" 0 0
|
||||
return 1
|
||||
fi
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
done <<<$(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" \
|
||||
--infobox "Get PAT Data from Syno..." 3 30
|
||||
# Get PAT Data from Syno
|
||||
|
@ -21,7 +21,7 @@ printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
printf "\033[1;30m%*s\033[0m\n" ${COLUMNS} ""
|
||||
TITLE="BOOTING:"
|
||||
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [Legacy]"
|
||||
TITLE+=" [${BUS^^}]"
|
||||
TITLE+=" [${BUS}]"
|
||||
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
|
||||
echo
|
||||
@ -52,27 +52,21 @@ MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
|
||||
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
|
||||
CPU="$(awk -F':' '/^model name/ {print $2}' /proc/cpuinfo | uniq | sed -e 's/^[ \t]*//')"
|
||||
RAMTOTAL=0
|
||||
while read -r LINE; do
|
||||
RAMSIZE=${LINE}
|
||||
RAMTOTAL=$((${RAMTOTAL} + ${RAMSIZE}))
|
||||
done < <(dmidecode -t memory | grep -i "Size" | cut -d" " -f2 | grep -i "[1-9]")
|
||||
RAMTOTAL=$((${RAMTOTAL} * 1024))
|
||||
RAM=$(free -m | grep -i mem | awk '{print$2}')
|
||||
VENDOR="$(dmidecode -s system-product-name)"
|
||||
BOARD="$(dmidecode -s baseboard-product-name)"
|
||||
CPU="$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))"
|
||||
RAMTOAL=$(($(free -m | grep -i mem | awk '{print$2}') / 1024 + 1))
|
||||
RAM="${RAMTOTAL}GB"
|
||||
VENDOR="$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')"
|
||||
|
||||
echo -e " \033[1;37mDSM:\033[0m"
|
||||
echo -e " Model: \033[1;37m${MODEL}\033[0m"
|
||||
echo -e " Version: \033[1;37m${PRODUCTVER}\033[0m"
|
||||
echo -e " LKM: \033[1;37m${LKM}\033[0m"
|
||||
echo -e " Macsys: \033[1;37m${MACSYS}\033[0m"
|
||||
echo -e "\033[1;37mDSM:\033[0m"
|
||||
echo -e "Model: \033[1;37m${MODEL}\033[0m"
|
||||
echo -e "Version: \033[1;37m${PRODUCTVER}\033[0m"
|
||||
echo -e "LKM: \033[1;37m${LKM}\033[0m"
|
||||
echo -e "Macsys: \033[1;37m${MACSYS}\033[0m"
|
||||
echo
|
||||
echo -e " \033[1;37mSystem:\033[0m"
|
||||
echo -e " Vendor / Board: \033[1;37m${VENDOR}\033[0m / \033[1;37m${BOARD}\033[0m"
|
||||
echo -e " CPU: \033[1;37m${CPU}\033[0m"
|
||||
echo -e " MEM: \033[1;37m${RAM}\033[0m / \033[1;37m${RAMTOTAL} MB\033[0m"
|
||||
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 "MEM: \033[1;37m${RAM}\033[0m"
|
||||
echo
|
||||
|
||||
if [[ ! -f "${MODEL_CONFIG_PATH}/${MODEL}.yml" || -z "$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}]")" ]]; then
|
||||
@ -88,11 +82,33 @@ KERNELLOAD="$(readConfigKey "arc.kernelload" "${USER_CONFIG_FILE}")"
|
||||
KERNELPANIC="$(readConfigKey "arc.kernelpanic" "${USER_CONFIG_FILE}")"
|
||||
DIRECTBOOT="$(readConfigKey "arc.directboot" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "arc.emmcboot" "${USER_CONFIG_FILE}")"
|
||||
ETHX=$(ls /sys/class/net/ | grep -v lo) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
|
||||
declare -A CMDLINE
|
||||
|
||||
# Read and Set Cmdline
|
||||
MODELID="$(readModelKey ${MODEL} "id")"
|
||||
CMDLINE['syno_hw_version']="${MODELID:-${MODEL}}"
|
||||
[ -z "${VID}" ] && VID="0x46f4" # Sanity check
|
||||
[ -z "${PID}" ] && PID="0x0001" # Sanity check
|
||||
CMDLINE['vid']="${VID}"
|
||||
CMDLINE['pid']="${PID}"
|
||||
CMDLINE['sn']="${SN}"
|
||||
|
||||
NIC=0
|
||||
for ETH in ${ETHX}; do
|
||||
MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -n "${MAC}" ] && NIC=$((${NIC} + 1)) && CMDLINE["mac${NIC}"]="${MAC}"
|
||||
done
|
||||
CMDLINE['netif_num']="${NIC}"
|
||||
|
||||
if [ "${MACSYS}" = "hardware" ]; then
|
||||
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
|
||||
elif [ "${MACSYS}" = "custom" ]; then
|
||||
CMDLINE['skip_vender_mac_interfaces']="$(seq -s, ${NIC} 7)"
|
||||
fi
|
||||
|
||||
# set fixed cmdline
|
||||
if grep -q "force_junior" /proc/cmdline; then
|
||||
CMDLINE['force_junior']=""
|
||||
fi
|
||||
@ -106,33 +122,30 @@ else
|
||||
CMDLINE['noefi']=""
|
||||
fi
|
||||
if [ ! "${BUS}" = "usb" ]; then
|
||||
SIZE=$(($(cat /sys/block/${LOADER_DISK/\/dev\//}/size) / 2048 + 10))
|
||||
SZ=$(blockdev --getsz ${LOADER_DISK} 2>/dev/null) # SZ=$(cat /sys/block/${LOADER_DISK/\/dev\//}/size)
|
||||
SS=$(blockdev --getss ${LOADER_DISK} 2>/dev/null) # SS=$(cat /sys/block/${LOADER_DISK/\/dev\//}/queue/hw_sector_size)
|
||||
SIZE=$((${SZ} * ${SS} / 1024 / 1024 + 10))
|
||||
# Read SATADoM type
|
||||
DOM="$(readModelKey "${MODEL}" "dom")"
|
||||
CMDLINE['synoboot_satadom']="${DOM}"
|
||||
CMDLINE['dom_szmax']="${SIZE}"
|
||||
fi
|
||||
MODELID="$(readModelKey ${MODEL} "id")"
|
||||
CMDLINE['syno_hw_version']="${MODELID:-${MODEL}}"
|
||||
[ -z "${VID}" ] && VID="0x46f4" # Sanity check
|
||||
[ -z "${PID}" ] && PID="0x0001" # Sanity check
|
||||
CMDLINE['vid']="${VID}"
|
||||
CMDLINE['pid']="${PID}"
|
||||
CMDLINE['panic']="${KERNELPANIC:-5}"
|
||||
CMDLINE['panic']="${KERNELPANIC:-0}"
|
||||
CMDLINE['console']="ttyS0,115200n8"
|
||||
CMDLINE['no_console_suspend']="1"
|
||||
CMDLINE['consoleblank']="0"
|
||||
CMDLINE['earlyprintk']=""
|
||||
CMDLINE['earlycon']="uart8250,io,0x3f8,115200n8"
|
||||
|
||||
# eMMC Boot
|
||||
if [ "${EMMCBOOT}" = "false" ]; then
|
||||
CMDLINE['root']="/dev/md0"
|
||||
elif [ "${EMMCBOOT}" = "true" ]; then
|
||||
CMDLINE['root']="/dev/mmcblk0p1"
|
||||
fi
|
||||
|
||||
CMDLINE['loglevel']="15"
|
||||
CMDLINE['log_buf_len']="32M"
|
||||
CMDLINE['net.ifnames']="0"
|
||||
CMDLINE['sn']="${SN}"
|
||||
|
||||
if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ ! "${BUS}" = "mmc" ] && [ ! "${EMMCBOOT}" = "true" ]; then
|
||||
[ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+=","
|
||||
@ -144,38 +157,13 @@ if [ "$(readModelKey "${MODEL}" "dt")" = "true" ] && ! echo "epyc7002 purley bro
|
||||
CMDLINE['modprobe.blacklist']+="mpt3sas"
|
||||
fi
|
||||
|
||||
NIC=0
|
||||
if [ "${MACSYS}" = "arc" ]; then
|
||||
MAC="$(readConfigKey "mac.eth0" "${USER_CONFIG_FILE}")"
|
||||
[ -n "${MAC}" ] && CMDLINE["mac1"]="${MAC}"
|
||||
for ETH in ${ETHX}; do
|
||||
NIC=$((${NIC} + 1))
|
||||
done
|
||||
CMDLINE['netif_num']="1"
|
||||
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
|
||||
elif [ "${MACSYS}" = "hardware" ]; then
|
||||
for ETH in ${ETHX}; do
|
||||
MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -n "${MAC}" ] && NIC=$((${NIC} + 1)) && CMDLINE["mac${NIC}"]="${MAC}"
|
||||
done
|
||||
CMDLINE['netif_num']="${NIC}"
|
||||
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
|
||||
elif [ "${MACSYS}" = "custom" ]; then
|
||||
for ETH in ${ETHX}; do
|
||||
MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -n "${MAC}" ] && NIC=$((${NIC} + 1)) && CMDLINE["mac${NIC}"]="${MAC}"
|
||||
done
|
||||
CMDLINE['netif_num']="${NIC}"
|
||||
CMDLINE['skip_vender_mac_interfaces']="$(seq -s, ${NIC} 7)"
|
||||
fi
|
||||
|
||||
# Read cmdline
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
|
||||
done < <(readModelMap "${MODEL}" "productvers.[${PRODUCTVER}].cmdline")
|
||||
done <<<$(readModelMap "${MODEL}" "productvers.[${PRODUCTVER}].cmdline")
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
|
||||
done <<<$(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Prepare command line
|
||||
CMDLINE_LINE=""
|
||||
@ -191,32 +179,32 @@ if [ "${DIRECTBOOT}" = "true" ]; then
|
||||
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
|
||||
grub-editenv ${GRUB_PATH}/grubenv set dsm_cmdline="${CMDLINE_DIRECT}"
|
||||
grub-editenv ${GRUB_PATH}/grubenv set next_entry="direct"
|
||||
echo -e " \033[1;34mReboot with Directboot\033[0m"
|
||||
echo -e "\033[1;34mReboot with Directboot\033[0m"
|
||||
exec reboot
|
||||
elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
|
||||
echo -e " \033[1;34mDetected ${NIC} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
|
||||
echo -e "\033[1;34mDetected ${NIC} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
|
||||
for ETH in ${ETHX}; do
|
||||
IP=""
|
||||
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
DRIVER="$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')"
|
||||
COUNT=0
|
||||
while true; do
|
||||
IP="$(getIP ${ETH})"
|
||||
MSG="DHCP"
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${ETH} | grep "Speed:" | awk '{print $2}')
|
||||
echo -e "\r \033[1;37m${DRIVER} (${SPEED} | ${MSG}):\033[0m Access \033[1;34mhttp://${IP}:5000\033[0m to connect to DSM via web."
|
||||
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
echo -e "\r\033[1;37m${DRIVER} (${SPEED} | ${MSG}):\033[0m Access \033[1;34mhttp://${IP}:5000\033[0m to connect to DSM via web."
|
||||
ethtool -s ${ETH} wol g 2>/dev/null
|
||||
[ ! -n "${IPCON}" ] && IPCON="${IP}"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -gt ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r \033[1;37m${DRIVER}:\033[0m TIMEOUT"
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m TIMEOUT"
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
if ethtool ${ETH} | grep 'Link detected' | grep -q 'no'; then
|
||||
echo -e "\r \033[1;37m${DRIVER}:\033[0m NOT CONNECTED"
|
||||
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m NOT CONNECTED"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT} + 3))
|
||||
@ -240,19 +228,19 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
|
||||
done
|
||||
rm -f WB WC
|
||||
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
|
||||
echo -e " \033[1;37mLoading DSM kernel...\033[0m"
|
||||
echo -e "\033[1;37mLoading DSM kernel...\033[0m"
|
||||
|
||||
# Executes DSM kernel via KEXEC
|
||||
kexec -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
echo -e " \033[1;37m"Booting DSM..."\033[0m"
|
||||
echo -e "\033[1;37m"Booting DSM..."\033[0m"
|
||||
for T in $(w | grep -v "TTY" | awk -F' ' '{print $2}')
|
||||
do
|
||||
echo -e "\n \033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\n Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n" >"/dev/${T}" 2>/dev/null || true
|
||||
echo -e "\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\n Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n" >"/dev/${T}" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Clear logs for dbgutils addons
|
||||
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
|
||||
|
||||
[ "${KERNELLOAD}" = "kexec" ] && kexec -f -e || poweroff
|
||||
[ "${KERNELLOAD}" = "kexec" ] && kexec -i -a -e || poweroff
|
||||
exit 0
|
||||
fi
|
@ -7,7 +7,7 @@ function availableAddons() {
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
while read -r D; do
|
||||
for D in $(find "${ADDONS_PATH}" -maxdepth 1 -type d 2>/dev/null | sort); do
|
||||
[ ! -f "${D}/manifest.yml" ] && continue
|
||||
ADDON=$(basename ${D})
|
||||
checkAddonExist "${ADDON}" "${1}" "${2}" || continue
|
||||
@ -18,7 +18,7 @@ function availableAddons() {
|
||||
ACT="$(readConfigKey "${1}" "${D}/manifest.yml")"
|
||||
[ "${BETA}" = true ] && BETA="(Beta) " || BETA=""
|
||||
[ "${ACT}" = true ] && echo -e "${ADDON}\t${BETA}${DESC}"
|
||||
done < <(find "${ADDONS_PATH}" -maxdepth 1 -type d | sort)
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -1,18 +1,22 @@
|
||||
# Get Network Config for Loader
|
||||
function getnet() {
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
ARCMACNUM=4
|
||||
ARCMAC="$(readModelKey "${MODEL}" "arc.mac${ARCMACNUM}")"
|
||||
writeConfigKey "mac.eth0" "${ARCMAC}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.macsys" "arc" "${USER_CONFIG_FILE}"
|
||||
ARCMACNUM=1
|
||||
for ETH in ${ETHX}; do
|
||||
ARCMAC="$(readModelKey "${MODEL}" "arc.mac${ARCMACNUM}")"
|
||||
[ -n "${ARCMAC}" ] && writeConfigKey "mac.${ETH}" "${ARCMAC}" "${USER_CONFIG_FILE}"
|
||||
[ -z "${ARCMAC}" ] && break
|
||||
ARCMACNUM=$((${ARCMACNUM} + 1))
|
||||
done
|
||||
writeConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
|
||||
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
|
||||
}
|
||||
|
||||
# Get Amount of NIC
|
||||
ETHX=$(ls /sys/class/net/ | grep -v lo) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
# Get actual IP
|
||||
for ETH in ${ETHX}; do
|
||||
IPCON="$(readConfigKey "ip.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${IPCON}" ] && IPCON="$(getIP ${ETH})"
|
||||
IPCON="$(getIP ${ETH})"
|
||||
[ -n "${IPCON}" ] && break
|
||||
done
|
@ -25,7 +25,7 @@ function getmap() {
|
||||
ATAPORT="$(echo ${LINE} | grep -o 'ata[0-9]*')"
|
||||
PORT=$(echo ${ATAPORT} | sed 's/ata//')
|
||||
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
|
||||
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
|
||||
done <<<$(ls -l /sys/class/scsi_host | grep -F "${PCI}")
|
||||
while read -r PORT; do
|
||||
ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && ATTACH=1 || ATTACH=0
|
||||
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
|
||||
@ -33,7 +33,7 @@ function getmap() {
|
||||
[ ${ATTACH} = 1 ] && CONPORTS=$((${CONPORTS} + 1)) && echo "$((${PORT} - 1))" >>"${TMP_PATH}/ports"
|
||||
[ ${DUMMY} = 1 ] # Do nothing for now
|
||||
NUMPORTS=$((${NUMPORTS} + 1))
|
||||
done < <(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n)
|
||||
done <<<$(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n)
|
||||
[ ${NUMPORTS} -gt 8 ] && NUMPORTS=8
|
||||
[ ${CONPORTS} -gt 8 ] && CONPORTS=8
|
||||
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
|
||||
@ -136,7 +136,7 @@ function getmapSelection() {
|
||||
elif [ ${LINE} = ${LASTDRIVE} ]; then
|
||||
LASTDRIVE=$((${LINE} + 1))
|
||||
fi
|
||||
done < <(cat "${TMP_PATH}/ports")
|
||||
done <<<$(cat "${TMP_PATH}/ports")
|
||||
# Compute PortMap Options
|
||||
SATAPORTMAPMAX="$(awk '{print $1}' "${TMP_PATH}/drivesmax")"
|
||||
SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")"
|
||||
|
@ -8,6 +8,9 @@ set -e
|
||||
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
|
||||
# Get Loader Disk Bus
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
|
||||
# Shows title
|
||||
clear
|
||||
[ -z "${COLUMNS}" ] && COLUMNS=50
|
||||
@ -71,7 +74,7 @@ else
|
||||
fi
|
||||
|
||||
# Init Network
|
||||
ETHX=$(ls /sys/class/net/ | grep -v lo) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
|
||||
# Write Mac to config
|
||||
NIC=0
|
||||
@ -102,7 +105,6 @@ writeConfigKey "device.nic" "${NIC}" "${USER_CONFIG_FILE}"
|
||||
# Get the VID/PID if we are in USB
|
||||
VID="0x46f4"
|
||||
PID="0x0001"
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
|
||||
if [ "${BUS}" = "usb" ]; then
|
||||
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)"
|
||||
@ -150,7 +152,7 @@ echo -e "\033[1;34mDetected ${NIC} NIC.\033[0m \033[1;37mWaiting for Connection:
|
||||
for ETH in ${ETHX}; do
|
||||
IP=""
|
||||
STATICIP="$(readConfigKey "static.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
DRIVER="$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')"
|
||||
COUNT=0
|
||||
while true; do
|
||||
ARCIP="$(readConfigKey "ip.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
@ -167,7 +169,7 @@ for ETH in ${ETHX}; do
|
||||
MSG="DHCP"
|
||||
fi
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${ETH} | grep "Speed:" | awk '{print $2}')
|
||||
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
writeConfigKey "ip.${ETH}" "${IP}" "${USER_CONFIG_FILE}"
|
||||
echo -e "\r\033[1;37m${DRIVER} (${SPEED} | ${MSG}):\033[0m Access \033[1;34mhttp://${IP}:7681\033[0m to connect to Arc via web."
|
||||
ethtool -s ${ETH} wol g 2>/dev/null
|
||||
@ -179,7 +181,7 @@ for ETH in ${ETHX}; do
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
if ethtool ${ETH} | grep 'Link detected' | grep -q 'no'; then
|
||||
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m NOT CONNECTED"
|
||||
deleteConfigKey "ip.${ETH}" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
@ -203,10 +205,9 @@ mkdir -p "${MODEL_CONFIG_PATH}"
|
||||
mkdir -p "${PATCH_PATH}"
|
||||
mkdir -p "${BACKUPDIR}"
|
||||
|
||||
# Load Arc
|
||||
updateAddons
|
||||
# Load Arc Overlay
|
||||
echo -e "\033[1;34mLoading Arc Overlay...\033[0m"
|
||||
sleep 2
|
||||
|
||||
# Load Arc Overlay
|
||||
# Load Arc
|
||||
arc.sh
|
@ -9,7 +9,10 @@
|
||||
set -o pipefail # Get exit code from process piped
|
||||
|
||||
# Sanity check
|
||||
[ -f "${ORI_RDGZ_FILE}" ] || (die "${ORI_RDGZ_FILE} not found!" | tee -a "${LOG_FILE}")
|
||||
if [ ! -f "${ORI_RDGZ_FILE}" ]; then
|
||||
echo "ERROR: ${ORI_RDGZ_FILE} not found!" >"${LOG_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "Patching Ramdisk"
|
||||
|
||||
@ -35,6 +38,7 @@ HDDSORT="$(readConfigKey "arc.hddsort" "${USER_CONFIG_FILE}")"
|
||||
USBMOUNT="$(readConfigKey "arc.usbmount" "${USER_CONFIG_FILE}")"
|
||||
KVMSUPPORT="$(readConfigKey "arc.kvm" "${USER_CONFIG_FILE}")"
|
||||
MODULESCOPY="$(readConfigKey "arc.modulescopy" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Check if DSM Version changed
|
||||
. "${RAMDISK_PATH}/etc/VERSION"
|
||||
@ -48,6 +52,9 @@ RD_COMPRESSED="$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].rd-compres
|
||||
PAT_URL="$(readConfigKey "arc.paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "arc.pathash" "${USER_CONFIG_FILE}")"
|
||||
|
||||
[ "${PAT_URL:0:1}" = "#" ] && PAT_URL=""
|
||||
[ "${PAT_HASH:0:1}" = "#" ] && PAT_URL=""
|
||||
|
||||
if [ "${PRODUCTVERDSM}" != "${PRODUCTVER}" ]; then
|
||||
# Update new buildnumber
|
||||
echo -e "Ramdisk Version ${PRODUCTVER} does not match DSM Version ${PRODUCTVERDSM}!"
|
||||
@ -55,12 +62,15 @@ if [ "${PRODUCTVERDSM}" != "${PRODUCTVER}" ]; then
|
||||
writeConfigKey "productver" "${USER_CONFIG_FILE}"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
KVER="$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")"
|
||||
PATURL=""
|
||||
PATSUM=""
|
||||
PAT_URL=""
|
||||
PAT_HASH=""
|
||||
fi
|
||||
|
||||
# Sanity check
|
||||
[[ -z "${PLATFORM}" || -z "${KVER}" ]] && (die "ERROR: Configuration for Model ${MODEL} and Version ${PRODUCTVER} not found." | tee -a "${LOG_FILE}")
|
||||
if [[ -z "${PLATFORM}" || -z "${KVER}" ]]; then
|
||||
echo "ERROR: Configuration for model ${MODEL} and productversion ${PRODUCTVER} not found." >"${LOG_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Modify KVER for Epyc7002
|
||||
if [ "${PLATFORM}" = "epyc7002" ]; then
|
||||
@ -74,38 +84,40 @@ declare -A MODULES
|
||||
# Read synoinfo from config
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -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
|
||||
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
done <<<$(readConfigMap "addons" "${USER_CONFIG_FILE}")
|
||||
# Read modules from config
|
||||
while IFS=': ' read -r KEY VALUE; do
|
||||
[ -n "${KEY}" ] && MODULES["${KEY}"]="${VALUE}"
|
||||
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
|
||||
done <<<$(readConfigMap "modules" "${USER_CONFIG_FILE}")
|
||||
|
||||
# Patches (diff -Naru OLDFILE NEWFILE > xxx.patch)
|
||||
while read -r PE; do
|
||||
RET=1
|
||||
echo "Patching with ${PE}" >"${LOG_FILE}" 2>&1
|
||||
echo "Patching with ${PE}" >"${LOG_FILE}"
|
||||
for PF in $(ls ${PATCH_PATH}/${PE} 2>/dev/null); do
|
||||
echo "Patching with ${PF}" >>"${LOG_FILE}" 2>&1
|
||||
echo "Patching with ${PF}" >>"${LOG_FILE}"
|
||||
(
|
||||
cd "${RAMDISK_PATH}"
|
||||
patch -p1 -i "${PF}" >>"${LOG_FILE}" 2>&1
|
||||
busybox patch -p1 -i "${PF}" >>"${LOG_FILE}" 2>&1 # busybox patch and gun patch have different processing methods and parameters.
|
||||
)
|
||||
RET=$?
|
||||
[ ${RET} -eq 0 ] && break
|
||||
done
|
||||
[ ${RET} -ne 0 ] && dieLog
|
||||
done < <(readModelArray "${MODEL}" "productvers.[${PRODUCTVER}].patch")
|
||||
[ ${RET} -ne 0 ] && exit 1
|
||||
done <<<$(readModelArray "${MODEL}" "productvers.[${PRODUCTVER}].patch")
|
||||
|
||||
# Patch /etc/synoinfo.conf
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
done
|
||||
# Add serial number to synoinfo.conf, to help to recovery a installed DSM
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
echo "Set synoinfo SN" >"${LOG_FILE}"
|
||||
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
for KEY in ${!SYNOINFO[@]}; do
|
||||
echo "Set synoinfo ${KEY}" >>"${LOG_FILE}"
|
||||
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
done
|
||||
|
||||
# Patch /sbin/init.post
|
||||
grep -v -e '^[\t ]*#' -e '^$' "${PATCH_PATH}/config-manipulators.sh" >"${TMP_PATH}/rp.txt"
|
||||
@ -122,14 +134,15 @@ sed -e "/@@@CONFIG-GENERATED@@@/ {" -e "r ${TMP_PATH}/rp.txt" -e 'd' -e '}' -i "
|
||||
rm -f "${TMP_PATH}/rp.txt"
|
||||
|
||||
# Extract Modules to Ramdisk
|
||||
installModules "${PLATFORM}" "${KVER}" "${!MODULES[@]}"
|
||||
installModules "${PLATFORM}" "${KVER}" "${!MODULES[@]}" || exit 1
|
||||
|
||||
# Copying fake modprobe
|
||||
cp -f "${PATCH_PATH}/iosched-trampoline.sh" "${RAMDISK_PATH}/usr/sbin/modprobe"
|
||||
# Copying LKM to /usr/lib/modules
|
||||
gzip -dc "${LKM_PATH}/rp-${PLATFORM}-${KVER}-${LKM}.ko.gz" >"${RAMDISK_PATH}/usr/lib/modules/rp.ko"
|
||||
gzip -dc "${LKM_PATH}/rp-${PLATFORM}-${KVER}-${LKM}.ko.gz" >"${RAMDISK_PATH}/usr/lib/modules/rp.ko" 2>"${LOG_FILE}" || exit 1
|
||||
|
||||
# Addons
|
||||
echo "Create addons.sh" >"${LOG_FILE}"
|
||||
mkdir -p "${RAMDISK_PATH}/addons"
|
||||
echo "#!/bin/sh" >"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo 'echo "addons.sh called with params ${@}"' >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
@ -143,40 +156,37 @@ echo "export LAYOUT=${LAYOUT}" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
echo "export KEYMAP=${KEYMAP}" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# Required Addons: revert
|
||||
installAddon "revert" "${PLATFORM}" "${KVER}"
|
||||
echo "/addons/revert.sh \${1} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
# Required addons: "revert" "misc" "eudev" "disks" "localrss" "wol"
|
||||
# This order cannot be changed.
|
||||
for ADDON in "revert" "misc" "eudev" "disks" "localrss" "notify" "wol"; do
|
||||
PARAMS=""
|
||||
if [ "${ADDON}" = "disks" ]; then
|
||||
PARAMS="${HDDSORT} ${USBMOUNT}"
|
||||
fi
|
||||
if [ "${ADDON}" = "eudev" ]; then
|
||||
PARAMS="${MODULESCOPY} ${KVMSUPPORT}"
|
||||
fi
|
||||
installAddon "${ADDON}" "${PLATFORM}" "${KVER}" || exit 1
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
|
||||
done
|
||||
|
||||
# Install System Addons
|
||||
installAddon "eudev" "${PLATFORM}" "${KVER}"
|
||||
echo "/addons/eudev.sh \${1} ${MODULESCOPY} ${KVMSUPPORT} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
installAddon "disks" "${PLATFORM}" "${KVER}"
|
||||
echo "/addons/disks.sh \${1} ${HDDSORT} ${USBMOUNT} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
installAddon "misc" "${PLATFORM}" "${KVER}"
|
||||
echo "/addons/misc.sh \${1} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
installAddon "localrss" "${PLATFORM}" "${KVER}"
|
||||
echo "/addons/localrss.sh \${1} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
installAddon "wol" "${PLATFORM}" "${KVER}"
|
||||
echo "/addons/wol.sh \${1} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
|
||||
# User Addons check
|
||||
# User Addons
|
||||
for ADDON in ${!ADDONS[@]}; do
|
||||
PARAMS=${ADDONS[${ADDON}]}
|
||||
if ! installAddon "${ADDON}" "${PLATFORM}" "${KVER}"; then
|
||||
echo -n "${ADDON} is not available for this Platform!" | tee -a "${LOG_FILE}"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS} " >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
installAddon "${ADDON}" "${PLATFORM}" "${KVER}" || exit 1
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
|
||||
done
|
||||
|
||||
# Enable Telnet
|
||||
echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
|
||||
echo "inetd" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
echo "Modify files" >"${LOG_FILE}"
|
||||
# Remove function from scripts
|
||||
[ "2" = "${BUILDNUM: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
|
||||
# ${ARC_PATH}/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
|
||||
|
||||
# Copying modulelist
|
||||
if [ -f "${USER_UP_PATH}/modulelist" ]; then
|
||||
cp -f "${USER_UP_PATH}/modulelist" "${RAMDISK_PATH}/addons/modulelist"
|
||||
@ -184,9 +194,29 @@ else
|
||||
cp -f "${ARC_PATH}/include/modulelist" "${RAMDISK_PATH}/addons/modulelist"
|
||||
fi
|
||||
|
||||
# backup current loader configs
|
||||
BACKUP_PATH="${RAMDISK_PATH}/usr/arc/backup"
|
||||
rm -rf "${BACKUP_PATH}"
|
||||
for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}"; do
|
||||
if [ -f "${F}" ]; then
|
||||
FD="$(dirname "${F}")"
|
||||
mkdir -p "${FD/\/mnt/${BACKUP_PATH}}"
|
||||
cp -f "${F}" "${FD/\/mnt/${BACKUP_PATH}}"
|
||||
elif [ -d "${F}" ]; then
|
||||
SIZE="$(du -sm "${F}" 2>/dev/null | awk '{print $1}')"
|
||||
if [ ${SIZE:-0} -gt 4 ]; then
|
||||
echo "Backup of ${F} skipped, size is ${SIZE}MB" >>"${LOG_FILE}"
|
||||
continue
|
||||
fi
|
||||
FD="$(dirname "${F}")"
|
||||
mkdir -p "${FD/\/mnt/${BACKUP_PATH}}"
|
||||
cp -rf "${F}" "${FD/\/mnt/${BACKUP_PATH}}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Network card configuration file
|
||||
IPV6="$(readConfigKey "arc.ipv6" "${USER_CONFIG_FILE}")"
|
||||
ETHX=$(ls /sys/class/net/ | grep -v lo) || true
|
||||
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true
|
||||
for ETH in ${ETHX}; do
|
||||
if [ "${IPV6}" = "true" ]; then
|
||||
echo -e "DEVICE=${ETH}\nBOOTPROTO=dhcp\nONBOOT=yes\nIPV6INIT=dhcp\nIPV6_ACCEPT_RA=1" >"${RAMDISK_PATH}/etc/sysconfig/network-scripts/ifcfg-${ETH}"
|
||||
@ -208,18 +238,24 @@ if [ "${PLATFORM}" = "broadwellntbap" ]; then
|
||||
sed -i 's/IsUCOrXA="yes"/XIsUCOrXA="yes"/g; s/IsUCOrXA=yes/XIsUCOrXA=yes/g' ${RAMDISK_PATH}/usr/syno/share/environments.sh
|
||||
fi
|
||||
|
||||
#if [ "${PLATFORM}" = "kvmx64" ]; then
|
||||
# sed -i 's/kvmx64/RRING/g' ${RAMDISK_PATH}/etc/synoinfo.conf ${RAMDISK_PATH}/etc/VERSION
|
||||
#fi
|
||||
|
||||
# Call user patch scripts
|
||||
for F in $(ls -1 ${SCRIPTS_PATH}/*.sh 2>/dev/null); do
|
||||
echo "Calling ${F}" >>"${LOG_FILE}" 2>&1
|
||||
. "${F}" >>"${LOG_FILE}" 2>&1 || dieLog
|
||||
echo "Calling ${F}" >"${LOG_FILE}"
|
||||
. "${F}" >>"${LOG_FILE}" 2>&1 || exit 1
|
||||
done
|
||||
|
||||
# Reassembly ramdisk
|
||||
if [ "${RD_COMPRESSED}" == "true" ]; then
|
||||
(cd "${RAMDISK_PATH}" && find . | cpio -o -H newc -R root:root | xz -9 --format=lzma >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || dieLog
|
||||
(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 . | cpio -o -H newc -R root:root >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || dieLog
|
||||
(cd "${RAMDISK_PATH}" && find . 2>/dev/null | cpio -o -H newc -R root:root >"${MOD_RDGZ_FILE}") >"${LOG_FILE}" 2>&1 || exit 1
|
||||
fi
|
||||
|
||||
sync
|
||||
|
||||
# Clean
|
||||
rm -rf "${RAMDISK_PATH}"
|
||||
rm -rf "${RAMDISK_PATH}"
|
Loading…
Reference in New Issue
Block a user