patroni icon indicating copy to clipboard operation
patroni copied to clipboard

During package installation creates unnecessary directories during installation

Open Aytuar opened this issue 2 years ago • 3 comments

Describe the bug During package installation creates unnecessary directories on root file system. %{_sysconfigdir} and %{_logdir}

To Reproduce Just install package version 2.1.2-1.rhel7 or 2.1.3-1.rhel7 from PostgreSQL Common repository.

Into rpm package this postinstall script.

postinstall scriptlet (using /bin/sh):                                                                                                                                                                                                       
/usr/bin/mkdir -p %{_logdir}/patroni                                                                                                                                                                                                         
/usr/bin/mkdir -p %{_sysconfigdir}/patroni/callbacks                                                                                                                                                                                         
touch %{_sysconfigdir}/patroni/callbacks/callbacks.sh                                                                                                                                                                                        
if [ $1 -eq 1 ] ; then                                                                                                                                                                                                                       
   /bin/systemctl daemon-reload >/dev/null 2>&1 || :                                                                                                                                                                                         
                                                                                                                                                                                                                                             
if [ $1 -eq 1 ] ; then                                                                                                                                                                                                                       
        # Initial installation                                                                                                                                                                                                               
        systemctl preset patroni.service >/dev/null 2>&1 || :                                                                                                                                                                                
fi 

In version 2.1.1-1.rhel7

postinstall scriptlet (using /bin/sh):                                                                                                                                                                                                       
if [ $1 -eq 1 ] ; then                                                                                                                                                                                                                       
   /bin/systemctl daemon-reload >/dev/null 2>&1 || :                                                                                                                                                                                         
                                                                                                                                                                                                                                             
if [ $1 -eq 1 ] ; then                                                                                                                                                                                                                       
        # Initial installation                                                                                                                                                                                                               
        systemctl preset patroni.service >/dev/null 2>&1 || :                                                                                                                                                                                
fi 

Aytuar avatar Mar 10 '22 14:03 Aytuar

I hope you realize that we don't maintain rpm/deb packages.

cc @devrimgunduz

CyberDem0n avatar Mar 10 '22 14:03 CyberDem0n

@Aytuar what is unnecessary? Log directory and callbacks directory?

devrimgunduz avatar Mar 10 '22 14:03 devrimgunduz

@devrimgunduz The %{_sysconfigdir} and %{_logdir} parameters are not passed to the script when creating an rpm package. Therefore, when installing an rpm package, they are perceived as the names of directories that are created in the root of the file system.

Simply the names of the directories %{_logdir} and %{_sysconfigdir} are created, just as I write them now. /%{_logdir}/patroni /%{_sysconfigdir}/patroni/callbacks

%{_logdir} should be /var/log, and %{_sysconfigdir} should be /etc There is an error in the spec file with which the rpm package is built and the variables are not replaced by their values.

Aytuar avatar Mar 11 '22 06:03 Aytuar

Hello! I install Patroni on CentOS 8 and 9 Source : patroni-2.1.7-1.rhel8.src.rpm Repository : @System From repo : PostgreSQL-Common

I have this folder also in root directory.
How to fix this bug?

and-shalamov avatar Feb 10 '23 20:02 and-shalamov

Hi,

Please install 3.0.0-2 RPMs, which I just released.

Regards, Devrim

devrimgunduz avatar Feb 15 '23 13:02 devrimgunduz

It's help me/ Thanks!

and-shalamov avatar Feb 18 '23 17:02 and-shalamov