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

Simplify versions.sh #4959

Merged
merged 10 commits into from
Nov 9, 2022
Merged

Simplify versions.sh #4959

merged 10 commits into from
Nov 9, 2022

Conversation

yubiuser
Copy link
Member

@yubiuser yubiuser commented Oct 6, 2022

What does this PR aim to accomplish?:

Simplifies version.sh. Rationale: PR #4663 removed the need for sudo powers if pihole -v is called. However, this leads to issues with newer git versions (seen in #4759) as version.sh uses some git commands to get the local version and branches. Without sudo, git complains now about fatal: unsafe repository ('/var/www/html/admin' is owned by someone else).
Since PR #4875 we store local and remote version (and branch) info in /etc/pihole/versions. This PR moves the remaining functions from version.sh to updatechecker.sh. The latter is always called with sudo powers and therefore does not run into the described git issue. The remaining version.sh does nothing else than to print the requested output of /etc/pihole/versions.

Fixes: #4759

  • How does this PR accomplish the above?:
  1. Add a new function get_remote_version() to updatechecker.sh
  2. Removes the distinction between updating the remote and local info from updatechecker. That way, we can be sure, that the local branch is updated before we get the remote hash of the the current branch. If you look at the current code, there was only one occurrence where local and remote were not called consecutively: the daily cron job. We just agreed to remove the local update from the cron job (Remove cronjob that checks local versions every 10 minutes - only check when required #4939), but this was about updating every 10 minutes. I think updating once every 24h should be fine. We already ensure that updatechecker is called at every relevant place: after a fresh install, after each pihole -up and after each checkout.
  3. Move the hash functions to updatechecker.sh
  4. Let pihole -v gather everything from /etc/pihole/versions

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

Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
@yubiuser yubiuser marked this pull request as ready for review October 6, 2022 20:06
@yubiuser yubiuser requested a review from a team October 6, 2022 20:10
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
@PromoFaux PromoFaux merged commit 64e61aa into development Nov 9, 2022
@PromoFaux PromoFaux deleted the simplify_versions.sh branch November 9, 2022 17:15
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pihole-c-shows-version-errors/59173/13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Code Review Required Open Pull Request, needs code reviewd Testing Required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version numbers not displayed correctly anymore in Chronometer
5 participants