Skip to content

Commit

Permalink
tree: rework more logic
Browse files Browse the repository at this point in the history
Signed-off-by: AuxXxilium <[email protected]>
  • Loading branch information
AuxXxilium committed Aug 30, 2024
1 parent e339aad commit 60f9bcf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
5 changes: 3 additions & 2 deletions files/initrd/opt/arc/arc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function arcVersion() {
URLVER="$(echo "${PV}" | cut -d'.' -f1,2)"
[ "${PRODUCTVER}" != "${URLVER}" ] && PRODUCTVER="${URLVER}"
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && break
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
fi
done
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
Expand All @@ -341,8 +341,8 @@ function arcVersion() {
return 1 # 1 or 255 # cancel-button or ESC
PAT_URL="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
PAT_HASH="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true"
fi
VALID="true"
elif [ "${AUTOMATED}" == "true" ]; then
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
Expand All @@ -359,6 +359,7 @@ function arcVersion() {
fi
fi
sleep 2
mkdir -p "${USER_UP_PATH}"
DSM_FILE="${USER_UP_PATH}/${PAT_HASH}.tar"
if [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "false" ] && [ "${VALID}" == "true" ]; then
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
Expand Down
2 changes: 1 addition & 1 deletion files/initrd/opt/arc/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ if grep -q "automated_arc" /proc/cmdline; then
else
writeConfigKey "automated" "false" "${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
fi
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
# Check for compatibility
compatboot

Expand Down
9 changes: 4 additions & 5 deletions files/initrd/opt/arc/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fi

# Get Config Status
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"

# Get Keymap and Timezone Config
ntpCheck
Expand Down Expand Up @@ -65,19 +66,17 @@ function arcUpdate() {
# Ask for Boot
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
--infobox "Update successful!" 0 0
if [ "${CONFDONE}" == "true" ] && [ ! -f "${PART3_PATH}/automated" ]; then
echo "${ARC_VERSION}-${MODEL}-${PRODUCTVER}-custom" >"${PART3_PATH}/automated"
fi
boot
}

###############################################################################
# Calls boot.sh to boot into DSM kernel/ramdisk
function boot() {
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
if [ "${CONFDONE}" == "true" ]; then
BUILDDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
if [ "${BUILDDONE}" == "true" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Rebooting to automated Build Mode...\nPlease stay patient!" 4 30
[ ! -f "${PART3_PATH}/automated" ] && echo "${ARC_VERSION}-${MODEL}-${PRODUCTVER}" >"${PART3_PATH}/automated"
sleep 3
rebootTo automated
else
Expand Down
22 changes: 11 additions & 11 deletions files/p1/boot/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ set color_normal=white/black
set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait net.ifnames=0 panic=0 pcie_aspm=off"

search --set=root --label "ARC3"
if [ -e /automated ]; then
menuentry 'Arc Automated Mode' --id automated {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc
echo "Loading Arc Initramfs..."
initrd /initrd-arc
echo "Booting..."
}
fi

if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
if [ "${default}" = "direct" ]; then
set timeout="1"
Expand All @@ -120,6 +109,17 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then
}
fi

if [ -e /automated ]; then
menuentry 'Arc Automated Mode' --id automated {
set_gfxpayload
echo "Loading Arc Kernel..."
linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc
echo "Loading Arc Initramfs..."
initrd /initrd-arc
echo "Booting..."
}
fi

menuentry 'Arc Config Mode' --id config {
set_gfxpayload
echo "Loading Arc Kernel..."
Expand Down

0 comments on commit 60f9bcf

Please sign in to comment.