From fbc5ce8073f0fbda6fb4e1be3cd6b39f6e8a98d7 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Mon, 20 Jan 2025 18:45:07 +0100 Subject: [PATCH] tree: update Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 56 ++++---------------------- files/initrd/opt/arc/include/consts.sh | 1 + files/initrd/opt/arc/ramdisk-patch.sh | 2 +- 3 files changed, 10 insertions(+), 49 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 51d3491a..375e3267 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -697,23 +697,20 @@ function backupMenu() { if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ] && [ "${CONFDONE}" = "true" ]; then dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \ 1 "Restore Arc Config from DSM" \ - 2 "Restore HW Encryption Key from DSM" \ - 3 "Backup HW Encryption Key to DSM" \ - 4 "Restore Arc Config from Online" \ - 5 "Backup Arc Config to Online" \ + 2 "Restore Hardware Key from DSM" \ + 3 "Restore Arc Config from Online" \ + 4 "Backup Arc Config to Online" \ 2>"${TMP_PATH}/resp" elif [ -n "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \ 1 "Restore Arc Config from DSM" \ - 2 "Restore HW Encryption Key from DSM" \ - 3 "Backup HW Encryption Key to DSM" \ - 4 "Restore Arc Config from Online" \ + 2 "Restore Hardware Key from DSM" \ + 3 "Restore Arc Config from Online" \ 2>"${TMP_PATH}/resp" else dialog --backtitle "$(backtitle)" --title "Backup" --cancel-label "Exit" --menu "Choose an Option" 0 0 0 \ 1 "Restore Arc Config from DSM" \ - 2 "Restore HW Encryption Key from DSM" \ - 3 "Backup HW Encryption Key to DSM" \ + 2 "Restore Hardware Key from DSM" \ 2>"${TMP_PATH}/resp" fi [ $? -ne 0 ] && break @@ -800,43 +797,6 @@ function backupMenu() { fi ;; 3) - BACKUPKEY="false" - DSMROOTS="$(findDSMRoot)" - if [ -z "${DSMROOTS}" ]; then - dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \ - --msgbox "No DSM system partition(md0) found!\nPlease insert all disks before continuing." 0 0 - return - fi - ( - mkdir -p "${TMP_PATH}/mdX" - for I in ${DSMROOTS}; do - while true; do - # fixDSMRootPart "${I}" - mount -t ext4 "${I}" "${TMP_PATH}/mdX" - if [ -f "${PART2_PATH}/machine.key" ]; then - mkdir -p "${TMP_PATH}/mdX/usr/arc/backup/p2" - cp -f "${PART2_PATH}/machine.key" "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" - if [ -f "${TMP_PATH}/mdX/usr/arc/backup/p2/machine.key" ]; then - BACKUPKEY="true" - sync - break - fi - fi - umount "${TMP_PATH}/mdX" - done - done - rm -rf "${TMP_PATH}/mdX" >/dev/null - ) 2>&1 | dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \ - --progressbox "Backup Encryption Key ..." 20 70 - if [ "${BACKUPKEY}" = "true" ]; then - dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \ - --msgbox "Encryption Key backup successful!" 0 0 - else - dialog --backtitle "$(backtitle)" --title "Backup Encrytion Key" \ - --msgbox "No Encryption Key found!" 0 0 - fi - ;; - 4) [ -f "${USER_CONFIG_FILE}" ] && mv -f "${USER_CONFIG_FILE}" "${USER_CONFIG_FILE}.bak" HWID="$(genHWID)" if curl -skL "https://arc.auxxxilium.tech?cdown=${HWID}" -o "${USER_CONFIG_FILE}" 2>/dev/null; then @@ -867,7 +827,7 @@ function backupMenu() { sleep 2 rm -f "${HOME}/.initialized" && exec init.sh ;; - 5) + 4) HWID="$(genHWID)" curl -sk -X POST -F "file=@${USER_CONFIG_FILE}" "https://arc.auxxxilium.tech?cup=${HWID}&userid=${USERID}" 2>/dev/null if [ $? -eq 0 ]; then @@ -1036,7 +996,7 @@ function sysinfo() { PATCHESVERSION="$(cat "${PATCH_PATH}/VERSION")" TIMEOUT=5 # Print System Informations - TEXT="\n\n\Z4> System: ${MACHINE} | ${BOOTSYS} | ${BUS}\Zn" + TEXT="\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 diff --git a/files/initrd/opt/arc/include/consts.sh b/files/initrd/opt/arc/include/consts.sh index c7e74620..9a369bfc 100755 --- a/files/initrd/opt/arc/include/consts.sh +++ b/files/initrd/opt/arc/include/consts.sh @@ -17,6 +17,7 @@ GRUB_PATH="${PART1_PATH}/boot/grub" USER_GRUB_CONFIG="${GRUB_PATH}/grub.cfg" USER_GRUBENVFILE="${GRUB_PATH}/grubenv" USER_CONFIG_FILE="${PART1_PATH}/user-config.yml" +HW_KEY="${PART2_PATH}/machine.key" ORI_ZIMAGE_FILE="${PART2_PATH}/zImage" ORI_RDGZ_FILE="${PART2_PATH}/rd.gz" diff --git a/files/initrd/opt/arc/ramdisk-patch.sh b/files/initrd/opt/arc/ramdisk-patch.sh index 1ac3a6e3..4593a916 100755 --- a/files/initrd/opt/arc/ramdisk-patch.sh +++ b/files/initrd/opt/arc/ramdisk-patch.sh @@ -203,7 +203,7 @@ fi # backup current loader configs BACKUP_PATH="${RAMDISK_PATH}/usr/arc/backup" rm -rf "${BACKUP_PATH}" -for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}" "${USER_UP_PATH}"; do +for F in "${USER_GRUB_CONFIG}" "${USER_CONFIG_FILE}" "${USER_UP_PATH}" "${HW_KEY}"; do if [ -f "${F}" ]; then FD="$(dirname "${F}")" mkdir -p "${FD/\/mnt/${BACKUP_PATH}}"