-
Notifications
You must be signed in to change notification settings - Fork 10
Allow script to run without init system (in containers) #38
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
base: master
Are you sure you want to change the base?
Conversation
Switch to markdown
Adds argument --datadir as a possible fallback for user that would like to set custom data directory. Adds usage section to readme.
use `./postgresql-setup --upgrade`. | ||
|
||
If your distribution doesn't include this | ||
script with PostgreSQL and you are using this on your own, please update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand it correctly that you mean users who want to use it on other distributions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, from what I understood this script is completely distro/os agnostic (as long as u have bash) and you could configure the paths.
And with the addition of not being dependent on systemd you have even more possibilities with this script. I mean, theoretically it could even be used on macOS with bash and postgresql installed (via brew, for example). Only thing that you would need is to fix the paths via autotools config (maybe something is hardcoded somewhere, but mostly just autotools).
It makes sense to me, but I am not an expert in bash. What is your opinion from the bash perspective @praiskup ? |
I don't have time for reviewing this, sorry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @SlouchyButton,
Please address some of the mentioned issues.
-
I'd move the
Fixes: https://github.com/devexp-db/postgresql-setup/issues/26
to theAllow initdb and upgrade without systemd running
commit, as the other commits update README, they don't really fix the issue described. -
Apart from listing requirements, I'd consider adding simple one liner
dnf install autoconf ...
, that is more newbie friendly.
local systemd_env="$(cat "${service_file}")" \ | ||
|| { return; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very strange syntax? Might be ok to keep though, consider adding comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's reused from other similar functions as the one exactly above 'handle_service_env()'. It is probably more readable to just pipe the file using << directly into the loop. But not sure really, I just tried to be consistent, even tho in the other functions we are not working with files at all - so we wouldn't be able to use << there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cat
is fine, although, yes, you should use pipes, that's what the general guidelines say, I was pointing at the { return; }
as it might not be immediately obvious.
Suggestions from code review Co-authored-by: David Hanina <25201406+duzda@users.noreply.github.com>
This change detects whether system is running without systemd as PID1, and if so it refrains from using any systemctl commands (that normally need systemd to be running as PID1).
The script will parse the service file directly (specified by autotools configuration) and try to figure out the datadir from there. If that also fails or is not possible, added
--datadir
option to override the datadir and use that for upgrade/initialization.Updated readme to include usage, how to debug the script and converted to markdown for more up-to-date look.
Fixes: #26