Ignore:
Timestamp:
03/05/14 17:07:58 (6 years ago)
Author:
olahaye
Message:

Packaging: Added support for native systemd service files (Makefile and rpm side)
Reworked rpm to add --with flags for easy rpm customization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1/pkg/rpm/jobmonarch.spec

    r941 r953  
     1
     2# The following options are supported:
     3#   --with httpd_user=<username>       # defaults to: apache
     4#   --with httpd_group=<group>         # defaults to: apache
     5#   --with ganglia_user=<username>     # defaults to: ganglia
     6#   --with ganglia_group=<group>       # defaults to: ganglia
     7#   --with web_prefixdir=<path>        # defaults to: /usr/share/ganglia-webfrontend
     8
     9# example: rpmbuild -tb jobmonarch-1.1.2.tar.gz --with httpd_user=www-data --with httpd_group=www-data --with web_prefixdir=/srv/www/ganglia
     10
     11# Default value for web_prefixdir depending on distro.
     12%if 0%{?suse_version}
     13%define web_prefixdir /srv/www/htdocs/ganglia
     14%else
     15%define web_prefixdir /usr/share/ganglia-webfrontend
     16%endif
     17
     18# Default value for httpd user and group used by ganglia.
     19%define httpd_user apache
     20%define httpd_group apache
     21%define ganglia_user ganglia
     22%define ganglia_group ganglia
     23
     24# Read the provided --with tags if any (overriding default values).
     25%{?_with_httpd_user:%define httpd_user %(set -- %{_with_httpd_user}; echo $1 | grep -v with | sed 's/=//')}
     26%{?_with_httpd_group:%define httpd_group %(set -- %{_with_httpd_group}; echo $1 | grep -v with | sed 's/=//')}
     27%{?_with_httpd_user:%define ganglia_user %(set -- %{_with_ganglia_user}; echo $1 | grep -v with | sed 's/=//')}
     28%{?_with_httpd_group:%define ganglia_group %(set -- %{_with_ganglia_group}; echo $1 | grep -v with | sed 's/=//')}
     29%{?_with_web_prefixdir:%define web_prefixdir %(set -- %{_with_web_prefixdir}; echo $1 | grep -v with | sed 's/=//')}
     30
    131# Don't need debuginfo RPM
    232%define debug_package %{nil}
    333%define __check_files %{nil}
    434
    5 %if 0%{?suse_version}
    6 %define web_prefixdir /srv/www/htdocs/ganglia
    7 %else
    8 %define web_prefixdir %{custom_web_prefixdir}
    9 %endif
    10 
    11 %{!?custom_web_prefixdir: %define web_prefixdir /usr/share/ganglia}
    12 
    1335%define gangliaroot        %{web_prefixdir}
    1436%define gangliatemplatedir %{gangliaroot}/templates
    1537%define gangliaaddonsdir   %{gangliaroot}/addons
    16 
    17 %define gangliauser        %{custom_gangliauser}
    18 %{!?custom_gangliauser: %define gangliauser ganglia.ganglia}
    1938
    2039Summary: Tools and addons to Ganglia to monitor and archive batch job info
     
    130149        PREFIX=/usr \
    131150        GANGLIA_ROOT=%{gangliaroot} \
    132         GANGLIA_USER=%{gangliauser} \
    133         HTTPD_USER=apache.apache \
     151        GANGLIA_USER=%{ganglia_user}.%{ganglia_group} \
     152        HTTPD_USER=%{httpd_user}.%{httpd_group} \
    134153        JOBARCHIVE_RRDS=%{_sharedstatedir}/jobarchive \
    135154        DESTDIR=$RPM_BUILD_ROOT
     
    142161if [ "$1" = 1 ]; then
    143162    # Enable the service
     163%if 0%{?_unitdir:1}
     164    /usr/bin/systemctl enable jobmond.service
     165%else
    144166    /sbin/chkconfig --add jobmond
     167%endif
    145168    echo ""
    146169    echo "Additional manual changes are required to setup jobmond:"
     
    154177    echo ""
    155178elif [ "$1" = 2 ]; then
     179    echo "Restarting jobmond if needed..."
     180%if 0%{?_unitdir:1}
     181    /usr/bin/systemctl --system daemon-reload
     182    /usr/bin/systemctl reload-or-try-restart jobmond.service
     183%else
    156184    /sbin/service jobmond condrestart
     185%endif
    157186fi
    158187
     
    161190if [ "$1" = 1 ]; then
    162191    # Enable the service
     192%if 0%{?_unitdir:1}
     193    /usr/bin/systemctl enable jobarchived.service
     194%else
    163195    /sbin/chkconfig --add jobarchived
     196%endif
    164197    echo "Generating random password and updating apropriate files"
    165198    # Generate a 8 char password for the database:
     
    188221elif [ "$1" = 2 ]; then
    189222    echo "Restarting jobarchived if needed..."
     223%if 0%{?_unitdir:1}
     224    /usr/bin/systemctl --system daemon-reload
     225    /usr/bin/systemctl reload-or-try-restart jobarchived.service
     226%else
    190227    /sbin/service jobarchived condrestart
     228%endif
    191229    exit 0
    192230fi
     
    202240%preun -n jobmonarch-jobmond
    203241if [ "$1" = 0 ]; then
     242%if 0%{?_unitdir:1}
     243    /usr/bin/systemctl --no-reload disable jobmond.service
     244    /usr/bin/systemctl stop jobmond.service
     245%else
    204246    if [ -x /sbin/chkconfig ]; then
    205247        /sbin/service jobmond stop
    206248        /sbin/chkconfig --del jobmond
    207249    fi
     250%endif
    208251fi
    209252
    210253%preun -n jobmonarch-jobarchived
    211254if [ "$1" = 0 ]; then
     255%if 0%{?_unitdir:1}
     256    /usr/bin/systemctl --no-reload disable jobarchived.service
     257    /usr/bin/systemctl stop jobarchived.service
     258%else
    212259    if [ -x /sbin/chkconfig ]; then
    213260        /sbin/service jobarchived stop
    214261        /sbin/chkconfig --del jobarchived
    215262    fi
     263%endif
    216264fi
    217265
     
    229277%config(noreplace) %{_sysconfdir}/jobmond.conf
    230278%{_sysconfdir}/sysconfig/jobmond
    231 %{_initrddir}/jobmond
    232279%{_sbindir}/jobmond.py
    233280%{_sbindir}/jobmond
     281%%if 0%{?_unitdir:1}
     282%{_unitdir}/jobmond.service
     283%else
     284%{_initrddir}/jobmond
     285%endif
    234286
    235287%files -n jobmonarch-jobarchived
     
    238290%config(noreplace) %{_sysconfdir}/jobarchived.conf
    239291%{_sysconfdir}/sysconfig/jobarchived
    240 %{_initrddir}/jobarchived
    241292%dir %{_datadir}/jobarchived
    242293%{_sbindir}/jobarchived.py
     
    244295%{_datadir}/jobarchived/*
    245296%dir %{_sharedstatedir}/jobarchive
     297%%if 0%{?_unitdir:1}
     298%{_unitdir}/jobarchived.service
     299%else
     300%{_initrddir}/jobarchived
     301%endif
    246302
    247303%files -n jobmonarch-webfrontend
     
    416472
    417473%changelog
     474* Wed Mar 05 2014 Olivier Lahaye <olivier.lahaye@free.fr> 1.2.0-1
     475- Update default ganglia root.
     476- Add native systemd support.
     477- update to 1.2.0
     478- Add --with switch to allow tunning at rpmbuild. Parameters are similar to ganglia ones.
     479
     480* Fri Feb 14 2014 Ramon Bastiaans <ramon.bastiaans@surfsara.nl> 1.1.2-1
     481- New version
     482
    418483* Fri Sep 20 2013 Olivier Lahaye <olivier.lahaye@free.fr> 1.1.1-1
    419484- update to 1.1.1
Note: See TracChangeset for help on using the changeset viewer.