Revision 00073661
Added by Dominic Cleal almost 10 years ago
extra/debianbuild/build.sh | ||
---|---|---|
#!/bin/bash
|
||
|
||
set -e
|
||
|
||
if [ $# -lt 1 ]; then
|
||
CONF="/home/greg/build-area/.nightly-foreman"
|
||
else
|
||
CONF="/home/greg/build-area/.nightly-${1}"
|
||
fi
|
||
|
||
if [ -f "${CONF}" ]; then
|
||
source "${CONF}"
|
||
else
|
||
echo "Couldn't find ${CONF}. Quitting."
|
||
exit 1
|
||
fi
|
||
|
||
DATE=$(date -R)
|
||
UNIXTIME=$(date +%s)
|
||
RELEASE="${VERSION}-~nightlybuild${UNIXTIME}"
|
||
|
||
GIT='/usr/bin/git'
|
||
|
||
mkdir -p "${BUILD_DIR}"
|
||
rm -rf "${BUILD_DIR}"/*
|
||
cd "${BUILD_DIR}"
|
||
|
||
$GIT clone "${REPO}" "${TARGET}"
|
||
cd "${TARGET}"
|
||
$GIT checkout "${BRANCH}"
|
||
$GIT submodule init
|
||
$GIT submodule update
|
||
|
||
LAST_COMMIT=$($GIT rev-list HEAD|/usr/bin/head -n 1)
|
||
|
||
prepare_build
|
||
|
||
rm -rf $(/usr/bin/find "${TARGET}" -name '.git*')
|
||
|
||
mv debian/changelog debian/changelog.tmp
|
||
|
||
echo "$PACKAGE_NAME ($RELEASE) UNRELEASED; urgency=low
|
||
|
||
* Automatically built package based on the state of
|
||
$REPO at commit $LAST_COMMIT
|
||
|
||
-- $MAINTAINER $DATE
|
||
" > debian/changelog
|
||
|
||
cat debian/changelog.tmp >> debian/changelog
|
||
rm -f debian/changelog.tmp
|
||
|
||
echo -n '3.0 (native)' > debian/source/format
|
||
# We use -d here since on a Centos box we can't check the installed debs
|
||
/usr/bin/dpkg-buildpackage -d -tc -uc -us
|
||
|
||
#/home/greg/bin/reprepro -b "${REPO_DIR}" includedeb "${DEB_REPO}" "${BUILD_DIR}"/*.deb
|
||
/home/greg/bin/reprepro --ignore=wrongdistribution -b "${REPO_DIR}" include "${DEB_REPO}" "${BUILD_DIR}"/*.changes
|
extra/debianbuild/dot-nightly-smart-proxy | ||
---|---|---|
export PATH=~/bin:~/usr/bin:$PATH
|
||
export PERL5OPT="-I${HOME}/perl/lib/perl5 -I${HOME}/perl/lib/perl5/site_perl"
|
||
|
||
PACKAGE_NAME='foreman-proxy'
|
||
VERSION='0.5'
|
||
MAINTAINER='Greg Sutcliffe <gsutcliffe@gmail.com>'
|
||
|
||
BUILD_DIR="/home/greg/build-area/nightly-${PACKAGE_NAME}"
|
||
TARGET="${BUILD_DIR}/${PACKAGE_NAME}"
|
||
REPO='git://github.com/theforeman/smart-proxy.git'
|
||
BRANCH='develop'
|
||
|
||
REPO_DIR='/home/greg/build-area/foreman-repo'
|
||
DEB_REPO='nightly'
|
||
|
||
function prepare_build() {
|
||
cd /home/greg/github/smart-proxy && git pull && cd -
|
||
cp -r /home/greg/github/smart-proxy/extra/debian .
|
||
}
|
extra/git2release | ||
---|---|---|
#! /bin/sh
|
||
# a simple script to create a Smart Proxy Official relase.
|
||
|
||
cd /tmp
|
||
rm -rf foreman-proxy
|
||
git clone git://github.com/theforeman/smart-proxy.git foreman-proxy
|
||
cd foreman-proxy
|
||
|
||
rm -rf `find -name ".git*"`
|
||
cd /tmp
|
||
|
||
tar cv foreman-proxy | bzip2 -9 > /tmp/foreman-proxy-$1.tar.bz2
|
||
rm -rf foreman-proxy
|
||
|
||
echo "Don't forget to tag the release"
|
extra/spec/foreman-proxy.init | ||
---|---|---|
#!/bin/bash
|
||
#
|
||
# Init script for foreman smart proxy
|
||
#
|
||
# chkconfig: - 85 15
|
||
# description: Init script for foreman proxy
|
||
|
||
# Source function library.
|
||
. /etc/rc.d/init.d/functions
|
||
|
||
if [ -f /etc/sysconfig/foreman-proxy ]; then
|
||
. /etc/sysconfig/foreman-proxy
|
||
fi
|
||
|
||
prog=foreman-proxy
|
||
RETVAL=0
|
||
FOREMAN_PROXY_PID=/var/run/$prog/$prog.pid
|
||
FOREMAN_PROXY_USER=${FOREMAN_PROXY_USER:-foreman-proxy}
|
||
FOREMAN_PROXY_HOME=${FOREMAN_PROXY_HOME:-/usr/share/foreman-proxy}
|
||
FOREMAN_PROXY_SETTINGS=${FOREMAN_PROXY_SETTINGS:-/etc/foreman-proxy/settings.yml}
|
||
|
||
start() {
|
||
echo -n $"Starting $prog: "
|
||
|
||
if egrep -q ':daemon:\s*false' $FOREMAN_PROXY_SETTINGS; then
|
||
echo -n $":daemon is false in settings.yml"
|
||
failure $":daemon is false in settings.yml"
|
||
echo
|
||
return 6
|
||
fi
|
||
|
||
daemon --user ${FOREMAN_PROXY_USER} /usr/bin/ruby ${FOREMAN_PROXY_HOME}/bin/smart-proxy > /dev/null
|
||
RETVAL=$?
|
||
if [ $RETVAL = 0 ]
|
||
then
|
||
echo_success
|
||
else
|
||
echo_failure
|
||
fi
|
||
|
||
echo
|
||
return $RETVAL
|
||
}
|
||
|
||
stop() {
|
||
echo -n $"Stopping $prog: "
|
||
if [ -f ${FOREMAN_PROXY_PID} ]; then
|
||
killproc -p ${FOREMAN_PROXY_PID}
|
||
RETVAL=$?
|
||
else
|
||
echo -n $"$prog was not running.";
|
||
failure $"$prog was not running.";
|
||
echo
|
||
return 1
|
||
fi
|
||
echo
|
||
[ $RETVAL -eq 0 ] && rm -f ${FOREMAN_PROXY_PID}
|
||
return $RETVAL
|
||
}
|
||
|
||
# See how we were called.
|
||
case "$1" in
|
||
start)
|
||
start
|
||
;;
|
||
stop)
|
||
stop
|
||
;;
|
||
status)
|
||
echo -n "$prog"
|
||
status -p $FOREMAN_PROXY_PID
|
||
RETVAL=$?
|
||
;;
|
||
restart)
|
||
stop
|
||
start
|
||
;;
|
||
condrestart)
|
||
stop
|
||
[ $? -eq 0 ] && start
|
||
;;
|
||
*)
|
||
echo $"Usage: $prog {start|stop|restart|condrestart}"
|
||
exit 1
|
||
esac
|
||
|
||
exit $RETVAL
|
extra/spec/foreman-proxy.logrotate | ||
---|---|---|
/var/log/foreman-proxy/*log {
|
||
missingok
|
||
notifempty
|
||
create 0644 foreman-proxy foreman-proxy
|
||
sharedscripts
|
||
rotate 5
|
||
compress
|
||
daily
|
||
postrotate
|
||
[ -e /etc/init.d/foreman-proxy ] && /etc/init.d/foreman-proxy restart >/dev/null 2>&1 || true
|
||
endscript
|
||
}
|
extra/spec/foreman-proxy.service | ||
---|---|---|
[Unit]
|
||
Description=Foreman Proxy
|
||
Wants=basic.target
|
||
After=basic.target network.target
|
||
|
||
[Service]
|
||
Type=forking
|
||
User=foreman-proxy
|
||
ExecStart=/usr/share/foreman-proxy/bin/smart-proxy
|
||
PIDFile=/run/foreman-proxy/foreman-proxy.pid
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
extra/spec/foreman-proxy.sysconfig | ||
---|---|---|
# the location where foreman proxy is installed
|
||
#FOREMAN_PROXY_HOME=/usr/share/foreman-proxy
|
||
|
||
# the user which runs the web interface
|
||
#FOREMAN_PROXY_USER=foreman-proxy
|
||
|
||
# location of the proxy config file
|
||
#FOREMAN_PROXY_SETTINGS=/etc/foreman-proxy/settings.yml
|
extra/spec/foreman-proxy.tmpfiles | ||
---|---|---|
d /run/foreman-proxy 0755 foreman-proxy foreman-proxy -
|
extra/spec/logrotate | ||
---|---|---|
/var/log/foreman-proxy/*log {
|
||
missingok
|
||
notifempty
|
||
create 0644 foreman-proxy foreman-proxy
|
||
sharedscripts
|
||
rotate 5
|
||
compress
|
||
daily
|
||
postrotate
|
||
[ -e /etc/init.d/foreman-proxy ] && service foreman-proxy condrestart >/dev/null 2>&1 || true
|
||
endscript
|
||
}
|
extra/spec/logrotate.systemd | ||
---|---|---|
/var/log/foreman-proxy/*log {
|
||
missingok
|
||
notifempty
|
||
create 0644 foreman-proxy foreman-proxy
|
||
sharedscripts
|
||
rotate 5
|
||
compress
|
||
daily
|
||
postrotate
|
||
/bin/systemctl try-restart foreman-proxy >/dev/null 2>&1 || true
|
||
endscript
|
||
}
|
foreman-proxy.spec | ||
---|---|---|
%global homedir %{_datadir}/%{name}
|
||
%global confdir config
|
||
%global specdir extra/spec
|
||
|
||
%if "%{?scl}" == "ruby193"
|
||
%global scl_prefix %{scl}-
|
||
%global scl_ruby /usr/bin/ruby193-ruby
|
||
%else
|
||
%global scl_ruby /usr/bin/ruby
|
||
%endif
|
||
|
||
Name: foreman-proxy
|
||
Version: 1.6.0
|
||
Release: 0.develop%{dist}
|
||
Summary: Restful Proxy for DNS, DHCP, TFTP, PuppetCA and Puppet
|
||
|
||
Group: Applications/System
|
||
License: GPLv3+
|
||
URL: http://theforeman.org/projects/smart-proxy
|
||
Source0: http://theforeman.org/files/todo/%{name}-%{version}.tar.gz
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||
|
||
BuildArch: noarch
|
||
|
||
%if "%{?scl}" == "ruby193" || 0%{?rhel} > 6 || (0%{?fedora} > 16 && 0%{?fedora} < 19)
|
||
Requires: %{?scl_prefix}ruby(abi) = 1.9.1
|
||
%else
|
||
%if 0%{?fedora} && 0%{?fedora} > 18
|
||
Requires: %{?scl_prefix}ruby(release)
|
||
%else
|
||
Requires: %{?scl_prefix}ruby(abi) = 1.8
|
||
%endif
|
||
%endif
|
||
|
||
Requires: %{?scl_prefix}rubygems
|
||
Requires: %{?scl_prefix}rubygem(rake) >= 0.8.3
|
||
Requires: %{?scl_prefix}rubygem(sinatra)
|
||
Requires: %{?scl_prefix}rubygem(json)
|
||
Requires: %{?scl_prefix}rubygem(rkerberos)
|
||
Requires: %{?scl_prefix}rubygem(rubyipmi)
|
||
Requires: %{?scl_prefix}rubygem(gssapi)
|
||
Requires: sudo
|
||
Requires: wget
|
||
Requires(pre): shadow-utils
|
||
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
|
||
Requires(post): chkconfig
|
||
Requires(preun): chkconfig
|
||
Requires(preun): initscripts
|
||
Requires(postun): initscripts
|
||
%else
|
||
Requires(post): systemd-sysv
|
||
Requires(post): systemd-units
|
||
Requires(preun): systemd-units
|
||
Requires(postun): systemd-units
|
||
BuildRequires: systemd-units
|
||
%endif
|
||
|
||
|
||
%description
|
||
Manages DNS, DHCP, TFTP and puppet settings though HTTP Restful API
|
||
Mainly used by the foreman project (http://theforeman.org)
|
||
|
||
%prep
|
||
%setup -q
|
||
|
||
%build
|
||
|
||
#replace shebangs for SCL
|
||
%if %{?scl:1}%{!?scl:0}
|
||
for f in bin/smart-proxy extra/query.rb extra/changelog; do
|
||
sed -ri '1sX(/usr/bin/ruby|/usr/bin/env ruby)X%{scl_ruby}X' $f
|
||
done
|
||
sed -ri '1,$sX/usr/bin/rubyX%{scl_ruby}X' extra/spec/foreman-proxy.init
|
||
%endif
|
||
|
||
|
||
%install
|
||
rm -rf %{buildroot}
|
||
install -d -m0755 %{buildroot}%{_datadir}/%{name}
|
||
install -d -m0755 %{buildroot}%{_datadir}/%{name}/config
|
||
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}
|
||
install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}
|
||
install -d -m0750 %{buildroot}%{_localstatedir}/log/%{name}
|
||
install -d -m0750 %{buildroot}%{_var}/run/%{name}
|
||
|
||
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
|
||
install -Dp -m0644 %{specdir}/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||
install -Dp -m0755 %{specdir}/%{name}.init %{buildroot}%{_initrddir}/%{name}
|
||
install -Dp -m0644 %{specdir}/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
|
||
%else
|
||
install -Dp -m0644 %{specdir}/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
|
||
install -Dp -m0644 %{specdir}/%{name}.tmpfiles %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
||
install -Dp -m0644 %{specdir}/logrotate.systemd %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
|
||
%endif
|
||
|
||
cp -p -r bin lib Rakefile config.ru %{buildroot}%{_datadir}/%{name}
|
||
chmod a+x %{buildroot}%{_datadir}/%{name}/bin/smart-proxy
|
||
rm -rf %{buildroot}%{_datadir}/%{name}/*.rb
|
||
|
||
# remove all test units from productive release
|
||
find %{buildroot}%{_datadir}/%{name} -type d -name "test" |xargs rm -rf
|
||
|
||
# Move config files to %{_sysconfdir}
|
||
install -Dp -m0644 %{confdir}/settings.yml.example %{buildroot}%{_sysconfdir}/%{name}/settings.yml
|
||
ln -sv %{_sysconfdir}/%{name}/settings.yml %{buildroot}%{_datadir}/%{name}/config/settings.yml
|
||
|
||
# Put HTML %{_localstatedir}/lib/%{name}/public
|
||
for x in public views; do
|
||
cp -pr $x %{buildroot}%{_localstatedir}/lib/%{name}/
|
||
ln -sv %{_localstatedir}/lib/%{name}/$x %{buildroot}%{_datadir}/%{name}/$x
|
||
done
|
||
|
||
# Put logs in %{_localstatedir}/log/%{name}
|
||
ln -sv %{_localstatedir}/log/%{name} %{buildroot}%{_datadir}/%{name}/logs
|
||
|
||
# Link temp directory to system wide temp
|
||
ln -sv %{_tmppath} %{buildroot}%{_datadir}/%{name}/tmp
|
||
|
||
%clean
|
||
rm -rf %{buildroot}
|
||
|
||
%files
|
||
%doc README LICENSE
|
||
%{_datadir}/%{name}
|
||
%config(noreplace) %{_sysconfdir}/%{name}
|
||
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
|
||
%attr(-,%{name},%{name}) %{_localstatedir}/lib/%{name}
|
||
%attr(-,%{name},%{name}) %{_localstatedir}/log/%{name}
|
||
%attr(-,%{name},%{name}) %{_var}/run/%{name}
|
||
%attr(-,%{name},root) %{_datadir}/%{name}/config.ru
|
||
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
|
||
%{_initrddir}/%{name}
|
||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||
%else
|
||
%{_unitdir}/%{name}.service
|
||
%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
||
%endif
|
||
|
||
%pre
|
||
# Add the "foreman-proxy" user and group
|
||
getent group foreman-proxy >/dev/null || \
|
||
groupadd -r foreman-proxy
|
||
getent passwd foreman-proxy >/dev/null || \
|
||
useradd -r -g foreman-proxy -d %{homedir} -s /sbin/nologin -c "Foreman Proxy deamon user" foreman-proxy
|
||
exit 0
|
||
|
||
%post
|
||
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
|
||
/sbin/chkconfig --add %{name}
|
||
exit 0
|
||
%else
|
||
if [ $1 -eq 1 ]; then
|
||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||
fi
|
||
%endif
|
||
|
||
%preun
|
||
if [ $1 -eq 0 ] ; then
|
||
# Package removal, not upgrade
|
||
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
|
||
/sbin/service %{name} stop >/dev/null 2>&1
|
||
/sbin/chkconfig --del %{name}
|
||
%else
|
||
/bin/systemctl --no-reload disable foreman-proxy.service >/dev/null 2>&1 || :
|
||
/bin/systemctl stop foreman-proxy.service >/dev/null 2>&1 || :
|
||
%endif
|
||
fi
|
||
|
||
%postun
|
||
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
|
||
if [ $1 -ge 1 ] ; then
|
||
/sbin/service %{name} restart >/dev/null 2>&1
|
||
fi
|
||
%else
|
||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||
if [ $1 -ge 1 ] ; then
|
||
/bin/systemctl try-restart foreman-proxy.service >/dev/null 2>&1 || :
|
||
fi
|
||
%endif
|
||
|
||
|
||
%changelog
|
||
* Wed Apr 16 2014 Dominic Cleal <dcleal@redhat.com> - 1.6.0-0.develop
|
||
- Bump to version 1.6-develop
|
||
|
||
* Thu Jan 16 2014 Dominic Cleal <dcleal@redhat.com> - 1.5.0-0.develop
|
||
- Bump to version 1.5-develop
|
||
|
||
* Thu Nov 21 2013 Dominic Cleal <dcleal@redhat.com> - 1.4.0-0.develop
|
||
- Bump and change versioning scheme (#3712)
|
||
- Ship config.ru for running under Passenger
|
||
|
||
* Thu Sep 05 2013 Lukas Zapletal <lzap+rpm[@]redhat.com> - 1.3.9999-1
|
||
- bump to version 1.3-develop
|
||
* Wed Jul 03 2013 Dominic Cleal <dcleal@redhat.com> - 1.2.9999-3
|
||
- add rubyipmi dependency for BMC support
|
||
* Wed Jun 13 2013 Lukas Zapletal <lzap+rpm[@]redhat.com> - 1.2.9999-2
|
||
- fixed service file for systemd
|
||
- /etc/sysconfig configuration is no longer in use for systemd
|
||
* Thu May 16 2013 Martin Bačovský <mbacovsk@redhat.com> 1.2.9999-1
|
||
- added support for building with tito
|
||
* Mon Feb 4 2013 shk@redhat.com 1.1-1
|
||
- 1.1 final.
|
||
* Fri Jan 25 2013 shk@redhat.com 1.1RC3-1
|
||
- Updated to RC3
|
||
* Wed Jan 09 2013 shk@redhat.com 1.1RC2-1
|
||
- Updated to RC2
|
||
- Removed net-ping dependency
|
||
* Tue Jan 1 2013 shk@redhat.com 1.1RC1-1
|
||
- Update to 1.1RC1
|
||
* Thu Aug 30 2012 jmontleo@redhat.com 1.0.0-3
|
||
- Update to include up to 330dbef353
|
||
* Sun Aug 05 2012 jmontleo@redhat.com 1.0.0-2
|
||
- Update to pull in fixes
|
||
* Mon Jul 23 2012 jmontleo@redhat.com 1.0.0-1
|
||
- Update packages for Foreman 1.0 Release.
|
||
* Wed Jul 18 2012 jmontleo@redhat.com 1.0.0-0.7
|
||
- Updated pacakages for Foreman 1.0 RC5 and Proxy RC2
|
||
* Thu Jul 05 2012 jmontleo@redhat.com 1.0.0-0.6
|
||
- Fix foreman-release to account for different archs. Pull todays source.
|
||
* Wed Jul 04 2012 jmontleo@redhat.com 1.0.0-0.5
|
||
- Bump version number for foreman RC3 and build with todays develop branch
|
||
* Sun Jul 01 2012 jmontleo@redhat.com 1.0.0-0.4
|
||
- Pull todays develop branch
|
||
* Fri Jun 29 2012 jmontleo@redhat.com 1.0.0-0.2
|
||
- Rebuild with develop branch from today. Hopefully we're really 1.0.0 RC2 this time
|
||
* Tue Jun 19 2012 jmontleo@redhat.com 0.5.1-9
|
||
- Rebuild with todays develop branch.
|
||
* Thu Jun 14 2012 jmontleo@redhat.com 0.5.1-8
|
||
- Rebuild with todays develop branch.
|
||
* Tue May 08 2012 Jason Montleon <jmontleo@redhat.com> - 0.5.1-1
|
||
- update version to match foreman package version
|
||
* Wed Dec 28 2011 Ohad Levy <ohadlevy@gmail.com> - 0.3.1
|
||
- rebuilt
|
||
* Wed Nov 08 2011 Ohad Levy <ohadlevy@gmail.com> - 0.3
|
||
- rebuilt
|
||
* Wed Sep 28 2011 Ohad Levy <ohadlevy@gmail.com> - 0.3rc2
|
||
- rebuilt
|
||
* Sat Sep 10 2011 Ohad Levy <ohadlevy@gmail.com> - 0.3rc1
|
||
- rebuilt
|
||
* Mon Jun 6 2011 Ohad Levy <ohadlevy@gmail.com> - 0.2
|
||
- rebuilt
|
||
* Thu May 26 2011 ohadlevy@gmail.com - 0.2rc2-2
|
||
- rebuilt
|
||
* Thu Feb 24 2011 Ohad Levy <ohadlevy@gmail.com> - 0.1.0rc
|
||
- new package built with tito
|
||
* Wed Jan 26 2011 Lukas Zapletal <lzap+git@redhat.com> - 0.1.0
|
||
- new package built with tito
|
rel-eng/releasers.conf | ||
---|---|---|
[koji]
|
||
releaser = tito.release.KojiReleaser
|
||
autobuild_tags = foreman-nightly-rhel6 foreman-nightly-fedora18 foreman-nightly-nonscl-rhel6
|
rel-eng/tito.props | ||
---|---|---|
[globalconfig]
|
||
default_builder = tito.builder.Builder
|
||
default_tagger = tito.tagger.VersionTagger
|
||
changelog_do_not_remove_cherrypick = 0
|
||
changelog_format = %s (%ae)
|
||
|
||
[foreman-nightly-rhel6]
|
||
disttag = .el6
|
||
|
||
[foreman-nightly-fedora18]
|
||
disttag = .fc18
|
||
|
||
[foreman-nightly-nonscl-rhel6]
|
||
disttag = .el6
|
Also available in: Unified diff
refs #5987 - remove unused packaging files