| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- ##
- ## confd.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2014 OpenPKG Foundation e.V. <http://openpkg.net/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # package version
- %define V_opkg 0.5.0b2
- %define V_dist 0.5.0-beta2
- # package information
- Name: confd
- Summary: Configuration Management Server
- URL: http://www.confd.io/
- Vendor: Kelsey Hightower
- Packager: OpenPKG Foundation e.V.
- Distribution: OpenPKG Community
- Class: EVAL
- Group: Network
- License: MIT
- Version: %{V_opkg}
- Release: 20140706
- # list of sources
- Source0: https://github.com/kelseyhightower/confd/archive/v%{V_dist}.tar.gz
- Source1: confd.toml
- Source2: rc.confd
- Source3: example.toml
- Source4: example.conf.tmpl
- # build information
- BuildPreReq: OpenPKG, openpkg >= 20120101, go
- PreReq: OpenPKG, openpkg >= 20120101, etcd
- %description
- confd(8) is a lightweight configuration management tool focusing on:
- keeping local configuration files up-to-date by polling etcd(8) and
- processing template resources; reloading applications to pick up new
- config file changes.
- %track
- prog confd = {
- version = %{version}
- url = https://github.com/kelseyhightower/confd/releases
- regex = v(__VER__)\.tar\.gz
- }
- %prep
- %setup -q -n confd-%{V_dist}
- %build
- # patch path to configuration file
- %{l_shtool} subst \
- -e 's;/etc/confd/confd.toml;%{l_prefix}/etc/confd/confd.toml;' \
- confd.go
- # prepare Go build environment
- mkdir -p Godeps/_workspace/src/github.com/kelseyhightower
- ln -s ../../../../.. Godeps/_workspace/src/github.com/kelseyhightower/confd
- export GOBIN=`pwd`/bin
- export GOPATH=`pwd`/Godeps/_workspace
- # build program
- go build -x
- %install
- # create directory hierarchy
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/sbin \
- $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
- $RPM_BUILD_ROOT%{l_prefix}/etc/confd/conf.d \
- $RPM_BUILD_ROOT%{l_prefix}/etc/confd/templates \
- $RPM_BUILD_ROOT%{l_prefix}/var/confd/run \
- $RPM_BUILD_ROOT%{l_prefix}/var/confd/log \
- $RPM_BUILD_ROOT%{l_prefix}/var/confd/out
- # install program
- %{l_shtool} install -c -s -m 755 \
- confd-[0-9]* $RPM_BUILD_ROOT%{l_prefix}/sbin/confd
- # install configuration files
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- %{SOURCE confd.toml} $RPM_BUILD_ROOT%{l_prefix}/etc/confd/
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- %{SOURCE example.toml} $RPM_BUILD_ROOT%{l_prefix}/etc/confd/conf.d/
- %{l_shtool} install -c -m 644 %{l_value -s -a} \
- %{SOURCE example.conf.tmpl} $RPM_BUILD_ROOT%{l_prefix}/etc/confd/templates/
- # install run-command script
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
- %{SOURCE rc.confd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std} \
- '%config %{l_prefix}/etc/confd/conf.d/*' \
- '%config %{l_prefix}/etc/confd/templates/*' \
- '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/confd/*'
- %files -f files
- %clean
- %post
- # after upgrade, restart service
- [ $1 -eq 2 ] || exit 0
- eval `%{l_rc} confd status 2>/dev/null`
- [ ".$confd_active" = .yes ] && %{l_rc} confd restart
- exit 0
- %preun
- # before erase, stop service and remove log files
- [ $1 -eq 0 ] || exit 0
- %{l_rc} confd stop 2>/dev/null
- rm -rf $RPM_INSTALL_PREFIX/var/confd/log/* >/dev/null 2>&1 || true
- rm -rf $RPM_INSTALL_PREFIX/var/confd/run/* >/dev/null 2>&1 || true
- rm -rf $RPM_INSTALL_PREFIX/var/confd/out/* >/dev/null 2>&1 || true
- exit 0
|