Skip to content
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

Fix pihole -r dialog exit #4965

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Fix pihole -r dialog exit #4965

merged 1 commit into from
Oct 10, 2022

Conversation

rdwebdesign
Copy link
Member

What does this PR aim to accomplish?

This PR fixes an error that happens if an user starts a repair (pihole -r) and decides to select exit option or press ESC. The script should exit, but it simply continues.

How does this PR accomplish the above?

Removing || true from the code.

What documentation changes (if any) are needed to support this PR?

none


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

  • I have read the above and my PR is ready for review. Check this box to confirm

@dschaper
Copy link
Member

dschaper commented Oct 9, 2022

Can you show the tests you ran for this? I think this change will just trigger set -e and wont actually run the code that is intended to run when exit is selected.

@rdwebdesign
Copy link
Member Author

rdwebdesign commented Oct 9, 2022

pihole-r

I can't exit on the repair/reconfigure screen.
The script only exits on the other screens.

@rdwebdesign
Copy link
Member Author

rdwebdesign commented Oct 9, 2022

Look at the UpdateCmd (lines 2017-2025).
dialog is executed in a subshell.

UpdateCmd=$(dialog --no-shadow --keep-tite --output-fd 1 \
--cancel-label Exit \
--title "Existing Install Detected!" \
--menu "\\n\\nWe have detected an existing install.\
\\n\\nPlease choose from the following options:\
\\n($strAdd)"\
"${r}" "${c}" 2 \
"${opt1a}" "${opt1b}" \
"${opt2a}" "${opt2b}" || true)
result=$?

If dialog succeeds, the part before the || true will be execute and line 2027 will receive 0 (success).
If dialog exits with non-zero return, the || true is executed. Now, the last command was true. Line 2027 will receive 0 (success).

result=$? will always be 0.

@PromoFaux
Copy link
Member

@rdwebdesign rebase

@rdwebdesign
Copy link
Member Author

@rdwebdesign rebase

No comments... Do you think I'm a bot???

automated install/basic-install.sh Show resolved Hide resolved
dschaper
dschaper previously approved these changes Oct 9, 2022
@dschaper
Copy link
Member

dschaper commented Oct 9, 2022

Can you squash this first please?

- if an option is selected: Get option (repair/reconfigure);
- if exit or ESC: Get exit code (1/255)

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
@rdwebdesign
Copy link
Member Author

Can you squash this first please?

Done.
Now it needs to be approved again.

@dschaper dschaper merged commit fed58f0 into development Oct 10, 2022
@dschaper dschaper deleted the fix/repair_exit branch October 10, 2022 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants