arc/boot/init: remove bootcount

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2024-02-15 21:02:22 +01:00
parent 7b972ed9d9
commit 5154dbd75c
3 changed files with 2 additions and 42 deletions

View File

@@ -47,7 +47,6 @@ fi
# Get Arc Data from Config
DIRECTBOOT="$(readConfigKey "arc.directboot" "${USER_CONFIG_FILE}")"
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
@@ -569,10 +568,6 @@ function make() {
cp -f "${UNTAR_PAT_PATH}/rd.gz" "${ORI_RDGZ_FILE}"
rm -rf "${UNTAR_PAT_PATH}"
fi
# Reset Bootcount if User rebuild DSM
if [[ -z "${BOOTCOUNT}" || ${BOOTCOUNT} -gt 0 ]]; then
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
fi
(
livepatch
sleep 3
@@ -660,10 +655,6 @@ function offlinemake() {
cp -f "${UNTAR_PAT_PATH}/rd.gz" "${ORI_RDGZ_FILE}"
rm -rf "${UNTAR_PAT_PATH}"
fi
# Reset Bootcount if User rebuild DSM
if [[ -z "${BOOTCOUNT}" || ${BOOTCOUNT} -gt 0 ]]; then
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
fi
(
livepatch
sleep 3
@@ -2010,7 +2001,6 @@ function sysinfo() {
fi
fi
DIRECTBOOT="$(readConfigKey "arc.directboot" "${USER_CONFIG_FILE}")"
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "arc.usbmount" "${USER_CONFIG_FILE}")"
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
KERNELLOAD="$(readConfigKey "arc.kernelload" "${USER_CONFIG_FILE}")"
@@ -2085,7 +2075,6 @@ function sysinfo() {
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
TEXT+="\n MacSys | IPv6: \Zb${MACSYS} | ${ARCIPV6}\Zn"
TEXT+="\n Offline Mode: \Zb${OFFLINE}\Zn"
TEXT+="\n Bootcount: \Zb${BOOTCOUNT}\Zn"
TEXT+="\n\Z4>> Addons | Modules\Zn"
TEXT+="\n Addons selected: \Zb${ADDONSINFO}\Zn"
TEXT+="\n Modules loaded: \Zb${MODULESINFO}\Zn"
@@ -2230,7 +2219,6 @@ function fullsysinfo() {
fi
fi
DIRECTBOOT="$(readConfigKey "arc.directboot" "${USER_CONFIG_FILE}")"
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
USBMOUNT="$(readConfigKey "arc.usbmount" "${USER_CONFIG_FILE}")"
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
KERNELLOAD="$(readConfigKey "arc.kernelload" "${USER_CONFIG_FILE}")"
@@ -2309,7 +2297,6 @@ function fullsysinfo() {
TEXT+="\nConfig Version: ${CONFIGVER}"
TEXT+="\nMacSys | IPv6: ${MACSYS} | ${ARCIPV6}"
TEXT+="\nOffline Mode: ${OFFLINE}"
TEXT+="\nBootcount: ${BOOTCOUNT}"
TEXT+="\n"
TEXT+="\nAddons selected:"
TEXT+="\n${ADDONSINFO}"
@@ -2782,7 +2769,6 @@ function resetLoader() {
initConfigKey "arc.kernelload" "power" "${USER_CONFIG_FILE}"
initConfigKey "arc.kernelpanic" "5" "${USER_CONFIG_FILE}"
initConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
initConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
initConfigKey "arc.odp" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.hddsort" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
@@ -2836,7 +2822,6 @@ function juniorboot() {
make
fi
grub-editenv ${GRUB_PATH}/grubenv set next_entry="junior"
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM Recovery...\nPlease stay patient!" 4 30
sleep 2
@@ -2852,7 +2837,6 @@ function boot() {
if [ $? -eq 0 ]; then
make
fi
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM...\nPlease stay patient!" 4 25
sleep 2
@@ -2919,9 +2903,6 @@ while true; do
echo "i \"Boot IP Waittime: \Z4${BOOTIPWAIT}\Zn \" " >>"${TMP_PATH}/menu"
fi
echo "q \"Directboot: \Z4${DIRECTBOOT}\Zn \" " >>"${TMP_PATH}/menu"
if [ ${BOOTCOUNT} -gt 0 ]; then
echo "r \"Reset Bootcount: \Z4${BOOTCOUNT}\Zn \" " >>"${TMP_PATH}/menu"
fi
fi
if [ "${DSMOPTS}" = "true" ]; then
echo "7 \"\Z1Hide DSM Options\Zn \" " >>"${TMP_PATH}/menu"
@@ -3028,16 +3009,8 @@ while true; do
q) [ "${DIRECTBOOT}" = "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
grub-editenv "${GRUB_PATH}/grubenv" create
writeConfigKey "arc.directboot" "${DIRECTBOOT}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
NEXT="q"
;;
r)
grub-editenv "${GRUB_PATH}/grubenv" create
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
NEXT="r"
;;
# DSM Section
7) [ "${DSMOPTS}" = "true" ] && DSMOPTS='false' || DSMOPTS='true'
DSMOPTS="${DSMOPTS}"

View File

@@ -33,7 +33,6 @@ 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
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}" # Reset Bootcount
echo
fi
@@ -100,16 +99,12 @@ MAC2="$(readConfigKey "arc.mac2" "${USER_CONFIG_FILE}")"
KERNELLOAD="$(readConfigKey "arc.kernelload" "${USER_CONFIG_FILE}")"
KERNELPANIC="$(readConfigKey "arc.kernelpanic" "${USER_CONFIG_FILE}")"
DIRECTBOOT="$(readConfigKey "arc.directboot" "${USER_CONFIG_FILE}")"
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
[ -z "${BOOTCOUNT}" ] && BOOTCOUNT=0
declare -A CMDLINE
# Read and Set Cmdline
if grep -q "force_junior" /proc/cmdline; then
CMDLINE['force_junior']=""
writeConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
fi
[ ${EFI} -eq 1 ] && CMDLINE['withefi']="" || CMDLINE['noefi']=""
if [ ! "${BUS}" = "usb" ]; then
@@ -167,8 +162,6 @@ if [ "${DIRECTBOOT}" = "true" ]; then
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
grub-editenv ${GRUB_PATH}/grubenv set dsm_cmdline="${CMDLINE_DIRECT}"
grub-editenv ${GRUB_PATH}/grubenv set next_entry="direct"
BOOTCOUNT=$((${BOOTCOUNT} + 1))
writeConfigKey "arc.bootcount" "${BOOTCOUNT}" "${USER_CONFIG_FILE}"
echo -e " \033[1;34mReboot with Directboot\033[0m"
exec reboot
elif [ "${DIRECTBOOT}" = "false" ]; then
@@ -182,7 +175,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
COUNT=0
while true; do
if [[ "${STATICIP}" = "true" && "${N}" = "eth0" && -n "${ARCIP}" && ${BOOTCOUNT} -gt 0 ]]; then
if [[ "${STATICIP}" = "true" && "${N}" = "eth0" && -n "${ARCIP}" ]]; then
ARCIP="$(readConfigKey "arc.ip" "${USER_CONFIG_FILE}")"
NETMASK="$(readConfigKey "arc.netmask" "${USER_CONFIG_FILE}")"
IP="${ARCIP}"
@@ -231,9 +224,6 @@ elif [ "${DIRECTBOOT}" = "false" ]; then
echo -en "\r$(printf "%$((${#MSG} * 2))s" " ")\n"
echo -e " \033[1;37mLoading DSM kernel...\033[0m"
# Write new Bootcount
BOOTCOUNT=$((${BOOTCOUNT} + 1))
writeConfigKey "arc.bootcount" "${BOOTCOUNT}" "${USER_CONFIG_FILE}"
# Executes DSM kernel via KEXEC
kexec -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
echo -e " \033[1;37m"Booting DSM..."\033[0m"

View File

@@ -53,7 +53,6 @@ initConfigKey "arc.bootipwait" "20" "${USER_CONFIG_FILE}"
initConfigKey "arc.kernelload" "power" "${USER_CONFIG_FILE}"
initConfigKey "arc.kernelpanic" "5" "${USER_CONFIG_FILE}"
initConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
initConfigKey "arc.bootcount" "0" "${USER_CONFIG_FILE}"
initConfigKey "arc.odp" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.hddsort" "false" "${USER_CONFIG_FILE}"
initConfigKey "arc.version" "${ARC_VERSION}" "${USER_CONFIG_FILE}"
@@ -126,8 +125,6 @@ else
fi
echo
BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
[ -z "${BOOTCOUNT}" ] && BOOTCOUNT=0
STATICIP="$(readConfigKey "arc.staticip" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=20
@@ -137,7 +134,7 @@ for N in ${ETHX}; do
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
COUNT=0
while true; do
if [[ "${STATICIP}" = "true" && "${N}" = "eth0" && -n "${ARCIP}" && ${BOOTCOUNT} -gt 0 ]]; then
if [[ "${STATICIP}" = "true" && "${N}" = "eth0" && -n "${ARCIP}" ]]; then
ARCIP="$(readConfigKey "arc.ip" "${USER_CONFIG_FILE}")"
NETMASK="$(readConfigKey "arc.netmask" "${USER_CONFIG_FILE}")"
IP="${ARCIP}"