[Kimchi-devel] [PATCH v2] Fix make install for systemd systems

Ramon Medeiros ramonn at linux.vnet.ibm.com
Mon Jun 8 13:47:51 UTC 2015



On 06/05/2015 09:55 AM, Aline Manera wrote:
>
>
> On 03/06/2015 10:39, Ramon Medeiros wrote:
>> Make install now will install firewalld and systemctl service. Also,
>> it will create base file structure to run kimchi (what was being created
>> at rpm spec).
>>
>> Changes:
>>
>> v2:
>> Use macros to determine systemd directory
>> Do not use root permissions on make install script (like rebooting 
>> systemctl)
>> ---
>>   Makefile.am                   | 50 
>> +++++++++++++++++++++++++++----------------
>>   configure.ac                  |  9 ++++++++
>>   contrib/kimchi.spec.fedora.in | 16 --------------
>>   contrib/kimchi.spec.suse.in   | 18 ----------------
>>   4 files changed, 41 insertions(+), 52 deletions(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index 91a0fa2..46b0b5b 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -115,27 +115,41 @@ ChangeLog:
>>       fi
>>
>>   install-data-local:
>> -    @if  test -d /usr/lib/systemd/system/ ; then \
>> -        $(INSTALL_DATA) contrib/kimchid.service.fedora 
>> /usr/lib/systemd/system/kimchid.service; \
>> -        systemctl daemon-reload; \
>> -    elif test -d /etc/systemd/system; then \
>> -        $(INSTALL_DATA) contrib/kimchid.service.fedora 
>> /etc/systemd/system/kimchid.service; \
>> -        systemctl daemon-reload; \
>> -    else \
>> -        $(INSTALL_DATA) contrib/kimchid.sysvinit /etc/init.d/kimchid; \
>> -        chmod +x /etc/init.d/kimchid; \
>> -    fi
>> +    @if  test -d $(systemdsystemunitdir) ; then \
>> +        mkdir -p $(DESTDIR)/$(systemdsystemunitdir); \
>> +        $(INSTALL_DATA) contrib/kimchid.service.fedora 
>> $(DESTDIR)/$(systemdsystemunitdir)/kimchid.service; \
>> +    else \
>> +        mkdir -p $(DESTDIR)/etc/init.d/ \
>> +        $(INSTALL_DATA) contrib/kimchid.sysvinit 
>> $(DESTDIR)/etc/init.d/kimchid; \
>> +        chmod +x $(DESTDIR)/etc/init.d/kimchid; \
>> +    fi; \
>> +    if test -d /usr/lib/firewalld/services/; then \
>> +        mkdir -p $(DESTDIR)/usr/lib/firewalld/services/; \
>> +        $(INSTALL_DATA) src/firewalld.xml 
>> $(DESTDIR)/usr/lib/firewalld/services/kimchid.xml; \
>> +    fi; \
>
>> +    mkdir -p 
>> $(DESTDIR)/var/lib/kimchi/{debugreports,screenshots,vnc-tokens,isos}
>> +    touch $(DESTDIR)/var/lib/kimchi/objectstore
>> +    mkdir -p $(DESTDIR)/var/log/kimchi/
>> +    touch $(DESTDIR)/var/log/kimchi/kimchi-access.log
>> +    touch $(DESTDIR)/var/log/kimchi/kimchi-error.log
>> +    mkdir -p $(DESTDIR)/etc/kimchi/
>> +    touch $(DESTDIR)/etc/nginx/conf.d/kimchi.conf
>
> You don't need to create the above directories/files as they will be 
> created on demand on server start up.

Hi Aline,

after installing kimchi without creating those files, i got an error at 
make check:

make[3]: Entering directory '/home/ramonn/GitTrees/KIMCHI/tests'
/bin/mkdir -p ../data/screenshots
./run_tests.sh
Loading YumUpdate features.
Loaded plugins: fastestmirror, ibm-repository, langpacks
libvirt: Storage Driver error : cannot open path '/var/lib/kimchi/isos': 
No such file or directory
Fatal: Unable to craete storage pool ISO. Please, check the 
configuration in /home/ramonn/GitTrees/KIMCHI/src/template.conf to 
ensure it has a valid storage pool.
Details: cannot open path '/var/lib/kimchi/isos': No such file or directory

Seems that not all dirs are being created on the startup
>
>>   uninstall-local:
>> -    @if test -f /usr/lib/systemd/system/kimchid.service; then \
>> -        $(RM) /usr/lib/systemd/system/kimchid.service; \
>> -        systemctl daemon-reload; \
>> -    elif test -f /etc/systemd/system/kimchid.service; then \
>> -        $(RM) /etc/systemd/system/kimchid.service; \
>> +    @if test -f $(systemdsystemunitdir)/kimchid.service; then \
>> +        $(RM) $(DESTDIR)/$(systemdsystemunitdir)/kimchid.service; \
>>       elif test -f /etc/init.d/kimchid; then \
>> -        $(RM) /etc/init.d/kimchid; \
>> -    fi
>> -
>> +        $(RM) $(DESTDIR)/etc/init.d/kimchid; \
>> +        $(RM) $(DESTDIR)/etc/init/kimchi.conf; \
>> +    fi; \
>> +    if test -d /usr/lib/firewalld/services/; then \
>> +        $(RM) $(DESTDIR)/usr/lib/firewalld/services/kimchid.xml; \
>> +    fi; \
>> +    $(RM) -rf $(DESTDIR)/var/lib/kimchi
>> +    $(RM) -rf $(DESTDIR)/var/log/kimchi
>> +    $(RM) -rf $(DESTDIR)/etc/kimchi
>> +    $(RM) $(DESTDIR)/etc/nginx/conf.d/kimchi.conf
>> +
>>   VERSION:
>>       @if test -d .git; then                                \
>>           git describe --abbrev=0 > $@;                     \
>> diff --git a/configure.ac b/configure.ac
>> index f5091b8..0261b5f 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -64,6 +64,15 @@ else
>>   AC_SUBST([ENABLE_SAMPLE], [False])
>>   fi
>
>> +# check for systemd
>> +PKG_PROG_PKG_CONFIG
>> +AC_ARG_WITH([systemdsystemunitdir],
>> +    AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for 
>> systemd service files]),
>> +    [], [with_systemdsystemunitdir=$($PKG_CONFIG 
>> --variable=systemdsystemunitdir systemd)])
>> +if test "x$with_systemdsystemunitdir" != xno; then
>> +    AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
>> +fi
>> +
>
> So the user will need to pass that information during the build?
> Don't we have other way to discover it automatically?
>
>>   AC_ARG_WITH(
>>       [spice-html5],
>>       [AS_HELP_STRING([--with-spice-html5],
>> diff --git a/contrib/kimchi.spec.fedora.in 
>> b/contrib/kimchi.spec.fedora.in
>> index 30f8417..dc5533a 100644
>> --- a/contrib/kimchi.spec.fedora.in
>> +++ b/contrib/kimchi.spec.fedora.in
>> @@ -85,22 +85,6 @@ make DESTDIR=%{buildroot} install
>>
>>   %if 0%{?with_systemd}
>>
>> -# create /var/lib/kimchi structure
>> -mkdir -p 
>> %{buildroot}/%{_sharedstatedir}/kimchi/{debugreports,screenshots,vnc-tokens,isos}
>> -touch %{buildroot}/%{_sharedstatedir}/kimchi/objectstore
>> -
>> -# create /var/log/kimchi structure
>> -mkdir -p %{buildroot}/%{_localstatedir}/log/kimchi/
>> -touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-access.log
>> -touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-error.log
>> -
>> -# create /etc/kimchi structure
>> -mkdir -p %{buildroot}/%{_sysconfdir}/kimchi/
>> -touch %{buildroot}/%{_sysconfdir}/nginx/conf.d/kimchi.conf
>> -
>> -# Install the systemd scripts
>> -install -Dm 0644 contrib/kimchid.service.fedora 
>> %{buildroot}%{_unitdir}/kimchid.service
>> -install -Dm 0640 src/firewalld.xml 
>> %{buildroot}%{_prefix}/lib/firewalld/services/kimchid.xml
>>   %endif
>>
>>   %if 0%{?rhel} == 6
>> diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
>> index bf85661..5681a60 100644
>> --- a/contrib/kimchi.spec.suse.in
>> +++ b/contrib/kimchi.spec.suse.in
>> @@ -54,24 +54,6 @@ make
>>   rm -rf %{buildroot}
>>   make DESTDIR=%{buildroot} install
>>
>> -# create /var/lib/kimchi structure
>> -mkdir -p 
>> %{buildroot}/%{_var}/lib/kimchi/{debugreports,screenshots,vnc-tokens,isos}
>> -touch %{buildroot}/%{_var}/lib/kimchi/objectstore
>> -
>> -# create /var/log/kimchi structure
>> -mkdir -p %{buildroot}/%{_localstatedir}/log/kimchi/
>> -touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-access.log
>> -touch %{buildroot}/%{_localstatedir}/log/kimchi/kimchi-error.log
>> -
>> -# create /etc/kimchi structure
>> -mkdir -p %{buildroot}/%{_sysconfdir}/kimchi/
>> -
>> -# create nginx configuration
>> -touch %{buildroot}/%{_sysconfdir}/nginx/conf.d/kimchi.conf
>> -
>> -# Install the SysV init scripts
>> -install -Dm 0755 contrib/kimchid.sysvinit 
>> %{buildroot}%{_initrddir}/kimchid
>> -
>>   %post
>>   chkconfig kimchid on
>>
>

-- 

Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn at br.ibm.com




More information about the Kimchi-devel mailing list