mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 22:29:54 +07:00
tree: merge latest changes
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
dc80125b75
commit
8dcf836a69
@ -1,8 +1,8 @@
|
||||
###############################################################################
|
||||
# Permits user edit the user config
|
||||
function editUserConfig() {
|
||||
OLDMODEL="${MODEL}"
|
||||
OLDPRODUCTVER="${PRODUCTVER}"
|
||||
OLDMODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
OLDPRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --title "Edit with caution" \
|
||||
--ok-label "Save" --editbox "${USER_CONFIG_FILE}" 0 0 2>"${TMP_PATH}/userconfig"
|
||||
@ -726,26 +726,32 @@ function backupMenu() {
|
||||
fi
|
||||
done
|
||||
if [ -f "${USER_CONFIG_FILE}" ]; then
|
||||
. ${ARC_PATH}/include/compat.sh
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${PRODUCTVER}" ]; then
|
||||
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}"
|
||||
fi
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
updateAddons
|
||||
[ $? -ne 0 ] && updateFailed || true
|
||||
updateModules "${PLATFORM}" "${KVERP}"
|
||||
[ $? -ne 0 ] && updateFailed || true
|
||||
updateLKMs
|
||||
[ $? -ne 0 ] && updateFailed || true
|
||||
updatePatches
|
||||
[ $? -ne 0 ] && updateFailed || true
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
if [ "${KERNEL}" == "custom" ]; then
|
||||
updateCustom
|
||||
[ $? -ne 0 ] && updateFailed || true
|
||||
fi
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVERP}")
|
||||
fi
|
||||
CONFHASHFILE="$(sha256sum "${S_FILE}" | awk '{print $1}')"
|
||||
writeConfigKey "arc.confhash" "${CONFHASHFILE}" "${USER_CONFIG_FILE}"
|
||||
dialog --backtitle "$(backtitle)" --title "Restore Arc Config" \
|
||||
--aspect 18 --msgbox "Config restore successful!\nDownloading necessary files..." 0 0
|
||||
sleep 2
|
||||
ARCRESTORE="true"
|
||||
arcVersion
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
@ -811,39 +817,31 @@ function backupMenu() {
|
||||
###############################################################################
|
||||
# Shows update menu to user
|
||||
function updateMenu() {
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
NEXT="1"
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --colors --cancel-label "Exit" \
|
||||
--menu "Choose an Option" 0 0 0 \
|
||||
0 "Buildroot Branch: \Z1${ARCBRANCH}\Zn" \
|
||||
1 "Automated Update Mode" \
|
||||
2 "Full-Update Loader \Z1(update)\Zn" \
|
||||
3 "Full-Upgrade Loader \Z1(reflash)\Zn" \
|
||||
1 "Update Loader \Z1(no reflash)\Zn" \
|
||||
2 "Update Dependencies" \
|
||||
3 "Update Arc Patch" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
case "$(cat ${TMP_PATH}/resp)" in
|
||||
1)
|
||||
dialog --backtitle "$(backtitle)" --title "Automated Update" --aspect 18 \
|
||||
--msgbox "Loader will proceed Automated Update Mode.\nPlease wait until progress is finished!" 0 0
|
||||
arcUpdate
|
||||
;;
|
||||
2)
|
||||
# Ask for Tag
|
||||
TAG=""
|
||||
NEWVER="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
OLDVER="$(cat ${PART1_PATH}/ARC-VERSION)"
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Full-Update Loader" \
|
||||
--menu "Current: ${OLDVER} -> Which Version?" 7 50 0 \
|
||||
1 "Latest ${NEWVER}" \
|
||||
TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
OLD="$(cat ${PART1_PATH}/ARC-VERSION)"
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--menu "Current: ${OLD} -> Which Version?" 7 50 0 \
|
||||
1 "Latest ${TAG}" \
|
||||
2 "Select Version" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
[ $? -ne 0 ] && break
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
if [ ${opts} -eq 1 ]; then
|
||||
TAG=""
|
||||
[ -z "${TAG}" ] && return 1
|
||||
elif [ ${opts} -eq 2 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Full-Update Loader" \
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--inputbox "Type the Version!" 0 0 \
|
||||
2>"${TMP_PATH}/input"
|
||||
TAG=$(cat "${TMP_PATH}/input")
|
||||
@ -852,56 +850,14 @@ function updateMenu() {
|
||||
if updateLoader "${TAG}"; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
exec reboot && exit 0
|
||||
rebootTo "config"
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
arcUpdate
|
||||
;;
|
||||
3)
|
||||
# Ask for Tag
|
||||
TAG=""
|
||||
NEWVER="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
OLDVER="$(cat ${PART1_PATH}/ARC-VERSION)"
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--menu "Current: ${OLDVER} -> Which Version?" 7 50 0 \
|
||||
1 "Latest ${NEWVER}" \
|
||||
2 "Select Version" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
[ $? -ne 0 ] && break
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
if [ ${opts} -eq 1 ]; then
|
||||
TAG=""
|
||||
elif [ ${opts} -eq 2 ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--inputbox "Type the Version!" 0 0 \
|
||||
2>"${TMP_PATH}/input"
|
||||
TAG=$(cat "${TMP_PATH}/input")
|
||||
[ -z "${TAG}" ] && return 1
|
||||
fi
|
||||
if upgradeLoader "${TAG}"; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
exec reboot && exit 0
|
||||
fi
|
||||
;;
|
||||
0)
|
||||
# Ask for Arc Branch
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
dialog --clear --backtitle "$(backtitle)" --title "Switch Buildroot" \
|
||||
--menu "Current: ${ARCBRANCH} -> Which Branch?" 7 50 0 \
|
||||
1 "Stable Buildroot" \
|
||||
2 "Next Buildroot (latest)" \
|
||||
2>"${TMP_PATH}/opts"
|
||||
[ $? -ne 0 ] && break
|
||||
opts=$(cat ${TMP_PATH}/opts)
|
||||
if [ ${opts} -eq 1 ]; then
|
||||
writeConfigKey "arc.branch" "stable" "${USER_CONFIG_FILE}"
|
||||
elif [ ${opts} -eq 2 ]; then
|
||||
writeConfigKey "arc.branch" "next" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
dialog --backtitle "$(backtitle)" --title "Switch Buildroot" --aspect 18 \
|
||||
--msgbox "Using ${ARCBRANCH} Buildroot, now.\nUpdate the Loader to apply the changes!" 7 50
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
decryptMenu
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@ -936,15 +892,16 @@ function networkMenu() {
|
||||
###############################################################################
|
||||
# Shows Systeminfo to user
|
||||
function sysinfo() {
|
||||
# Check if machine has EFI
|
||||
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
|
||||
# Get System Informations
|
||||
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
|
||||
HWID="$(readConfigKey "arc.hwid" "${USER_CONFIG_FILE}")"
|
||||
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
|
||||
CPU=$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))
|
||||
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
|
||||
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')
|
||||
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
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
|
||||
@ -968,27 +925,23 @@ function sysinfo() {
|
||||
USERCMDLINEINFO="$(readConfigMap "cmdline" "${USER_CONFIG_FILE}")"
|
||||
USERSYNOINFO="$(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
[ "${BUILDDONE}" == "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}")"
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
CONFIGVER="$(readConfigKey "arc.version" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
|
||||
USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")"
|
||||
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
|
||||
HARDDRIVES="$(readConfigKey "device.harddrives" "${USER_CONFIG_FILE}")"
|
||||
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
|
||||
MODULESINFO="$(lsmod | awk -F' ' '{print $1}' | grep -v 'Module')"
|
||||
MODULESVERSION="$(cat "${MODULES_PATH}/VERSION")"
|
||||
ADDONSVERSION="$(cat "${ADDONS_PATH}/VERSION")"
|
||||
LKMVERSION="$(cat "${LKMS_PATH}/VERSION")"
|
||||
CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")"
|
||||
PATCHESVERSION="$(cat "${PATCH_PATH}/VERSION")"
|
||||
TIMEOUT=5
|
||||
TEXT=""
|
||||
# Print System Informations
|
||||
TEXT+="\n\Z4> System: ${MACHINE} | ${BOOTSYS} | ${BUS}\Zn"
|
||||
if [ -n ${HWID} ] && [ -n "${USERID}" ]; then
|
||||
TEXT+="\n\Z4> HWID | UserID: ${HWID} | ${USERID}\Zn"
|
||||
fi
|
||||
TEXT+="\n\n\Z4> System: ${MACHINE} | ${BOOTSYS} | ${BUS}\Zn"
|
||||
TEXT+="\n Vendor: \Zb${VENDOR}\Zn"
|
||||
TEXT+="\n CPU: \Zb${CPU}\Zn"
|
||||
if [ $(lspci -d ::300 | wc -l) -gt 0 ]; then
|
||||
@ -1007,14 +960,11 @@ function sysinfo() {
|
||||
TEXT+="\n CPU Scaling: \Zb${CPUFREQ}\Zn"
|
||||
TEXT+="\n Secure Boot: \Zb${SECURE}\Zn"
|
||||
TEXT+="\n Bootdisk: \Zb${LOADER_DISK}\Zn"
|
||||
[ -n "${REGION}" ] && [ -n "${TIMEZONE}" ] && TEXT+="\n Timezone: \Zb${REGION}/${TIMEZONE}\Zn"
|
||||
TEXT+="\n Time: \Zb$(date "+%F %H:%M:%S")\Zn"
|
||||
TEXT+="\n"
|
||||
TEXT+="\n\Z4> Network: ${ETHN} NIC\Zn\n"
|
||||
TEXT+="\n\Z4> Network: ${ETHN} NIC\Zn"
|
||||
for ETH in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
NETBUS=$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)
|
||||
while true; do
|
||||
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
|
||||
TEXT+="\n${DRIVER}: \ZbDOWN\Zn"
|
||||
@ -1033,20 +983,18 @@ function sysinfo() {
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
TEXT+="${DRIVER} (${SPEED}): \ZbLINK LOCAL (No DHCP server found.)\Zn"
|
||||
TEXT+="\n${DRIVER} (${SPEED}): \ZbLINK LOCAL (No DHCP server found.)\Zn"
|
||||
else
|
||||
TEXT+="${DRIVER} (${SPEED}): \Zb${IP}\Zn"
|
||||
TEXT+="\n${DRIVER} (${SPEED}): \Zb${IP}\Zn"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
TEXT+="\n\Zb$(lspci -s ${NETBUS} -nnk | awk '{$1=""}1' | awk '{$1=$1};1')\Zn\n"
|
||||
done
|
||||
# Print Config Informations
|
||||
TEXT+="\n\Z4> Arc: ${ARC_VERSION}\Zn"
|
||||
TEXT+="\n Branch: \Zb${ARCBRANCH}\Zn"
|
||||
TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn"
|
||||
TEXT+="\n\n\Z4> Arc: ${ARC_VERSION}\Zn"
|
||||
TEXT+="\n Branch: \Zb${ARC_BRANCH}\Zn"
|
||||
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
|
||||
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
|
||||
if [ "${CONFDONE}" == "true" ]; then
|
||||
@ -1061,14 +1009,12 @@ function sysinfo() {
|
||||
TEXT+="\n"
|
||||
TEXT+="\n Config not completed!\n"
|
||||
fi
|
||||
TEXT+="\n Modules loaded: \Zb${MODULESINFO}\Zn"
|
||||
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"
|
||||
TEXT+="\n Offline Mode: \Zb${OFFLINE}\Zn"
|
||||
if [[ "${REMAP}" == "acports" || "${REMAP}" == "maxports" ]]; then
|
||||
TEXT+="\n SataPortMap | DiskIdxMap: \Zb${PORTMAP} | ${DISKMAP}\Zn"
|
||||
elif [ "${REMAP}" == "remap" ]; then
|
||||
@ -1263,7 +1209,7 @@ function networkdiag() {
|
||||
fi
|
||||
done
|
||||
echo
|
||||
GITHUBAPI=$(curl --interface ${ETH} -m 3 -skL https://api.github.com/repos/AuxXxilium/arc/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
|
||||
GITHUBAPI=$(curl --interface ${ETH} -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)
|
||||
if [[ $? -ne 0 || -z "${GITHUBAPI}" ]]; then
|
||||
echo -e "Github API not reachable!"
|
||||
else
|
||||
@ -1545,25 +1491,6 @@ function bootipwaittime() {
|
||||
writeConfigKey "bootipwait" "${BOOTIPWAIT}" "${USER_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# allow user to save modifications to disk
|
||||
function saveMenu() {
|
||||
dialog --backtitle "$(backtitle)" --title "Save to Disk" \
|
||||
--yesno "Warning:\nDo not terminate midway, otherwise it may cause damage to the arc. Do you want to continue?" 0 0
|
||||
[ $? -ne 0 ] && return 1
|
||||
dialog --backtitle "$(backtitle)" --title "Save to Disk" \
|
||||
--infobox "Saving ..." 0 0
|
||||
RDXZ_PATH="${TMP_PATH}/rdxz_tmp"
|
||||
mkdir -p "${RDXZ_PATH}"
|
||||
(cd "${RDXZ_PATH}"; xz -dc <"${PART3_PATH}/initrd-arc" | cpio -idm) >/dev/null 2>&1 || true
|
||||
rm -rf "${RDXZ_PATH}/opt/arc" >/dev/null
|
||||
cp -Rf "$(dirname ${ARC_PATH})" "${RDXZ_PATH}"
|
||||
(cd "${RDXZ_PATH}"; find . 2>/dev/null | cpio -o -H newc -R root:root | xz --check=crc32 >"${PART3_PATH}/initrd-arc") || true
|
||||
rm -rf "${RDXZ_PATH}" >/dev/null
|
||||
dialog --backtitle "$(backtitle)" --colors --aspect 18 \
|
||||
--msgbox "Save to Disk is complete." 0 0
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# let user format disks from inside arc
|
||||
@ -1612,61 +1539,6 @@ function formatDisks() {
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# install opkg package manager
|
||||
function package() {
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Package" \
|
||||
--yesno "This installs opkg Package Management,\nallowing you to install more Tools for use and debugging.\nDo you want to continue?" 0 0
|
||||
[ $? -ne 0 ] && return
|
||||
(
|
||||
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
|
||||
opkg update
|
||||
#opkg install python3 python3-pip
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Package" \
|
||||
--progressbox "Installing opkg ..." 20 100
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Package" \
|
||||
--msgbox "Installation is complete.\nPlease reconnect to ssh/web,\nor execute 'source ~/.bashrc'" 0 0
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# let user format disks from inside arc
|
||||
function forcessh() {
|
||||
DSMROOTS="$(findDSMRoot)"
|
||||
if [ -z "${DSMROOTS}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Force enable SSH" \
|
||||
--msgbox "No DSM system partition(md0) found!\nPlease insert all disks before continuing." 0 0
|
||||
return
|
||||
fi
|
||||
(
|
||||
ONBOOTUP=""
|
||||
ONBOOTUP="${ONBOOTUP}systemctl restart inetd\n"
|
||||
ONBOOTUP="${ONBOOTUP}synowebapi --exec api=SYNO.Core.Terminal method=set version=3 enable_telnet=true enable_ssh=true ssh_port=22 forbid_console=false\n"
|
||||
ONBOOTUP="${ONBOOTUP}echo \"DELETE FROM task WHERE task_name LIKE ''ARCONBOOTUPARC_SSH'';\" | sqlite3 /usr/syno/etc/esynoscheduler/esynoscheduler.db\n"
|
||||
mkdir -p "${TMP_PATH}/mdX"
|
||||
for I in ${DSMROOTS}; do
|
||||
mount -t ext4 "${I}" "${TMP_PATH}/mdX"
|
||||
[ $? -ne 0 ] && continue
|
||||
if [ -f "${TMP_PATH}/mdX/usr/syno/etc/esynoscheduler/esynoscheduler.db" ]; then
|
||||
sqlite3 ${TMP_PATH}/mdX/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
|
||||
DELETE FROM task WHERE task_name LIKE 'ARCONBOOTUPARC_SSH';
|
||||
INSERT INTO task VALUES('ARCONBOOTUPARC_SSH', '', 'bootup', '', 1, 0, 0, 0, '', 0, '$(echo -e ${ONBOOTUP})', 'script', '{}', '', '', '{}', '{}');
|
||||
EOF
|
||||
sleep 1
|
||||
sync
|
||||
echo "true" >${TMP_PATH}/isEnable
|
||||
fi
|
||||
umount "${TMP_PATH}/mdX"
|
||||
done
|
||||
rm -rf "${TMP_PATH}/mdX" >/dev/null
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Force enable SSH" \
|
||||
--progressbox "$(TEXT "Enabling ...")" 20 100
|
||||
[ "$(cat ${TMP_PATH}/isEnable 2>/dev/null)" == "true" ] && MSG="Enable Telnet&SSH successfully." || MSG="Enable Telnet&SSH failed."
|
||||
dialog --backtitle "$(backtitle)" --title "Force enable SSH" \
|
||||
--msgbox "${MSG}" 0 0
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Clone Loader Disk
|
||||
function cloneLoader() {
|
||||
@ -1711,7 +1583,7 @@ function cloneLoader() {
|
||||
rm -rf "${PART3_PATH}/dl" >/dev/null
|
||||
CLEARCACHE=0
|
||||
|
||||
gzip -dc "${ARC_PATH}/grub.img.gz" | dd of="${resp}" bs=1M conv=fsync status=progress
|
||||
gzip -dc "${PART3_PATH}/image/grub.img.gz" | dd of="${resp}" bs=1M conv=fsync status=progress
|
||||
hdparm -z "${resp}" # reset disk cache
|
||||
fdisk -l "${resp}"
|
||||
sleep 3
|
||||
@ -1750,11 +1622,19 @@ function resetLoader() {
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null
|
||||
fi
|
||||
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}" >/dev/null
|
||||
[ -d "${SYSTEM_PATH}" ] && rm -rf "${SYSTEM_PATH}" >/dev/null
|
||||
[ -d "${ADDONS_PATH}" ] && rm -rf "${ADDONS_PATH}" >/dev/null
|
||||
[ -d "${MODULES_PATH}" ] && rm -rf "${MODULES_PATH}" >/dev/null
|
||||
[ -d "${MODEL_CONFIG_PATH}" ] && rm -rf "${MODEL_CONFIG_PATH}" >/dev/null
|
||||
[ -d "${PATCH_PATH}" ] && rm -rf "${PATCH_PATH}" >/dev/null
|
||||
[ -d "${LKMS_PATH}" ] && rm -rf "${LKMS_PATH}" >/dev/null
|
||||
[ -d "${CUSTOM_PATH}" ] && rm -rf "${CUSTOM_PATH}" >/dev/null
|
||||
[ -d "${USER_UP_PATH}" ] && rm -rf "${USER_UP_PATH}" >/dev/null
|
||||
[ -f "${USER_CONFIG_FILE}" ] && rm -f "${USER_CONFIG_FILE}" >/dev/null
|
||||
dialog --backtitle "$(backtitle)" --title "Reset Loader" --aspect 18 \
|
||||
--yesno "Reset successful.\nReinit required!" 0 0
|
||||
--yesno "Reset successful.\nReboot required!" 0 0
|
||||
[ $? -ne 0 ] && return
|
||||
init.sh
|
||||
rebootTo config
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -1894,101 +1774,47 @@ function satadomMenu() {
|
||||
###############################################################################
|
||||
# Decrypt Menu
|
||||
function decryptMenu() {
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
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
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/arc-configs.zip"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/configs.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "Download: $progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/configs.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "Download: $progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
fi
|
||||
if [ -f "${TMP_PATH}/configs.zip" ]; then
|
||||
echo "Download successful!"
|
||||
mkdir -p "${MODEL_CONFIG_PATH}"
|
||||
echo "Installing new Configs..."
|
||||
unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"
|
||||
rm -f "${TMP_PATH}/configs.zip"
|
||||
echo "Installation done!"
|
||||
sleep 2
|
||||
else
|
||||
echo "Error extracting new Version!"
|
||||
sleep 5
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Arc Decrypt" \
|
||||
--progressbox "Installing Arc Patch Configs..." 20 50
|
||||
else
|
||||
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCOFFLINE}" == "false" ]; then
|
||||
updateConfigs
|
||||
fi
|
||||
if openssl enc -in "${S_FILE_ENC}" -out "${S_FILE_ARC}" -d -aes-256-cbc -k "${ARCKEY}" 2>/dev/null; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
||||
--msgbox "Can't connect to Github.\nCheck your Network!" 6 50
|
||||
return
|
||||
fi
|
||||
if [ -f "${S_FILE_ENC}" ]; then
|
||||
CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")"
|
||||
--msgbox "Decrypt successful: You can select Arc Patch." 5 50
|
||||
mv -f "${S_FILE_ARC}" "${S_FILE}"
|
||||
else
|
||||
while true; do
|
||||
CONFIGSVERSION=$(cat "${MODEL_CONFIG_PATH}/VERSION")
|
||||
cp -f "${S_FILE}" "${S_FILE}.bak"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
||||
--inputbox "Enter Decryption Key for ${CONFIGSVERSION} !\nKey is available in my Discord:\nhttps://discord.auxxxilium.tech" 9 50 2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && return
|
||||
--inputbox "Enter Decryption Key for ${CONFIGSVERSION}!\nKey is available in my Discord:\nhttps://discord.auxxxilium.tech" 9 50 2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
ARCKEY=$(cat "${TMP_PATH}/resp")
|
||||
if openssl enc -in "${S_FILE_ENC}" -out "${S_FILE_ARC}" -d -aes-256-cbc -k "${ARCKEY}" 2>/dev/null; then
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
||||
--msgbox "Decrypt successful: You can use Arc Patch." 5 50
|
||||
cp -f "${S_FILE_ARC}" "${S_FILE}"
|
||||
--msgbox "Decrypt successful: You can select Arc Patch." 5 50
|
||||
mv -f "${S_FILE_ARC}" "${S_FILE}"
|
||||
writeConfigKey "arc.key" "${ARCKEY}" "${USER_CONFIG_FILE}"
|
||||
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
else
|
||||
cp -f "${S_FILE}.bak" "${S_FILE}"
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
||||
--msgbox "Decrypt failed: Wrong Key for this Version." 5 50
|
||||
--msgbox "Decrypt failed: Wrong Key!" 5 50
|
||||
mv -f "${S_FILE}.bak" "${S_FILE}"
|
||||
writeConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
|
||||
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
fi
|
||||
CONFHASHFILE="$(sha256sum "${S_FILE}" | awk '{print $1}')"
|
||||
writeConfigKey "arc.confhash" "${CONFHASHFILE}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
||||
--msgbox "Not available in offline Mode!" 5 50
|
||||
if [ -n "${ARCKEY}" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# ArcNIC Menu
|
||||
function arcNIC () {
|
||||
ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)" # real network cards list
|
||||
rm -f "${TMP_PATH}/opts" >/dev/null
|
||||
touch "${TMP_PATH}/opts"
|
||||
echo -e "auto \"Automated\"" >>"${TMP_PATH}/opts"
|
||||
# Get NICs
|
||||
for ETH in ${ETHX}; do
|
||||
DRIVER="$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')"
|
||||
echo -e "${ETH} \"${DRIVER}\"" >>"${TMP_PATH}/opts"
|
||||
done
|
||||
dialog --backtitle "$(backtitle)" --title "Arc NIC" \
|
||||
--default-item "${ARCNIC}" --menu "Choose a NIC" 0 0 0 --file "${TMP_PATH}/opts" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
ARCNIC=${resp}
|
||||
writeConfigKey "arc.nic" "${ARCNIC}" "${USER_CONFIG_FILE}"
|
||||
return
|
||||
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -2000,7 +1826,6 @@ function rebootMenu() {
|
||||
# Selectable Reboot Options
|
||||
echo -e "config \"Arc: Config Mode\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "update \"Arc: Automated Update Mode\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "init \"Arc: Restart Loader Init\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "network \"Arc: Restart Network Service\"" >>"${TMP_PATH}/opts"
|
||||
if [ "${BUILDDONE}" == "true" ]; then
|
||||
echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/opts"
|
||||
@ -2019,18 +1844,15 @@ function rebootMenu() {
|
||||
dialog --backtitle "$(backtitle)" --title "Power Menu" \
|
||||
--infobox "Option: ${REDEST} selected ...!" 3 50
|
||||
if [ "${REDEST}" == "poweroff" ]; then
|
||||
poweroff
|
||||
exec poweroff
|
||||
exit 0
|
||||
elif [ "${REDEST}" == "shell" ]; then
|
||||
clear
|
||||
exit 0
|
||||
elif [ "${REDEST}" == "init" ]; then
|
||||
clear
|
||||
init.sh
|
||||
elif [ "${REDEST}" == "network" ]; then
|
||||
clear
|
||||
/etc/init.d/S41dhcpcd restart
|
||||
arc.sh
|
||||
exec init.sh
|
||||
else
|
||||
rebootTo ${REDEST}
|
||||
exit 0
|
||||
@ -2071,6 +1893,29 @@ function resetDSMNetwork {
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Mount DSM Storage Pools
|
||||
function mountDSM() {
|
||||
vgscan >/dev/null 2>&1
|
||||
vgchange -ay >/dev/null 2>&1
|
||||
VOLS="$(lvdisplay 2>/dev/null | grep 'LV Path' | grep -v 'syno_vg_reserved_area' | awk '{print $3}')"
|
||||
if [ -z "${VOLS}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Mount DSM Pool" \
|
||||
--msgbox "No storage pool found!" 0 0
|
||||
return
|
||||
fi
|
||||
for I in ${VOLS}; do
|
||||
NAME="$(echo "${I}" | awk -F'/' '{print $3"_"$4}')"
|
||||
mkdir -p "/mnt/DSM/${NAME}"
|
||||
umount "${I}" 2>/dev/null
|
||||
mount ${I} "/mnt/DSM/${NAME}" -o ro
|
||||
done
|
||||
MSG="Storage pools are mounted under /mnt/DSM.\nPlease check them via ${IPCON}:7304."
|
||||
dialog --backtitle "$(backtitle)" --title "Mount DSM Pool" \
|
||||
--msgbox "${MSG}" 7 50
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# CPU Governor Menu
|
||||
function governorMenu () {
|
||||
@ -2202,15 +2047,74 @@ function dtsMenu() {
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# reset Arc Patch
|
||||
function resetArcPatch() {
|
||||
writeConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
|
||||
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
# Get PAT Files
|
||||
function getpatfiles() {
|
||||
ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
|
||||
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
|
||||
mkdir -p "${USER_UP_PATH}"
|
||||
DSM_FILE="${USER_UP_PATH}/${PAT_HASH}.tar"
|
||||
VALID="false"
|
||||
if [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" == "false" ]; then
|
||||
rm -f ${USER_UP_PATH}/*.tar
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
|
||||
--infobox "Downloading DSM Boot File..." 3 40
|
||||
# Get new Files
|
||||
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar"
|
||||
if curl -skL "${DSM_URL}" -o "${DSM_FILE}"; then
|
||||
VALID="true"
|
||||
fi
|
||||
elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" == "true" ]; then
|
||||
rm -f ${USER_UP_PATH}/*.tar
|
||||
while true; do
|
||||
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
|
||||
--msgbox "Please upload the DSM Boot File to ${USER_UP_PATH}.\nLink: https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar\nUse ${IPCON}:7304 and OK after Upload" 0 0
|
||||
if [ -f "${DSM_FILE}" ]; then
|
||||
VALID="true"
|
||||
break
|
||||
fi
|
||||
done
|
||||
elif [ -f "${DSM_FILE}" ]; then
|
||||
VALID="true"
|
||||
fi
|
||||
mkdir -p "${UNTAR_PAT_PATH}"
|
||||
if [ "${VALID}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "DSM Extraction" --aspect 18 \
|
||||
--infobox "Copying DSM Files..." 3 40
|
||||
tar -xf "${DSM_FILE}" -C "${UNTAR_PAT_PATH}" 2>/dev/null
|
||||
copyDSMFiles "${UNTAR_PAT_PATH}" 2>/dev/null
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "DSM Extraction" --aspect 18 \
|
||||
--infobox "DSM Extraction failed!\nExit." 4 40
|
||||
sleep 5
|
||||
fi
|
||||
# Cleanup
|
||||
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}"
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Generate HardwareID
|
||||
function genHardwareID() {
|
||||
HWID="$(echo $(dmidecode -t 4 | grep ID | sed 's/.*ID://;s/ //g') \ $(ifconfig | grep eth0 | awk '{print $NF}' | sed 's/://g') | sha256sum | awk '{print $1}' | cut -c1-12)" 2>/dev/null
|
||||
writeConfigKey arc.hwid "${HWID}" "${USER_CONFIG_FILE}"
|
||||
if [ -n "${HWID}" ]; then
|
||||
HWDB="$(curl -skL "https://auxxxilium.tech/hwid.yml")"
|
||||
if grep -q "${HWID}" "${HWDB}"; then
|
||||
dialog --backtitle "$(backtitle)" --title "HardwareID" \
|
||||
--msgbox "HardwareID: ${HWID}\n\nYour HardwareID is registered!" 0 0
|
||||
USERID="$(grep -q "${HWID}" "${HWDB}" | awk '{print $1}')"
|
||||
writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "HardwareID" \
|
||||
--msgbox "HardwareID: ${HWID}\n\nYour HardwareID is not registered!" 0 0
|
||||
fi
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "HardwareID" \
|
||||
--msgbox "HardwareID: Verification failed!" 0 0
|
||||
exit 1
|
||||
fi
|
||||
return
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ rm -rf /sys/fs/pstore/* >/dev/null 2>&1 || true
|
||||
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
[ "${BUILDDONE}" == "false" ] && die "Loader build not completed!"
|
||||
ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
@ -25,7 +25,8 @@ clear
|
||||
COLUMNS=${COLUMNS:-50}
|
||||
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
|
||||
TITLE="Version:"
|
||||
TITLE+=" ${ARC_TITLE} | ${ARCBRANCH}"
|
||||
TITLE+=" ${ARC_VERSION}"
|
||||
[ -n "${ARC_BRANCH}" ] && TITLE+=" | Branch: ${ARC_BRANCH}"
|
||||
printf "\033[1;30m%*s\n" ${COLUMNS} ""
|
||||
printf "\033[1;30m%*s\033[A\n" ${COLUMNS} ""
|
||||
printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
|
||||
@ -39,7 +40,6 @@ ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")"
|
||||
ZIMAGE_HASH_CUR="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')"
|
||||
RAMDISK_HASH="$(readConfigKey "ramdisk-hash" "${USER_CONFIG_FILE}")"
|
||||
RAMDISK_HASH_CUR="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')"
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ZIMAGE_HASH_CUR}" != "${ZIMAGE_HASH}" ] || [ "${RAMDISK_HASH_CUR}" != "${RAMDISK_HASH}" ]; then
|
||||
echo -e "\033[1;31mDSM zImage/Ramdisk changed!\033[0m"
|
||||
livepatch
|
||||
@ -56,10 +56,7 @@ SMALLNUM="$(readConfigKey "smallnum" "${USER_CONFIG_FILE}")"
|
||||
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
|
||||
CPU="$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))"
|
||||
RAMTOTAL="$(awk '/MemTotal:/ {printf "%.0f\n", $2 / 1024 / 1024 + 0.5}' /proc/meminfo 2>/dev/null)"
|
||||
VENDOR="$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')"
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
REGION="$(readConfigKey "time.region" "${USER_CONFIG_FILE}")"
|
||||
TIMEZONE="$(readConfigKey "time.timezone" "${USER_CONFIG_FILE}")"
|
||||
VENDOR="$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')"
|
||||
|
||||
echo -e "\033[1;37mDSM:\033[0m"
|
||||
echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m"
|
||||
@ -72,10 +69,6 @@ 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
|
||||
echo -e "\033[1;37mLocation:\033[0m"
|
||||
echo -e "Keymap: \033[1;37m${KEYMAP}\033[0m"
|
||||
echo -e "Timezone: \033[1;37m${REGION}/${TIMEZONE}\033[0m"
|
||||
echo
|
||||
|
||||
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
|
||||
HASATA=0
|
||||
@ -159,7 +152,7 @@ CMDLINE['log_buf_len']="32M"
|
||||
CMDLINE['panic']="${KERNELPANIC:-0}"
|
||||
CMDLINE['pcie_aspm']="off"
|
||||
CMDLINE['modprobe.blacklist']="${MODBLACKLIST}"
|
||||
[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable"
|
||||
#[ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ] && CMDLINE["intel_pstate"]="disable"
|
||||
|
||||
#if [ -n "$(ls /dev/mmcblk* 2>/dev/null)" ] && [ "${BUS}" != "mmc" ] && [ "${EMMCBOOT}" != "true" ]; then
|
||||
# if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "sdhci"; then
|
||||
@ -190,7 +183,7 @@ ETHN="$(echo ${ETHX} | wc -w)"
|
||||
NIC=0
|
||||
for ETH in ${ETHX}; do
|
||||
MAC="$(readConfigKey "${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | tr '[:lower:]' '[:upper:]')"
|
||||
NIC=$((${NIC} + 1))
|
||||
[ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}"
|
||||
[ ${NIC} -ge ${ETHM} ] && break
|
||||
@ -233,17 +226,18 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
|
||||
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
|
||||
IPCON=""
|
||||
if [ "${ARCPATCH}" == "true" ]; then
|
||||
echo -e "\033[1;34mUsing ${NIC} NIC for Arc Patch.\033[0m"
|
||||
echo
|
||||
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"
|
||||
fi
|
||||
echo -e "\033[1;34mDetected ${ETHN} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
|
||||
echo
|
||||
sleep 3
|
||||
for ETH in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
while true; do
|
||||
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m NOT CONNECTED"
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT} + 1))
|
||||
@ -251,19 +245,19 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
echo -e "\r\033[1;37m${DRIVER} (${SPEED}):\033[0m LINK LOCAL (No DHCP server found.)"
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
else
|
||||
echo -e "\r\033[1;37m${DRIVER} (${SPEED}):\033[0m Access \033[1;34mhttp://${IP}:5000\033[0m to connect to DSM via web."
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m DOWN"
|
||||
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m TIMEOUT"
|
||||
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -288,8 +282,6 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
|
||||
rm -f WB WC
|
||||
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
|
||||
|
||||
echo -e "\033[1;37mLoading DSM kernel...\033[0m"
|
||||
|
||||
DSMLOGO="$(readConfigKey "dsmlogo" "${USER_CONFIG_FILE}")"
|
||||
if [ "${DSMLOGO}" == "true" ] && [ -c "/dev/fb0" ]; then
|
||||
[[ "${IPCON}" =~ ^169\.254\..* ]] && IPCON=""
|
||||
@ -302,6 +294,15 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
|
||||
[ -f "${TMP_PATH}/qrcode_boot.png" ] && echo | fbv -acufi "${TMP_PATH}/qrcode_boot.png" >/dev/null 2>/dev/null || true
|
||||
fi
|
||||
|
||||
for T in $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
|
||||
if [ -n "${IPCON}" ]; then
|
||||
[ -w "/dev/${T}" ] && echo -e "Use \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\n" >"/dev/${T}" 2>/dev/null || true
|
||||
else
|
||||
[ -w "/dev/${T}" ] && echo -e "Try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n\n\033[1;37mThis interface will not be operational. Wait a few minutes.\nNo IP found. \033[0m\n" >"/dev/${T}" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\033[1;37mLoading DSM Kernel...\033[0m"
|
||||
# Executes DSM kernel via KEXEC
|
||||
KEXECARGS="-a"
|
||||
if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 4 ] && [ ${EFI} -eq 1 ]; then
|
||||
@ -310,16 +311,7 @@ elif [ "${DIRECTBOOT}" == "false" ]; then
|
||||
fi
|
||||
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
|
||||
|
||||
for T in $(busybox w 2>/dev/null | grep -v 'TTY' | awk '{print $2}'); do
|
||||
if [ -n "${IPCON}" ]; then
|
||||
[ -w "/dev/${T}" ] && echo -e "\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\nUse \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
|
||||
else
|
||||
[ -w "/dev/${T}" ] && echo -e "\n\033[1;37mThis interface will not be operational. Wait a few minutes.\nNo IP found. \033[0m\nTry \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n" >"/dev/${T}" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\033[1;37mBooting DSM...\033[0m"
|
||||
# Boot to DSM
|
||||
[ "${KERNELLOAD}" == "kexec" ] && kexec -e || poweroff
|
||||
fi
|
||||
exit 0
|
||||
[ "${KERNELLOAD}" == "kexec" ] && exec kexec -e || exec poweroff
|
||||
fi
|
@ -1,13 +1,4 @@
|
||||
###############################################################################
|
||||
# Compatibility boot
|
||||
|
||||
function compatboot () {
|
||||
# Timezone
|
||||
TIMEZONE="$(readConfigKey "time.timezone" "${USER_CONFIG_FILE}")"
|
||||
REGION="$(readConfigKey "time.region" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${TIMEZONE}" ] && [ -n "${REGION}" ]; then
|
||||
ln -sf "/usr/share/zoneinfo/right/${TIMEZONE}/${REGION}" /etc/localtime
|
||||
fi
|
||||
# Check for compatibility
|
||||
deleteConfigKey "nanover" "${USER_CONFIG_FILE}"
|
||||
}
|
||||
# Update Offline Configs
|
||||
updateOffline
|
@ -1,12 +1,17 @@
|
||||
ARC_VERSION="24.1.1"
|
||||
ARC_TITLE="Arc ${ARC_VERSION}"
|
||||
|
||||
# Define paths
|
||||
PART1_PATH="/mnt/p1"
|
||||
PART2_PATH="/mnt/p2"
|
||||
PART3_PATH="/mnt/p3"
|
||||
TMP_PATH="/tmp"
|
||||
|
||||
if [ -f "${PART1_PATH}/ARC-BRANCH" ]; then
|
||||
ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH")
|
||||
fi
|
||||
if [ -f "${PART1_PATH}/ARC-VERSION" ]; then
|
||||
ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION")
|
||||
fi
|
||||
ARC_TITLE="Arc ${ARC_VERSION}"
|
||||
|
||||
RAMDISK_PATH="${TMP_PATH}/ramdisk"
|
||||
LOG_FILE="${TMP_PATH}/log.txt"
|
||||
TMP_UP_PATH="${TMP_PATH}/upload"
|
||||
@ -23,6 +28,7 @@ ARC_RAMDISK_FILE="${PART3_PATH}/initrd-arc"
|
||||
MOD_ZIMAGE_FILE="${PART3_PATH}/zImage-dsm"
|
||||
MOD_RDGZ_FILE="${PART3_PATH}/initrd-dsm"
|
||||
|
||||
SYSTEM_PATH="${PART3_PATH}/system"
|
||||
ADDONS_PATH="${PART3_PATH}/addons"
|
||||
MODULES_PATH="${PART3_PATH}/modules"
|
||||
MODEL_CONFIG_PATH="${PART3_PATH}/configs"
|
||||
@ -35,6 +41,7 @@ UNTAR_PAT_PATH="${PART3_PATH}/DSM"
|
||||
S_FILE="${MODEL_CONFIG_PATH}/serials.yml"
|
||||
S_FILE_ARC="${MODEL_CONFIG_PATH}/arc_serials.yml"
|
||||
S_FILE_ENC="${MODEL_CONFIG_PATH}/arc_serials.enc"
|
||||
S_FILE_CHECK="${MODEL_CONFIG_PATH}/arc_serials.checksum"
|
||||
P_FILE="${MODEL_CONFIG_PATH}/platforms.yml"
|
||||
|
||||
EXTRACTOR_PATH="${PART3_PATH}/extractor"
|
||||
|
@ -351,7 +351,7 @@ def getmodelsoffline(platforms=None):
|
||||
PS = []
|
||||
|
||||
models = []
|
||||
with open(os.path.join('/mnt/p3/offline', "offline.json")) as user_file:
|
||||
with open(os.path.join('/mnt/p3/system/include', "offline.json")) as user_file:
|
||||
data = json.load(user_file)
|
||||
|
||||
for I in data["channel"]["item"]:
|
||||
|
@ -387,6 +387,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"
|
||||
[ ! -f "${USER_GRUBENVFILE}" ] && grub-editenv ${USER_GRUBENVFILE} create
|
||||
# echo -e "Rebooting to ${1} mode..."
|
||||
grub-editenv ${USER_GRUBENVFILE} set next_entry="${1}"
|
||||
@ -398,10 +399,8 @@ function rebootTo() {
|
||||
# 1 - DSM root path
|
||||
function copyDSMFiles() {
|
||||
if [ -f "${1}/grub_cksum.syno" ] && [ -f "${1}/GRUB_VER" ] && [ -f "${1}/zImage" ] && [ -f "${1}/rd.gz" ]; then
|
||||
# Remove old model files
|
||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/grub_cksum.syno" "${PART2_PATH}/GRUB_VER"
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}"
|
||||
# Remove old build files
|
||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/grub_cksum.syno" "${PART2_PATH}/GRUB_VER" >/dev/null
|
||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" >/dev/null
|
||||
rm -f "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null
|
||||
# Copy new model files
|
||||
cp -f "${1}/grub_cksum.syno" "${PART1_PATH}"
|
||||
@ -482,36 +481,6 @@ function livepatch() {
|
||||
PVALID="false"
|
||||
fi
|
||||
fi
|
||||
if [ "${PVALID}" == "false" ]; then
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
if [ "${OFFLINE}" == "false" ]; then
|
||||
# Load update functions
|
||||
. ${ARC_PATH}/include/update.sh
|
||||
# Update Patches
|
||||
echo -e "Updating Patches..."
|
||||
updatePatches
|
||||
# Patch zImage
|
||||
echo -n "Patching zImage"
|
||||
if ${ARC_PATH}/zimage-patch.sh; then
|
||||
echo -e " - successful!"
|
||||
PVALID="true"
|
||||
else
|
||||
echo -e " - failed!"
|
||||
PVALID="false"
|
||||
fi
|
||||
if [ "${PVALID}" == "true" ]; then
|
||||
# Patch Ramdisk
|
||||
echo -n "Patching Ramdisk"
|
||||
if ${ARC_PATH}/ramdisk-patch.sh; then
|
||||
echo -e " - successful!"
|
||||
PVALID="true"
|
||||
else
|
||||
echo -e " - failed!"
|
||||
PVALID="false"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "${PVALID}" == "false" ]; then
|
||||
echo
|
||||
echo -e "Patching DSM Files failed! Please stay patient for Update."
|
||||
@ -531,27 +500,17 @@ function livepatch() {
|
||||
function ntpCheck() {
|
||||
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
if [ "${OFFLINE}" == "false" ]; then
|
||||
# Timezone
|
||||
REGION="$(readConfigKey "time.region" "${USER_CONFIG_FILE}")"
|
||||
TIMEZONE="$(readConfigKey "time.timezone" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${REGION}" ] || [ -z "${TIMEZONE}" ]; then
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
REGION="$(curl -m 5 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f1)"
|
||||
TIMEZONE="$(curl -m 5 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f2)"
|
||||
[ -z "${KEYMAP}" ] && KEYMAP="$(curl -m 5 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
|
||||
else
|
||||
REGION="$(curl --interface ${ARCNIC} -m 5 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f1)"
|
||||
TIMEZONE="$(curl --interface ${ARCNIC} -m 5 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f2)"
|
||||
[ -z "${KEYMAP}" ] && KEYMAP="$(curl --interface ${ARCNIC} -m 5 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
|
||||
fi
|
||||
writeConfigKey "time.region" "${REGION}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "time.timezone" "${TIMEZONE}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ -n "${REGION}" ] && [ -n "${TIMEZONE}" ]; then
|
||||
ln -sf "/usr/share/zoneinfo/right/${REGION}/${TIMEZONE}" /etc/localtime
|
||||
#hwclock --systohc
|
||||
fi
|
||||
REGION="$(readConfigKey "time.region" "${USER_CONFIG_FILE}")"
|
||||
TIMEZONE="$(readConfigKey "time.timezone" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${REGION}" ] || [ -z "${TIMEZONE}" ]; then
|
||||
REGION="$(curl -m 5 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f1)"
|
||||
TIMEZONE="$(curl -m 5 -v "http://ip-api.com/line?fields=timezone" 2>/dev/null | tr -d '\n' | cut -d '/' -f2)"
|
||||
[ -z "${KEYMAP}" ] && KEYMAP="$(curl -m 5 -v "http://ip-api.com/line?fields=countryCode" 2>/dev/null | tr '[:upper:]' '[:lower:]')"
|
||||
writeConfigKey "time.region" "${REGION}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "time.timezone" "${TIMEZONE}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
if [ -n "${REGION}" ] && [ -n "${TIMEZONE}" ]; then
|
||||
ln -sf "/usr/share/zoneinfo/${REGION}/${TIMEZONE}" /etc/localtime
|
||||
fi
|
||||
if [ -z "${LAYOUT}" ]; then
|
||||
[ -n "${KEYMAP}" ] && KEYMAP="$(echo ${KEYMAP} | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]' | tr -d '[:punct:]' | tr -d '[:digit:]')"
|
||||
@ -559,50 +518,20 @@ function ntpCheck() {
|
||||
[ -z "${KEYMAP}" ] && KEYMAP="us"
|
||||
loadkeys ${KEYMAP}
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Offline Check
|
||||
function offlineCheck() {
|
||||
CNT=0
|
||||
local ARCNIC=""
|
||||
local OFFLINE="${1}"
|
||||
if [ "${OFFLINE}" == "true" ]; then
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
elif [ "${OFFLINE}" == "false" ]; then
|
||||
while true; do
|
||||
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
CNT=$((${CNT} + 1))
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
ARCNIC="auto"
|
||||
break
|
||||
elif [ ${CNT} -ge 3 ]; then
|
||||
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
|
||||
for ETH in ${ETHX}; do
|
||||
# Update Check
|
||||
NEWTAG="$(curl --interface ${ETH} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
ARCNIC="${ETH}"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "${ARCNIC}" ]; then
|
||||
OFFLINE="false"
|
||||
elif [ -z "${ARCNIC}" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Online Check" \
|
||||
--infobox "Could not connect to Github.\nSwitch to Offline Mode!" 0 0
|
||||
sleep 5
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
fi
|
||||
if [ "${KEYMAP}" == "ua" ] || [ "${REGION}" == "Kyiv" ]; then
|
||||
poweroff
|
||||
fi
|
||||
[ "${OFFLINE}" == "true" ] && cp -f "${PART3_PATH}/offline/offline.json" "${ARC_PATH}/include/offline.json"
|
||||
writeConfigKey "arc.nic" "${ARCNIC}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.offline" "${OFFLINE}" "${USER_CONFIG_FILE}"
|
||||
while true; do
|
||||
NEWTAG="$(curl -m 5 -skL "https://api.github.com/repos/AuxXxilium/arc-system/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
CNT=$((${CNT} + 1))
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
writeConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
elif [ ${CNT} -ge 3 ]; then
|
||||
writeConfigKey "arc.offline" "true" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -634,46 +563,9 @@ function systemCheck () {
|
||||
fi
|
||||
# Check for CPU Frequency Scaling
|
||||
CPUFREQUENCIES=$(ls -ltr /sys/devices/system/cpu/cpufreq/* 2>/dev/null | wc -l)
|
||||
if [ ${CPUFREQUENCIES} -gt 0 ] && [ "${ACPISYS}" == "true" ]; then
|
||||
if [ ${CPUFREQUENCIES} -gt 1 ] && [ "${ACPISYS}" == "true" ]; then
|
||||
CPUFREQ="true"
|
||||
else
|
||||
CPUFREQ="false"
|
||||
fi
|
||||
# Check for ARCKEY
|
||||
ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${MODEL}" ]; then
|
||||
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)"
|
||||
fi
|
||||
if [ -z "${ARCCONF}" ] && [ -n "${ARCKEY}" ]; then
|
||||
if openssl enc -in "${S_FILE_ENC}" -out "${S_FILE_ARC}" -d -aes-256-cbc -k "${ARCKEY}" 2>/dev/null; then
|
||||
cp -f "${S_FILE_ARC}" "${S_FILE}"
|
||||
writeConfigKey "arc.key" "${ARCKEY}" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
[ -f "${S_FILE}.bak" ] && cp -f "${S_FILE}" "${S_FILE}.bak"
|
||||
writeConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Check Dynamic Mode
|
||||
function dynCheck () {
|
||||
ARCDYN="$(readConfigKey "arc.dynamic" "${USER_CONFIG_FILE}")"
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCDYN}" == "true" ] && [ "${OFFLINE}" == "false" ] && [ ! -f "${TMP_PATH}/dynamic" ]; then
|
||||
curl -skL "https://github.com/AuxXxilium/arc/archive/refs/heads/dev.zip" -o "${TMP_PATH}/dev.zip"
|
||||
unzip -qq -o "${TMP_PATH}/dev.zip" -d "${TMP_PATH}" 2>/dev/null
|
||||
cp -rf "${TMP_PATH}/arc-dev/files/initrd/opt/arc/"* "${ARC_PATH}"
|
||||
rm -rf "${TMP_PATH}/arc-dev"
|
||||
rm -f "${TMP_PATH}/dev.zip"
|
||||
VERSION="Dynamic-Dev"
|
||||
sed 's/^ARC_VERSION=.*/ARC_VERSION="'${VERSION}'"/' -i ${ARC_PATH}/include/consts.sh
|
||||
echo "true" >"${TMP_PATH}/dynamic"
|
||||
clear
|
||||
exec init.sh
|
||||
elif [ "${ARCDYN}" == "false" ] || [ "${OFFLINE}" == "true" ]; then
|
||||
[ -f "${TMP_PATH}/dynamic" ] && rm -f "${TMP_PATH}/dynamic" >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
@ -7,10 +7,10 @@
|
||||
# eg: N i915.ko
|
||||
|
||||
# kvm
|
||||
F irqbypass.ko
|
||||
F kvm-intel.ko
|
||||
F kvm-amd.ko
|
||||
F kvm.ko
|
||||
N irqbypass.ko
|
||||
N kvm-intel.ko
|
||||
N kvm-amd.ko
|
||||
N kvm.ko
|
||||
|
||||
# acpi
|
||||
N acpi_call.ko
|
||||
@ -29,10 +29,18 @@ N nct6683.ko
|
||||
N nct6775.ko
|
||||
|
||||
# rndis
|
||||
F mii.ko
|
||||
F cdc_ether.ko
|
||||
F rndis_host.ko
|
||||
F r8152.ko
|
||||
N mii.ko
|
||||
N cdc_ether.ko
|
||||
N rndis_host.ko
|
||||
N r8152.ko
|
||||
|
||||
# iwlwifi
|
||||
N libarc4.ko
|
||||
N cfg80211.ko
|
||||
N mac80211.ko
|
||||
N iwlwifi.ko
|
||||
N iwlmvm.ko
|
||||
N iwldvm.ko
|
||||
|
||||
## i915
|
||||
#N dmabuf.ko
|
||||
|
@ -6,14 +6,16 @@ function getnet() {
|
||||
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
if [ "${ARCPATCH}" == "true" ]; then
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true" | tr '[:lower:]' '[:upper:]'))
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true" | tr '[:upper:]' '[:lower:]'))
|
||||
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
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false" | tr '[:lower:]' '[:upper:]'))
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false" | tr '[:upper:]' '[:lower:]'))
|
||||
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
|
||||
@ -27,8 +29,8 @@ function getnet() {
|
||||
[ $? -ne 0 ] && break
|
||||
MAC=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${MAC}" ] && MAC="$(readConfigKey "${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
MAC="$(echo "${MAC}" | sed "s/:\|-\| //g" | tr '[:lower:]' '[:upper:]')"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g')"
|
||||
MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')"
|
||||
if [ ${#MAC} -eq 12 ]; then
|
||||
writeConfigKey "${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
|
@ -1,115 +1,15 @@
|
||||
###############################################################################
|
||||
# Upgrade Loader
|
||||
function upgradeLoader () {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
rm -f "${TMP_PATH}/check.update"
|
||||
rm -f "${TMP_PATH}/arc.img.zip"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
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)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
curl -skL "https://github.com/AuxXxilium/arc/releases/download/${TAG}/check.update" -o "${TMP_PATH}/check.update"
|
||||
if [ -f "${TMP_PATH}/check.update" ]; then
|
||||
local UPDATE=$(cat "${TMP_PATH}/check.update" | sed -e 's/\.//g' )
|
||||
local ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION" | sed -e 's/\.//g' )
|
||||
if [ ${ARC_VERSION} -lt ${UPDATE} ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--yesno "Current Config not compatible to new Version!\nDo not restore Config!\nDo you want to upgrade?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f "${TMP_PATH}/check.update"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
updateFaileddialog
|
||||
fi
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCBRANCH}" != "stable" ]; then
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}-${ARCBRANCH}.img.zip"
|
||||
else
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}.img.zip"
|
||||
fi
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/arc.img.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/arc.img.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
fi
|
||||
if [ -f "${TMP_PATH}/arc.img.zip" ]; then
|
||||
echo "Downloading Upgradefile successful!"
|
||||
else
|
||||
updateFailed
|
||||
fi
|
||||
unzip -oq "${TMP_PATH}/arc.img.zip" -d "${TMP_PATH}"
|
||||
rm -f "${TMP_PATH}/arc.img.zip" >/dev/null
|
||||
echo "Installing new Loader Image..."
|
||||
# Process complete update
|
||||
umount "${PART1_PATH}" "${PART2_PATH}" "${PART3_PATH}"
|
||||
if [ "${ARCBRANCH}" != "stable" ]; then
|
||||
if dd if="${TMP_PATH}/arc-${ARCBRANCH}.img" of=$(blkid | grep 'LABEL="ARC3"' | cut -d3 -f1) bs=1M conv=fsync; then
|
||||
rm -f "${TMP_PATH}/arc-${ARCBRANCH}.img" >/dev/null
|
||||
else
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
if dd if="${TMP_PATH}/arc.img" of=$(blkid | grep 'LABEL="ARC3"' | cut -d3 -f1) bs=1M conv=fsync; then
|
||||
rm -f "${TMP_PATH}/arc.img" >/dev/null
|
||||
else
|
||||
updateFailed
|
||||
fi
|
||||
fi
|
||||
echo "Upgrade done! -> Rebooting..."
|
||||
deleteConfigKey "arc.confhash" "${USER_CONFIG_FILE}"
|
||||
sleep 2
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--progressbox "Upgrading Loader..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Update Loader
|
||||
function updateLoader() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
local ARCBRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
rm -f "${TMP_PATH}/check.update"
|
||||
rm -f "${TMP_PATH}/checksum.sha256"
|
||||
rm -f "${TMP_PATH}/update.zip"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
local ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
local TAG="${1}"
|
||||
if [ -z "${TAG}" ]; then
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
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)"
|
||||
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 --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
|
||||
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)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
@ -117,105 +17,29 @@ function updateLoader() {
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
curl -skL "https://github.com/AuxXxilium/arc/releases/download/${TAG}/check.update" -o "${TMP_PATH}/check.update"
|
||||
if [ -f "${TMP_PATH}/check.update" ]; then
|
||||
local UPDATE_VERSION=$(cat "${TMP_PATH}/check.update" | sed -e 's/\.//g' )
|
||||
local ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION" | sed -e 's/\.//g' )
|
||||
if [ ${ARC_VERSION} -lt ${UPDATE_VERSION} ] && [ "${ARCMODE}" == "config" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--yesno "Config is not compatible to new Version!\nPlease reconfigure Loader after Update!\nDo you want to update?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f "${TMP_PATH}/check.update"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
elif [ ${ARC_VERSION} -lt ${UPDATE_VERSION} ] && [ "${ARCMODE}" == "automated" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Full-Update Loader" \
|
||||
--infobox "Config is not compatible to new Version!\nUpdate not possible!\nPlease reflash Loader." 0 0
|
||||
sleep 5
|
||||
updateFaileddialog
|
||||
fi
|
||||
else
|
||||
updateFaileddialog
|
||||
fi
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCBRANCH}" != "stable" ]; then
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${ARCBRANCH}.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc/releases/download/${TAG}/checksum-${ARCBRANCH}.sha256"
|
||||
else
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc/releases/download/${TAG}/checksum.sha256"
|
||||
fi
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/update.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/update.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
fi
|
||||
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/update.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/update.zip" ]; then
|
||||
echo "Download successful!"
|
||||
if [ "$(sha256sum "${TMP_PATH}/update.zip" | awk '{print $1}')" == "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
echo "Backup Arc Config File..."
|
||||
cp -f "${S_FILE}" "/tmp/serials.yml"
|
||||
echo "Cleaning up..."
|
||||
rm -rf "${ADDONS_PATH}"
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
rm -rf "${MODULES_PATH}"
|
||||
mkdir -p "${MODULES_PATH}"
|
||||
echo "Installing new Loader Image..."
|
||||
unzip -oq "${TMP_PATH}/update.zip" -d "${PART3_PATH}"
|
||||
mv -f "${PART3_PATH}/grub.cfg" "${USER_GRUB_CONFIG}"
|
||||
mv -f "${PART3_PATH}/ARC-VERSION" "${PART1_PATH}/ARC-VERSION"
|
||||
mv -f "${PART3_PATH}/ARC-BRANCH" "${PART1_PATH}/ARC-BRANCH"
|
||||
rm -f "${TMP_PATH}/update.zip"
|
||||
# Rebuild modules if model/build is selected
|
||||
local PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${PRODUCTVER}" ]; then
|
||||
local PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
|
||||
local KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
|
||||
# Modify KVER for Epyc7002
|
||||
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
|
||||
fi
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVERP}")
|
||||
fi
|
||||
echo "Restore Arc Config File..."
|
||||
cp -f "/tmp/serials.yml" "${S_FILE}"
|
||||
CONFHASHFILE="$(sha256sum "${S_FILE}" | awk '{print $1}')"
|
||||
writeConfigKey "arc.confhash" "${CONFHASHFILE}" "${USER_CONFIG_FILE}"
|
||||
echo "Update done!"
|
||||
echo -e "Downloading ${TAG}-${ARC_BRANCH} Loader successful!\nUpdating ${ARC_BRANCH} Loader..."
|
||||
if unzip -oq "${TMP_PATH}/update.zip" -d "/mnt"; then
|
||||
echo "Successful!"
|
||||
sleep 2
|
||||
else
|
||||
echo "Checksum mismatch!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
echo "Error downloading new Version!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Full-Update Loader" \
|
||||
--progressbox "Updating Loader..." 20 70
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "System" \
|
||||
--progressbox "Update ${ARC_BRANCH} Loader..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -223,68 +47,40 @@ function updateLoader() {
|
||||
###############################################################################
|
||||
# Update Addons
|
||||
function updateAddons() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-addons/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-addons/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
[ -f "${ADDONS_PATH}/VERSION" ] && local ADDONSVERSION="$(cat "${ADDONS_PATH}/VERSION")" || ADDONSVERSION="0.0.0"
|
||||
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-addons/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
if [ -n "${TAG}" ] && [ "${ADDONSVERSION}" != "${TAG}" ]; then
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
local URL="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/checksum.sha256"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/addons.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/addons.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
fi
|
||||
local URL="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip"
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/addons.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/addons.zip" ]; then
|
||||
echo "Download successful!"
|
||||
if [ "$(sha256sum "${TMP_PATH}/addons.zip" | awk '{print $1}')" == "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
rm -rf "${ADDONS_PATH}"
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
echo "Installing new Addons..."
|
||||
unzip -oq "${TMP_PATH}/addons.zip" -d "${ADDONS_PATH}"
|
||||
rm -rf "${ADDONS_PATH}"
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
echo "Installing new Addons..."
|
||||
if unzip -oq "${TMP_PATH}/addons.zip" -d "${ADDONS_PATH}"; then
|
||||
rm -f "${TMP_PATH}/addons.zip"
|
||||
for F in $(ls ${ADDONS_PATH}/*.addon 2>/dev/null); do
|
||||
ADDON=$(basename "${F}" | sed 's|.addon||')
|
||||
rm -rf "${ADDONS_PATH}/${ADDON}"
|
||||
mkdir -p "${ADDONS_PATH}/${ADDON}"
|
||||
echo "Installing ${F} to ${ADDONS_PATH}/${ADDON}"
|
||||
tar -xaf "${F}" -C "${ADDONS_PATH}/${ADDON}"
|
||||
rm -f "${F}"
|
||||
done
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
echo "Successful!"
|
||||
else
|
||||
echo "Checksum mismatch!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
@ -292,8 +88,8 @@ function updateAddons() {
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Addons" \
|
||||
--progressbox "Updating Addons..." 20 70
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Addons" \
|
||||
--progressbox "Update Addons..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -301,60 +97,33 @@ function updateAddons() {
|
||||
###############################################################################
|
||||
# Update Patches
|
||||
function updatePatches() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-patches/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-patches/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
[ -f "${PATCH_PATH}/VERSION" ] && local PATCHESVERSION="$(cat "${PATCH_PATH}/VERSION")" || PATCHESVERSION="0.0.0"
|
||||
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-patches/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
if [ -n "${TAG}" ] && [ "${PATCHESVERSION}" != "${TAG}" ]; then
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/checksum.sha256"
|
||||
local URL="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/patches.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/patches.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
fi
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/patches.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/patches.zip" ]; then
|
||||
echo "Download successful!"
|
||||
if [ "$(sha256sum "${TMP_PATH}/patches.zip" | awk '{print $1}')" == "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
rm -rf "${PATCH_PATH}"
|
||||
mkdir -p "${PATCH_PATH}"
|
||||
echo "Installing new Patches..."
|
||||
unzip -oq "${TMP_PATH}/patches.zip" -d "${PATCH_PATH}"
|
||||
rm -rf "${PATCH_PATH}"
|
||||
mkdir -p "${PATCH_PATH}"
|
||||
echo "Installing new Patches..."
|
||||
if unzip -oq "${TMP_PATH}/patches.zip" -d "${PATCH_PATH}"; then
|
||||
rm -f "${TMP_PATH}/patches.zip"
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
echo "Successful!"
|
||||
else
|
||||
echo "Checksum mismatch!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
@ -362,8 +131,8 @@ function updatePatches() {
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Patches" \
|
||||
--progressbox "Updating Patches..." 20 70
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Patches" \
|
||||
--progressbox "Update Patches..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -371,60 +140,33 @@ function updatePatches() {
|
||||
###############################################################################
|
||||
# Update Custom
|
||||
function updateCustom() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
[ -f "${CUSTOM_PATH}/VERSION" ] && local CUSTOMVERSION="$(cat "${CUSTOM_PATH}/VERSION")" || CUSTOMVERSION="0.0.0"
|
||||
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-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
if [ -n "${TAG}" ] && [ "${CUSTOMVERSION}" != "${TAG}" ]; then
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/checksum.sha256"
|
||||
local URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/custom.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/custom.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
fi
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/custom.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/custom.zip" ]; then
|
||||
echo "Download successful!"
|
||||
if [ "$(sha256sum "${TMP_PATH}/custom.zip" | awk '{print $1}')" == "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
rm -rf "${CUSTOM_PATH}"
|
||||
mkdir -p "${CUSTOM_PATH}"
|
||||
echo "Installing new Custom Kernel..."
|
||||
unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"
|
||||
rm -rf "${CUSTOM_PATH}"
|
||||
mkdir -p "${CUSTOM_PATH}"
|
||||
echo "Installing new Custom Kernel..."
|
||||
if unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"; then
|
||||
rm -f "${TMP_PATH}/custom.zip"
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
echo "Successful!"
|
||||
else
|
||||
echo "Checksum mismatch!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
@ -432,8 +174,8 @@ function updateCustom() {
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Custom" \
|
||||
--progressbox "Updating Custom..." 20 70
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Custom" \
|
||||
--progressbox "Update Custom..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -441,75 +183,37 @@ function updateCustom() {
|
||||
###############################################################################
|
||||
# Update Modules
|
||||
function updateModules() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
[ -f "${MODULES_PATH}/VERSION" ] && local MODULESVERSION="$(cat "${MODULES_PATH}/VERSION")" || MODULESVERSION="0.0.0"
|
||||
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}"
|
||||
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)"
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
idx=$((${idx} + 1))
|
||||
done
|
||||
if [ -n "${TAG}" ] && [[ "${MODULESVERSION}" != "${TAG}" || ! -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ]]; then
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules.zip"
|
||||
local SHA="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/checksum.sha256"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/modules.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/modules.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
curl --interface ${ARCNIC} -skL "${SHA}" -o "${TMP_PATH}/checksum.sha256"
|
||||
fi
|
||||
rm -rf "${MODULES_PATH}"
|
||||
mkdir -p "${MODULES_PATH}"
|
||||
local URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip"
|
||||
echo "Downloading Modules ${TAG}"
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/modules.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/modules.zip" ]; then
|
||||
echo "Download successful!"
|
||||
if [ "$(sha256sum "${TMP_PATH}/modules.zip" | awk '{print $1}')" == "$(cat ${TMP_PATH}/checksum.sha256 | awk '{print $1}')" ]; then
|
||||
echo "Download successful!"
|
||||
rm -rf "${MODULES_PATH}"
|
||||
mkdir -p "${MODULES_PATH}"
|
||||
echo "Installing new Modules..."
|
||||
unzip -oq "${TMP_PATH}/modules.zip" -d "${MODULES_PATH}"
|
||||
echo "Installing new Modules..."
|
||||
if unzip -oq "${TMP_PATH}/modules.zip" -d "${MODULES_PATH}"; then
|
||||
rm -f "${TMP_PATH}/modules.zip"
|
||||
# Rebuild modules if model/build is selected
|
||||
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${PRODUCTVER}" ]; then
|
||||
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}"
|
||||
fi
|
||||
if [ -n "${PLATFORM}" ] && [ -n "${KVERP}" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
echo "Rebuilding Modules..."
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVERP}")
|
||||
fi
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
echo "Successful!"
|
||||
else
|
||||
echo "Checksum mismatch!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
@ -517,8 +221,16 @@ function updateModules() {
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
||||
--progressbox "Updating Modules..." 20 70
|
||||
if [ -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ] && [ -f "${MODULES_PATH}/firmware.tgz" ]; then
|
||||
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
|
||||
echo "Rebuilding Modules..."
|
||||
while read -r ID DESC; do
|
||||
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
|
||||
done < <(getAllModules "${PLATFORM}" "${KVERP}")
|
||||
echo "Successful!"
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Modules" \
|
||||
--progressbox "Update Modules..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -526,17 +238,12 @@ function updateModules() {
|
||||
###############################################################################
|
||||
# Update Configs
|
||||
function updateConfigs() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local ARCKEY="$(readConfigKey "arc.key" "${USER_CONFIG_FILE}")"
|
||||
[ -f "${MODEL_CONFIGS_PATH}/VERSION" ] && local CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION")" || CONFIGSVERSION="0.0.0"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-configs/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-configs/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
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
|
||||
break
|
||||
fi
|
||||
@ -546,43 +253,31 @@ function updateConfigs() {
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
if [ -n "${TAG}" ] && [ "${CONFIGSVERSION}" != "${TAG}" ]; then
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs.zip"
|
||||
local URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/configs.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/configs.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
fi
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/configs.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/configs.zip" ]; then
|
||||
echo "Download successful!"
|
||||
mkdir -p "${MODEL_CONFIG_PATH}"
|
||||
echo "Installing new Configs..."
|
||||
[ -n "${ARCKEY}" ] && cp -f "${S_FILE}" "${TMP_PATH}/serials.yml"
|
||||
unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"
|
||||
rm -f "${TMP_PATH}/configs.zip"
|
||||
[ -n "${ARCKEY}" ] && cp -f "${TMP_PATH}/serials.yml" "${S_FILE}"
|
||||
CONFHASHFILE="$(sha256sum "${S_FILE}" | awk '{print $1}')"
|
||||
writeConfigKey "arc.confhash" "${CONFHASHFILE}" "${USER_CONFIG_FILE}"
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
if unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"; then
|
||||
rm -f "${TMP_PATH}/configs.zip"
|
||||
echo "Successful!"
|
||||
else
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
echo "Error downloading new Version!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update Configs" \
|
||||
--progressbox "Updating Configs..." 20 70
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Configs" \
|
||||
--progressbox "Installing Configs..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -590,16 +285,11 @@ function updateConfigs() {
|
||||
###############################################################################
|
||||
# Update LKMs
|
||||
function updateLKMs() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
[ -f "${LKMS_PATH}/VERSION" ] && local LKMVERSION="$(cat "${LKMS_PATH}/VERSION")" || LKMVERSION="0.0.0"
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
idx=0
|
||||
while [ ${idx} -le 5 ]; do # Loop 5 times, if successful, break
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-lkm/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
else
|
||||
local TAG="$(curl --interface ${ARCNIC} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-lkm/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
fi
|
||||
local TAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc-lkm/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${TAG}" ]; then
|
||||
break
|
||||
fi
|
||||
@ -609,40 +299,89 @@ function updateLKMs() {
|
||||
else
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
if [ -n "${TAG}" ] && [ "${LKMVERSION}" != "${TAG}" ]; then
|
||||
(
|
||||
# Download update file
|
||||
local URL="https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip"
|
||||
echo "Downloading ${TAG}"
|
||||
if [ "${ARCNIC}" == "auto" ]; then
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/rp-lkms.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
else
|
||||
curl --interface ${ARCNIC} -#kL "${URL}" -o "${TMP_PATH}/rp-lkms.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
fi
|
||||
curl -#kL "${URL}" -o "${TMP_PATH}/rp-lkms.zip" 2>&1 | while IFS= read -r -n1 char; do
|
||||
[[ $char =~ [0-9] ]] && keep=1 ;
|
||||
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
|
||||
[[ $keep == 1 ]] && progress="$progress$char" ;
|
||||
done
|
||||
if [ -f "${TMP_PATH}/rp-lkms.zip" ]; then
|
||||
echo "Download successful!"
|
||||
rm -rf "${LKMS_PATH}"
|
||||
mkdir -p "${LKMS_PATH}"
|
||||
echo "Installing new LKMs..."
|
||||
unzip -oq "${TMP_PATH}/rp-lkms.zip" -d "${LKMS_PATH}"
|
||||
rm -f "${TMP_PATH}/rp-lkms.zip"
|
||||
echo "Update done!"
|
||||
sleep 2
|
||||
if unzip -oq "${TMP_PATH}/rp-lkms.zip" -d "${LKMS_PATH}"; then
|
||||
rm -f "${TMP_PATH}/rp-lkms.zip"
|
||||
echo "Successful!"
|
||||
else
|
||||
updateFailed
|
||||
fi
|
||||
else
|
||||
echo "Error downloading new Version!"
|
||||
sleep 5
|
||||
updateFailed
|
||||
fi
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update LKMs" \
|
||||
--progressbox "Updating LKMs..." 20 70
|
||||
) 2>&1 | dialog --backtitle "$(backtitle)" --title "LKMs" \
|
||||
--progressbox "Installing LKMs..." 20 70
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Loading Update Mode
|
||||
function arcUpdate() {
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
FAILED="false"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Updating Dependencies..." 0 0
|
||||
sleep 3
|
||||
updateAddons
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateModules
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateLKMs
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updatePatches
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
if [ "${KERNEL}" == "custom" ]; then
|
||||
updateCustom
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
fi
|
||||
if [ "${FAILED}" == "true" ] && [ "${UPDATEMODE}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update failed!\nTry again later." 0 0
|
||||
sleep 3
|
||||
exec reboot
|
||||
elif [ "${FAILED}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update failed!\nTry again later." 0 0
|
||||
sleep 3
|
||||
elif [ "${FAILED}" == "false" ] && [ "${UPDATEMODE}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update successful! -> Reboot to automated build..." 0 0
|
||||
sleep 3
|
||||
rebootTo "automated"
|
||||
elif [ "${FAILED}" == "false" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update successful!" 0 0
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
sleep 3
|
||||
clear
|
||||
exec arc.sh
|
||||
fi
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Update Offline
|
||||
function updateOffline() {
|
||||
local ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" != "automated" ]; then
|
||||
rm -f "${SYSTEM_PATH}/include/offline.json"
|
||||
curl -skL "https://autoupdate.synology.com/os/v2" -o "${SYSTEM_PATH}/include/offline.json"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -652,12 +391,12 @@ function updateLKMs() {
|
||||
function updateFailed() {
|
||||
local MODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" == "automated" ]; then
|
||||
echo "Update failed!"
|
||||
echo "Installation failed!"
|
||||
sleep 5
|
||||
exec reboot
|
||||
exit 1
|
||||
else
|
||||
echo "Update failed!"
|
||||
echo "Installation failed!"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@ -666,13 +405,13 @@ function updateFaileddialog() {
|
||||
local MODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${ARCMODE}" == "automated" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Failed" \
|
||||
--infobox "Update failed!" 0 0
|
||||
--infobox "Installation failed!" 0 0
|
||||
sleep 5
|
||||
exec reboot
|
||||
exit 1
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Update Failed" \
|
||||
--msgbox "Update failed!" 0 0
|
||||
--msgbox "Installation failed!" 0 0
|
||||
return 1
|
||||
fi
|
||||
}
|
@ -4,25 +4,13 @@ set -e
|
||||
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
||||
|
||||
. ${ARC_PATH}/include/functions.sh
|
||||
. ${ARC_PATH}/include/addons.sh
|
||||
. ${ARC_PATH}/include/compat.sh
|
||||
. ${ARC_PATH}/include/update.sh
|
||||
|
||||
# Get Loader Disk Bus
|
||||
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
|
||||
checkBootLoader || die "The loader is corrupted, please rewrite it!"
|
||||
BUS=$(getBus "${LOADER_DISK}")
|
||||
|
||||
# Sanity Check
|
||||
CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION" | sed -e 's/\.//g' | sed 's/[^0-9]*//g')"
|
||||
LOADERVERSION="$(echo "${ARC_VERSION}" | sed -e 's/\.//g' | sed 's/[^0-9]*//g')"
|
||||
CONFHASHFILE="$(sha256sum "${S_FILE}" | awk '{print $1}')"
|
||||
CONFHASH="$(readConfigKey "arc.confhash" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${CONFHASH}" ] && CONFHASH="${CONFHASHFILE}"
|
||||
if [ ${CONFIGSVERSION} -lt ${LOADERVERSION} ] || [ "${CONFHASH}" != "${CONFHASHFILE}" ]; then
|
||||
echo -e "Pirated Version of Arc Loader detected!!! Files can't be verified."
|
||||
sleep 3
|
||||
exec poweroff
|
||||
fi
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||
|
||||
# Check if machine has EFI
|
||||
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
|
||||
@ -32,7 +20,8 @@ clear
|
||||
COLUMNS=${COLUMNS:-50}
|
||||
BANNER="$(figlet -c -w "$(((${COLUMNS})))" "Arc Loader")"
|
||||
TITLE="Version:"
|
||||
TITLE+=" ${ARC_TITLE}"
|
||||
TITLE+=" ${ARC_VERSION}"
|
||||
[ -n "${ARC_BRANCH}" ] && TITLE+=" | Branch: ${ARC_BRANCH}"
|
||||
printf "\033[1;30m%*s\n" ${COLUMNS} ""
|
||||
printf "\033[1;30m%*s\033[A\n" ${COLUMNS} ""
|
||||
printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
|
||||
@ -46,21 +35,16 @@ printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
|
||||
if [ ! -f "${USER_CONFIG_FILE}" ]; then
|
||||
touch "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Config Init
|
||||
initConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.branch" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.confhash" "${CONFHASHFILE}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.dynamic" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.ipv6" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.key" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.nic" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.offline" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "bootipwait" "30" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "directboot" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "dsmlogo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
|
||||
@ -73,8 +57,6 @@ initConfigKey "pathash" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "paturl" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "sn" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "device.externalcontroller" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "keymap" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "layout" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "lkm" "prod" "${USER_CONFIG_FILE}"
|
||||
@ -104,22 +86,17 @@ else
|
||||
writeConfigKey "arc.mode" "dsm" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
|
||||
if [ -f "${PART1_PATH}/ARC-BRANCH" ]; then
|
||||
ARCBRANCH=$(cat "${PART1_PATH}/ARC-BRANCH") && writeConfigKey "arc.branch" "${ARCBRANCH}" "${USER_CONFIG_FILE}"
|
||||
rm -f "${PART1_PATH}/ARC-BRANCH" >/dev/null 2>&1 || true
|
||||
if [ -n "${ARC_BRANCH}" ]; then
|
||||
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
# Check for compatibility
|
||||
compatboot
|
||||
|
||||
# Init Network
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||
# Sort network interfaces
|
||||
if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}"); then
|
||||
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
|
||||
fi
|
||||
[ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true
|
||||
# Read/Write IP/Mac config
|
||||
# Read/Write IP/Mac to config
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||
for ETH in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
@ -159,37 +136,28 @@ fi
|
||||
# Inform user and check bus
|
||||
echo -e "Loader Disk: \033[1;34m${LOADER_DISK}\033[0m"
|
||||
echo -e "Loader Disk Type: \033[1;34m${BUS}\033[0m"
|
||||
echo
|
||||
|
||||
# Save variables to user config file
|
||||
writeConfigKey "vid" ${VID} "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "pid" ${PID} "${USER_CONFIG_FILE}"
|
||||
|
||||
# Load keymap name
|
||||
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
|
||||
# Loads a keymap if is valid
|
||||
if [ -n "${LAYOUT}" ] && [ -n "${KEYMAP}" ]; then
|
||||
if [ -f "/usr/share/keymaps/i386/${LAYOUT}/${KEYMAP}.map.gz" ]; then
|
||||
echo -e "Loading User Keymap: \033[1;34m${LAYOUT}/${KEYMAP}\033[0m"
|
||||
zcat "/usr/share/keymaps/i386/${LAYOUT}/${KEYMAP}.map.gz" | loadkeys
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
writeConfigKey "vid" "${VID}" "${USER_CONFIG_FILE}"
|
||||
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"
|
||||
boot.sh
|
||||
exit 0
|
||||
if [ -f "${ARC_PATH}/boot.sh" ]; then
|
||||
exec boot.sh
|
||||
else
|
||||
echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m"
|
||||
fi
|
||||
else
|
||||
echo -e "\033[1;34mStarting Config Mode...\033[0m"
|
||||
fi
|
||||
@ -197,14 +165,16 @@ echo
|
||||
|
||||
BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=30
|
||||
echo -e "\033[1;34mDetected ${ETHN} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
|
||||
echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m"
|
||||
IPCON=""
|
||||
echo
|
||||
sleep 3
|
||||
for ETH in ${ETHX}; do
|
||||
COUNT=0
|
||||
DRIVER=$(ls -ld /sys/class/net/${ETH}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
|
||||
while true; do
|
||||
if ethtool ${ETH} 2>/dev/null | grep 'Link detected' | grep -q 'no'; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m NOT CONNECTED"
|
||||
echo -e "\r${DRIVER}: \033[1;37mNOT CONNECTED\033[0m"
|
||||
break
|
||||
fi
|
||||
COUNT=$((${COUNT} + 1))
|
||||
@ -212,33 +182,24 @@ for ETH in ${ETHX}; do
|
||||
if [ -n "${IP}" ]; then
|
||||
SPEED=$(ethtool ${ETH} 2>/dev/null | grep "Speed:" | awk '{print $2}')
|
||||
if [[ "${IP}" =~ ^169\.254\..* ]]; then
|
||||
echo -e "\r\033[1;37m${DRIVER} (${SPEED}):\033[0m LINK LOCAL (No DHCP server found.)"
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37mLINK LOCAL (No DHCP server found.)\033[0m"
|
||||
else
|
||||
echo -e "\r\033[1;37m${DRIVER} (${SPEED}):\033[0m Access \033[1;34mhttp://${IP}:7681\033[0m to connect to Arc via web interface."
|
||||
echo -e "\r${DRIVER} (${SPEED}): \033[1;37m${IP}\033[0m"
|
||||
[ -z "${IPCON}" ] && IPCON="${IP}" && ONNIC="${ETH}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if ! ip link show ${ETH} 2>/dev/null | grep -q 'UP'; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m DOWN"
|
||||
echo -e "\r${DRIVER}: \033[1;37mDOWN\033[0m"
|
||||
break
|
||||
fi
|
||||
if [ ${COUNT} -ge ${BOOTIPWAIT} ]; then
|
||||
echo -e "\r\033[1;37m${DRIVER}:\033[0m TIMEOUT"
|
||||
echo -e "\r${DRIVER}: \033[1;37mTIMEOUT\033[0m"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
||||
# NTP
|
||||
/etc/init.d/S49ntpd restart > /dev/null 2>&1
|
||||
|
||||
# Inform user
|
||||
echo
|
||||
echo -e "Call \033[1;34marc.sh\033[0m to configure Arc"
|
||||
echo
|
||||
echo -e "User config is on \033[1;34m${USER_CONFIG_FILE}\033[0m"
|
||||
echo -e "Default SSH Root password is \033[1;34marc\033[0m"
|
||||
echo
|
||||
|
||||
mkdir -p "${ADDONS_PATH}"
|
||||
@ -247,16 +208,18 @@ mkdir -p "${LKMS_PATH}"
|
||||
mkdir -p "${MODEL_CONFIG_PATH}"
|
||||
mkdir -p "${MODULES_PATH}"
|
||||
mkdir -p "${PATCH_PATH}"
|
||||
mkdir -p "${SYSTEM_PATH}"
|
||||
mkdir -p "${USER_UP_PATH}"
|
||||
|
||||
# Load Arc Overlay
|
||||
echo -e "\033[1;34mLoading Arc Overlay...\033[0m"
|
||||
echo
|
||||
echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:7681\033[0m to configure Loader."
|
||||
|
||||
# Check memory and load Arc
|
||||
RAM=$(free -m | grep -i mem | awk '{print$2}')
|
||||
if [ ${RAM} -le 3500 ]; then
|
||||
echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n"
|
||||
echo -e "\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m"
|
||||
echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m"
|
||||
else
|
||||
arc.sh
|
||||
fi
|
||||
|
@ -180,7 +180,7 @@ done
|
||||
# User Addons
|
||||
for ADDON in ${!ADDONS[@]}; do
|
||||
PARAMS=${ADDONS[${ADDON}]}
|
||||
installAddon "${ADDON}" "${PLATFORM}" || exit 1
|
||||
installAddon "${ADDON}" "${PLATFORM}" || echo "Addon ${ADDON} not found"
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user