Skip to content

Commit

Permalink
Merge pull request #191 from Ultimaker/CES-2487_Add_Kernel_CmdArg_Res…
Browse files Browse the repository at this point in the history
…tore_Mode

[CES-2487] Add the kernel command line argument "restore" to force restore mode
  • Loading branch information
alexborro authored Dec 14, 2023
2 parents e663a31 + 1aa41b5 commit b454f21
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions initramfs/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ UPDATE_IMG_MOUNT="/mnt/update_img"
UPDATE_SRC_MOUNT="/mnt/update"
ARTICLENR_USB_MOUNT="/mnt/usb"
RESCUE_SHELL="no"
FORCE_RESTORE_MODE="no"

PREFIX="${PREFIX:-/usr/}"
EXEC_PREFIX="${PREFIX}"
Expand Down Expand Up @@ -89,8 +90,8 @@ restart()
restore_complete_loop()
{
while true; do
echo "Restore complete, remove the recovery SD card and powercycle the printer."
sleep 30s
echo "Restore complete, remove the recovery SD card and powercycle the printer."
sleep 30s
done
}

Expand Down Expand Up @@ -220,7 +221,7 @@ check_and_set_article_number()
find_and_run_update()
{
SOFTWARE_INSTALL_MODE="update"
if isBootingRestoreImage; then
if isBootingRestoreImage || [ "${FORCE_RESTORE_MODE}" = "yes" ]; then
SOFTWARE_INSTALL_MODE="restore"
fi

Expand Down Expand Up @@ -299,9 +300,9 @@ find_and_run_update()
break
fi

# After restore do not remove the file and loop endlessly
if [ "${SOFTWARE_INSTALL_MODE}" = "restore" ]; then
restore_complete_loop
# After restore do not remove the file and loop endlessly
if [ "${SOFTWARE_INSTALL_MODE}" = "restore" ]; then
restore_complete_loop
fi

if ! rm "${update_tmpfs_mount}/${UPDATE_IMAGE:?}"; then
Expand Down Expand Up @@ -330,6 +331,9 @@ parse_cmdline()
rescue)
RESCUE_SHELL="yes"
;;
restore)
FORCE_RESTORE_MODE="yes"
;;
ro)
rwmode="ro"
;;
Expand Down

0 comments on commit b454f21

Please sign in to comment.