When in batch mode, if an error occurs while saving/restoring ocs-sr will exit and this jump back to ocs-live-run-menu, which will eventually call run_post_cmd_when_clonezilla_live_end() to reboot/poweroff/shell.
This function prompts for user interaction even when in batch mode. As I understand it, it shouldn't. In my case, if restoration fails I don't want it to prompt for reboot/poweroff/shell, instead I want it to automatically reboot so I can change the command through PXE remotely (and since the client will have been rebooting continously it will eventually get the new PXE command).
The patch I applied is the following, in filesystem.squashfs, in /opt/drbl/sbin/ocs-functions function run_post_cmd_when_clonezilla_live_end():
# Load DRBL settings
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
run_post_cmd_when_clonezilla_live_end() {
local tty_bash_id umount_dir
parse_cmdline_option ocs_final_action
final_action="$ocs_final_action"
if [ "$ocs_batch_mode" = "on" -o -n "$final_action" ]; then
[ -z "$final_action" ] && final_action="$POSTRUN_DEF"
else
echo "$msg_clone_finished_choose_to:"
echo "(0) $msg_poweroff"
echo "(1) $msg_reboot"
echo "(2) $msg_enter_cml"
echo "(3) $msg_run_clonezilla_live_again"
echo -n "[2] "
read final_action
fi
case "$final_action" in
...
}
With this patch,
* if ocs_batch_mode==on AND ocs_final_action -> no prompt, reboot/poweroff/shell/prompt depeding on the value of ocs_final_action
* if ocs_batch_mode==on -> no prompt, do the default shutdown action defined in $POSTRUN_DEF in /opt/drbl/sbin/conf/drbl-ocs.conf
* if ocs_final_action -> no prompt, reboot/poweroff/shell/prompt depeding on the value of ocs_final_action
* else (ocs_batch_mode==no/unset and ocs_final_action=choose/unset) -> prompt for final action
Also, to make ocs-sr act according to this new boot parameter , I changed ocs-sr line 862:
[ -z "$postrun" ] && postrun="choose"
with
if [ -z "$postrun" ]; then
parse_cmdline_option ocs_final_action
if [ -n "$ocs_final_action" ]; then
postrun="$ocs_final_action"
else
postrun="choose"
fi
fi
ocs-sr's -p parameter will still overwrite ocs_final_action.
Please attach the patch file so it's easier for us to diagnose.
Thanks.
Steven.