New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New RECOVERY_COMMANDS array #3089
Conversation
In skel/default/etc/scripts/system-setup added RECOVERY_COMMANDS (plus RECOVERY_COMMANDS_LABEL)
In [skel/default]/etc/scripts/system-setup implemented RECOVERY_COMMANDS together with RECOVERY_COMMANDS_LABEL for automatic_recovery and unattended_recovery plus several enhancements for debug mode and 'read' timeouts for unattended_recovery
Deleted the old system-setup code
At least for me my current code in Because currently there is nothing in default.conf
|
@jsmeix your PR should add a default value for |
I believe this will be very useful especially for automated testing. One will be able to inject flags like -D or -d, and even test another recovery system commands, like |
@pcahyna |
In default.conf set and describe RECOVERY_COMMANDS and RECOVERY_COMMANDS_LABEL
Set rear_options to '-D' instead of '-v -D' because '-D' implies '-v'
I will test with the defaults and if this works OK for me |
typo fix and better wording in default.conf comment
I tested with the defaults and it works well for me. |
@rear/contributors |
@rear/contributors |
Do no longer call eval echo "... $command ..." but instead call plain echo "... $command ..." (default command='rear $rear_options recover') to keep the code simple and fail-safe because "Better very simple code than oversophisticated (possibly fragile) constructs.", cf. https://github.com/rear/rear/wiki/Coding-Style
Use the simple default RECOVERY_COMMANDS_LABEL='rear recover' instead of RECOVERY_COMMANDS_LABEL='rear $rear_options recover' because the latter would need fragile code like eval echo "... $RECOVERY_COMMANDS_LABEL ..." or complicated code to safely evaluate nested variables and this is only meant as some meaningful user info about what is going on but not as debug info what the exact called command is.
A final test with
and the default RECOVERY_COMMANDS and REBOOT_COMMANDS |
@jsmeix please see the note about rebase and squash. |
maybe you can actually squash all the commits together because the latter commits merely fix problems with the earlier commits and we don't need all the commits in the history? |
That's what the CI test actually does, so you maybe don't need to spend time on this kind of test (unless you want to test specifically on SUSE distributions, the CI runs on Fedora and CentOS). |
I squashed all the commits together. |
A further side note regarding Neither 'eval' nor 'envsubst' properly evaluate
When one knows the varaiable names one could do
Perhaps I should do the latter for 'rear_options' like
I don't know what is better:
or
To me the latter code looks more clear. '${parameter//pattern/string}' is old bash functionality The 'rear_options' value is safe because we set it in |
But this is proper behavior! Shell itself does not evaluate this. As shown in your first example, below. So
(...)
What is the problem you are trying to solve? We don't have any nested variable references like this currently. The
I thought you wanted to keep the code simple, i.e. no attempts at variable replacement in the displayed string? Anyway, if you want to perform replacement anyway, I think the latter code is clearer. Too many single quotes in the former. |
A remark regarding squashing commits: While squashing commits makes the history
Walking back the chain of parents finally leads to In contrast without squashing commits
so without squashing for commits "inside" a pull request |
I see. The problem seems to be that the WebUI https://github.com/rear/rear/pull/3089/commits still shows b131e47, but it is dangling, which is not intuitive. IMO, the right solution is to squash the commits yourself locally and force push. Then merge in the WebUI without using the squash option. This will update https://github.com/rear/rear/pull/3089/commits with the new commits that also the merged history will contain. b131e47 would not be visible at all, instead of it you would see the squashed commit(s) under https://github.com/rear/rear/pull/3089/commits. Would that work? |
Regarding properly evaluating nested variables: I only liked to show that there is no proper way to Only under known restricted/controlled conditions Currently I don't know if I will ever implement
but at least I know that this specific case is feasible. |
New RECOVERY_COMMANDS array that specifies the "rear recover" commands
which are automatically called after the ReaR recovery system has started up
to recreate the system in 'auto_recover'/'automatic' or 'unattended' mode.
Type: Enhancement
Impact: Normal
Reference to related issue (URL):
'-c' and '-C' options are ignored with 'automatic/auto_recover' and 'unattended' modes #2942
Add REBOOT_COMMANDS (issue 3068) #3070 (comment)
How was this pull request tested?
Seems to work OK for me so far
with the defaults (in default.conf)
and also with (excerpt)
In skel/default/etc/scripts/system-setup
added RECOVERY_COMMANDS (plus RECOVERY_COMMANDS_LABEL)
and in default.conf set and describe defaults
so that manual "rear recover" behaves as before.