Revision 501a98b4
Added by Todd Zullinger about 14 years ago
- ID 501a98b4a2b52962166bbf8fd952770a95734780
extras/spec/foreman.spec | ||
---|---|---|
%define name foreman
|
||
%define homedir /usr/share/%{name}
|
||
%define confdir extras/spec
|
||
%global homedir %{_datadir}/%{name}
|
||
%global confdir extras/spec
|
||
|
||
Name: %{name}
|
||
Name: foreman
|
||
Version: 0.1.4
|
||
Release: 3%{?dist}
|
||
Release: 4%{?dist}
|
||
Summary: Systems Management web application
|
||
Group: Administration Tools
|
||
License: GPLv2+
|
||
|
||
Group: Applications/System
|
||
License: GPLv3+
|
||
URL: http://theforeman.org
|
||
Source0: http://github.com/ohadlevy/foreman/tarball/foreman-0.1-4.tar.bz2
|
||
Source0: http://github.com/ohadlevy/%{name}/tarball/%{name}-0.1-4.tar.bz2
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||
|
||
BuildArch: noarch
|
||
|
||
Requires: ruby(abi) = 1.8
|
||
Requires: rubygems
|
||
Requires: rubygem(rack) >= 1.0.1
|
||
Requires: rubygem(rake) >= 0.8.3
|
||
Requires: puppet >= 0.24.4
|
||
Requires: rubygem(sqlite3-ruby)
|
||
Requires(pre): shadow-utils
|
||
Requires(post): chkconfig
|
||
Requires(preun): chkconfig
|
||
Requires(preun): initscripts
|
||
Requires(postun): initscripts
|
||
|
||
Packager: Ohad Levy <ohadlevy@gmail.com>
|
||
|
||
%description
|
||
Foreman is aimed to be a Single Address For All Machines Life Cycle Management.
|
||
Foreman is based on Ruby on Rails, and this package bundle all Rails and plugins required for Foreman to work
|
||
Foreman is based on Ruby on Rails, and this package bundles Rails and all
|
||
plugins required for Foreman to work.
|
||
|
||
%prep
|
||
%setup -q -n %{name}
|
||
... | ... | |
%build
|
||
|
||
%install
|
||
%{__rm} -rf %{buildroot}
|
||
%{__install} -p -d -m0755 %{buildroot}%{_datadir}/%{name}
|
||
%{__install} -p -d -m0755 %{buildroot}%{_defaultdocdir}/%{name}-%{version}
|
||
%{__install} -Dp -m0644 %{confdir}/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||
%{__install} -Dp -m0755 %{confdir}/%{name}.init %{buildroot}%{_initrddir}/%{name}
|
||
%{__cp} -p -r app config db extras lib public Rakefile script vendor %{buildroot}%{_datadir}/%{name}
|
||
%{__chmod} a+x %{buildroot}%{_datadir}/%{name}/script/{console,dbconsole,runner}
|
||
%{__rm} -rf %{buildroot}%{_datadir}/%{name}/extras/{jumpstart,spec,puppet}
|
||
%{__rm} -rf %{buildroot}%{_datadir}/%{name}/VERSION
|
||
%{__mkdir} %{buildroot}%{_datadir}/%{name}/{tmp,log}
|
||
rm -rf %{buildroot}
|
||
install -d -m0755 %{buildroot}%{_datadir}/%{name}
|
||
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}
|
||
install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}
|
||
install -d -m0755 %{buildroot}%{_localstatedir}/run/%{name}
|
||
install -d -m0750 %{buildroot}%{_localstatedir}/log/%{name}
|
||
|
||
install -Dp -m0644 %{confdir}/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||
install -Dp -m0755 %{confdir}/%{name}.init %{buildroot}%{_initrddir}/%{name}
|
||
cp -p -r app config extras lib Rakefile script vendor %{buildroot}%{_datadir}/%{name}
|
||
chmod a+x %{buildroot}%{_datadir}/%{name}/script/{console,dbconsole,runner}
|
||
rm -rf %{buildroot}%{_datadir}/%{name}/extras/{jumpstart,spec}
|
||
rm -rf %{buildroot}%{_datadir}/%{name}/VERSION
|
||
|
||
# Move config files to %{_sysconfdir}
|
||
mv %{buildroot}%{_datadir}/%{name}/config/email.yaml.example %{buildroot}%{_datadir}/%{name}/config/email.yaml
|
||
for i in database.yml environment.rb email.yaml settings.yaml; do
|
||
mv %{buildroot}%{_datadir}/%{name}/config/$i %{buildroot}%{_sysconfdir}/%{name}
|
||
ln -sv %{_sysconfdir}/%{name}/$i %{buildroot}%{_datadir}/%{name}/config/$i
|
||
done
|
||
|
||
# Put db in %{_localstatedir}/lib/%{name}/db
|
||
cp -pr db/migrate %{buildroot}%{_datadir}/%{name}
|
||
mkdir %{buildroot}%{_localstatedir}/lib/%{name}/db
|
||
ln -sv %{_localstatedir}/lib/%{name}/db %{buildroot}%{_datadir}/%{name}/db
|
||
ln -sv %{_datadir}/%{name}/migrate %{buildroot}%{_localstatedir}/lib/%{name}/db/migrate
|
||
|
||
# Put HTML %{_localstatedir}/lib/%{name}/public
|
||
cp -pr public %{buildroot}%{_localstatedir}/lib/%{name}/
|
||
ln -sv %{_localstatedir}/lib/%{name}/public %{buildroot}%{_datadir}/%{name}/public
|
||
|
||
# Put logs in %{_localstatedir}/log/%{name}
|
||
ln -sv %{_localstatedir}/log/%{name} %{buildroot}%{_datadir}/%{name}/log
|
||
|
||
# Put tmp files in %{_localstatedir}/run/%{name}
|
||
ln -sv %{_localstatedir}/run/%{name} %{buildroot}%{_datadir}/%{name}/tmp
|
||
|
||
# Create a script for migrating the database
|
||
cat << \EOF > %{buildroot}%{_datadir}/%{name}/extras/dbmigrate
|
||
#!/bin/sh
|
||
cd && /usr/bin/rake db:migrate RAILS_ENV=production
|
||
EOF
|
||
chmod a+x %{buildroot}%{_datadir}/%{name}/extras/dbmigrate
|
||
|
||
%clean
|
||
%{__rm} -rf %{buildroot}
|
||
rm -rf %{buildroot}
|
||
|
||
%files
|
||
%defattr(-,root,root,0755)
|
||
%{_datadir}/%{name}
|
||
%doc README
|
||
%{_initrddir}/foreman
|
||
%config(noreplace) %{homedir}/config/settings.yaml
|
||
%config(noreplace) %{homedir}/config/database.yml
|
||
%{_datadir}/%{name}
|
||
%{_initrddir}/%{name}
|
||
%config(noreplace) %{_sysconfdir}/%{name}
|
||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||
%attr(-,%{name},%{name}) %{_localstatedir}/lib/%{name}
|
||
%attr(-,%{name},%{name}) %{_localstatedir}/log/%{name}
|
||
%attr(-,%{name},%{name}) %{_localstatedir}/run/%{name}
|
||
|
||
%pre
|
||
# Add the "foreman" user and group
|
||
/usr/sbin/useradd -c "Foreman" -s /sbin/nologin -r -d %{homedir} -G puppet %{name} 2> /dev/null || :
|
||
getent group %{name} >/dev/null || groupadd -r %{name}
|
||
getent passwd %{name} >/dev/null || \
|
||
useradd -r -g %{name} -G puppet -d %{homedir} -s /sbin/nologin -c "Foreman" %{name}
|
||
exit 0
|
||
|
||
%post
|
||
# fixing some permissions issues and file duplication warning while creating the RPM.
|
||
for dir in db tmp log public config/environment.rb; do
|
||
/bin/chown -R foreman:root %{homedir}/$dir
|
||
done
|
||
/bin/chown foreman:root %{homedir}
|
||
/bin/chown -R root:root %{homedir}/db/migrate
|
||
/sbin/chkconfig --add %{name} || ::
|
||
|
||
# install foreman (but don't activate)
|
||
/sbin/chkconfig --add %{name}
|
||
# initialize/migrate the database (defaults to SQLITE3)
|
||
su - foreman -s /bin/bash -c %{_datadir}/%{name}/extras/dbmigrate >/dev/null 2>&1 || :
|
||
|
||
# migrate the SQLite database
|
||
su - foreman -s /bin/bash -c 'cd ; /usr/bin/rake db:migrate RAILS_ENV=production > /dev/null'
|
||
%preun
|
||
if [ $1 -eq 0 ] ; then
|
||
/sbin/service %{name} stop >/dev/null 2>&1
|
||
/sbin/chkconfig --del %{name} || :
|
||
fi
|
||
|
||
%postun
|
||
if [ $1 -ge 1 ] ; then
|
||
# Restart the service
|
||
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
|
||
fi
|
||
|
||
%changelog
|
||
* Fri Apr 30 2010 Todd Zullinger <tmz@pobox.com> - 0.1.4-4
|
||
- Rework %%install for better FHS compliance
|
||
- Misc. adjustments to match Fedora/EPEL packaging guidelines
|
||
- Update License field to GPLv3+ to match README
|
||
- Use foreman as the primary group for the foreman user instead of puppet
|
||
- This breaks compatibility with previous RPM, as directories can't be replaced with links easily.
|
||
|
||
* Thu Apr 19 2010 Ohad Levy <ohadlevy@gmail.com> - 0.1-4-3
|
||
- added status to startup script
|
||
- removed puppet module from the RPM
|
||
* Thu Apr 12 2010 Ohad Levy <ohadlevy@gmail.com> - 0.1-4-2
|
||
|
||
* Thu Apr 12 2010 Ohad Levy <ohadlevy@gmail.com> - 0.1.4-2
|
||
- Added startup script for built in webrick server
|
||
- Changed foreman user default shell to /sbin/nologin and is now part of the puppet group
|
||
- defaults to sqlite database
|
||
* Thu Apr 6 2010 Ohad Levy <ohadlevy@gmail.com> - 0.1-4-1
|
||
|
||
* Thu Apr 6 2010 Ohad Levy <ohadlevy@gmail.com> - 0.1.4-1
|
||
- Initial release.
|
Also available in: Unified diff
fixes #214packaging: Misc. improvements to rpm spec file
- Rework %%install for better FHS compliance
- Misc. adjustments to match Fedora/EPEL packaging guidelines
- Update License field to GPLv3+ to match README
This does not allow a clean upgrade from 0.1.4-3 rpm, as directories
can't be converted to links.