From 429ef07be346ce63ef3bae95a12d2825a019cae2 Mon Sep 17 00:00:00 2001
From: Jochen Schalanda <jochen@schalanda.name>
Date: Wed, 10 Nov 2010 15:00:37 +0300
Subject: [PATCH] Improvements for Debian package:
   * Added installation of cronjobs in /etc/cron.d/foreman
   * Fixed dependencies of foreman-{mysql,pgsql,sqlite3}

---
 extras/debian/changelog      |   14 ++++++++++++++
 extras/debian/control        |   15 +++++++++------
 extras/debian/foreman.cron.d |   25 +++++++++++++++++++++++++
 extras/debian/postinst       |    2 +-
 extras/debian/postrm         |    2 +-
 extras/debian/preinst        |    2 +-
 extras/debian/prerm          |    2 +-
 extras/debian/rules          |    1 -
 8 files changed, 52 insertions(+), 11 deletions(-)
 create mode 100644 extras/debian/foreman.cron.d

diff --git a/extras/debian/changelog b/extras/debian/changelog
index 51840aa..3f7a4b8 100644
--- a/extras/debian/changelog
+++ b/extras/debian/changelog
@@ -1,3 +1,17 @@
+foreman (0.1.6-1) experimental; urgency=low
+
+  * New upstream release
+
+ -- Jochen Schalanda <jochen@schalanda.name>  Mon, 10 Nov 2010 14:32:22 +0300
+
+foreman (0.1.5-3) experimental; urgency=low
+
+  * Added cron support
+  * Fixed dependencies of foreman-sqlite3, foreman-mysql and foreman-pgsql
+  * Relaxed dependencies of foreman
+
+ -- Jochen Schalanda <jochen@schalanda.name>  Mon, 08 Nov 2010 16:28:17 +0300
+
 foreman (0.1.5-2) experimental; urgency=low
 
   * Bugfixes, added support for dbconfig-common and split packages.
diff --git a/extras/debian/control b/extras/debian/control
index 1e62c55..c9a430c 100644
--- a/extras/debian/control
+++ b/extras/debian/control
@@ -9,9 +9,9 @@ Homepage: http://www.theforeman.org/
 Package: foreman
 Architecture: all
 Pre-Depends: debconf
-Depends: ruby, ruby1.8 (>= 1.8.7), rubygems, rubygems1.8, rake (>=0.8.1), libjs-prototype (>= 1.6.0), libjs-scriptaculous (>= 1.8.1), puppet (>=0.24.4), dbconfig-common, foreman-sqlite3 | foreman-mysql | foreman-pgsql, ${misc:Depends}
-Recommends: libfcgi-ruby, libapache2-mod-passenger | libapache2-mod-fcgid
-Suggests: thin | mongrel | httpd-cgi
+Depends: ruby, ruby1.8 (>= 1.8.7), rubygems, rubygems1.8, rake (>=0.8.1), libjs-prototype (>= 1.6.0), libjs-scriptaculous (>= 1.8.1), puppet (>=0.24.4), dbconfig-common, ${misc:Depends}
+Suggests: thin | mongrel | httpd-cgi, libfcgi-ruby, libapache2-mod-passenger | libapache2-mod-fcgid
+Enhances: puppet
 Description: Systems management web interface
  Foreman is aimed to be a single address for all machines life cycle management.
  .
@@ -32,7 +32,8 @@ Description: Systems management web interface
 
 Package: foreman-mysql
 Architecture: all
-Depends: libdbd-mysql-ruby, mysql-client | virtual-mysql-client, ${misc:Depends}
+Depends: foreman, libdbd-mysql-ruby, ${misc:Depends}
+Recommends: mysql-client | virtual-mysql-client
 Suggests: mysql-server
 Description: metapackage providing MySQL dependencies for Foreman
  This package only provides MySQL dependencies for Foreman, a
@@ -43,7 +44,8 @@ Description: metapackage providing MySQL dependencies for Foreman
 
 Package: foreman-pgsql
 Architecture: all
-Depends: libdbd-pg-ruby, postgresql-client, ${misc:Depends}
+Depends: foreman, libdbd-pg-ruby, ${misc:Depends}
+Recommends: postgresql-client
 Suggests: postgresql
 Description: metapackage providing PostgreSQL dependencies for Foreman
  This package provides PostgreSQL dependencies for Foreman, a
@@ -54,7 +56,8 @@ Description: metapackage providing PostgreSQL dependencies for Foreman
 
 Package: foreman-sqlite3
 Architecture: all
-Depends: libdbd-sqlite3-ruby, sqlite3, ${misc:Depends}
+Depends: foreman, libdbd-sqlite3-ruby, ${misc:Depends}
+Recommends: sqlite3
 Description: metapackage providing sqlite dependencies for Foreman
  This package provides sqlite dependencies for Foreman, a
  flexible systems management web application. Install this
diff --git a/extras/debian/foreman.cron.d b/extras/debian/foreman.cron.d
new file mode 100644
index 0000000..c6b5134
--- /dev/null
+++ b/extras/debian/foreman.cron.d
@@ -0,0 +1,25 @@
+SHELL=/bin/sh
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+RAILS_ENV=production
+FOREMAN_HOME=/usr/share/foreman
+
+# Clean up the session entries in the database
+15 23 * * *     foreman    cd ${FOREMAN_HOME} && /usr/bin/rake db:sessions:clear
+
+# Send out daily summary
+0 7 * * *       foreman    cd ${FOREMAN_HOME} && /usr/bin/rake reports:summarize
+
+# Expire old reports
+30 7 * * *      foreman    cd ${FOREMAN_HOME} && /usr/bin/rake reports:expire
+
+
+# Only use the following cronjob if you're using stored configs!
+# Populate hosts
+*/30 * * * *    foreman    cd ${FOREMAN_HOME} && /usr/bin/rake puppet:migrate:populate_hosts
+
+
+# Only uncomment the following cronjob if you're not using stored configs!
+# Send facts to Foreman.
+#*/2 * * * *    puppet     ${FOREMAN_HOME}/extras/puppet/foreman/files/push_facts.rb
+
diff --git a/extras/debian/postinst b/extras/debian/postinst
index cd2787d..996f2e7 100755
--- a/extras/debian/postinst
+++ b/extras/debian/postinst
@@ -4,7 +4,7 @@
 # see: dh_installdeb(1)
 
 set -e
-#set -x
+if [ ! -z "${DEBUG}" ]; then set -x; fi
 
 . /usr/share/debconf/confmodule
 . /usr/share/dbconfig-common/dpkg/postinst
diff --git a/extras/debian/postrm b/extras/debian/postrm
index 8ec6ce0..7fd8626 100755
--- a/extras/debian/postrm
+++ b/extras/debian/postrm
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 set -e
-#set -x
+if [ ! -z "${DEBUG}" ]; then set -x; fi
 
 if [ -f /usr/share/debconf/confmodule ]; then
         . /usr/share/debconf/confmodule
diff --git a/extras/debian/preinst b/extras/debian/preinst
index b661f20..d878475 100755
--- a/extras/debian/preinst
+++ b/extras/debian/preinst
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 set -e
-#set -x
+if [ ! -z "${DEBUG}" ]; then set -x; fi
 
 #DEBHELPER#
 
diff --git a/extras/debian/prerm b/extras/debian/prerm
index dd0edef..2545ffa 100755
--- a/extras/debian/prerm
+++ b/extras/debian/prerm
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 set -e
-#set -x
+if [ ! -z "${DEBUG}" ]; then set -x; fi
 
 . /usr/share/debconf/confmodule
 . /usr/share/dbconfig-common/dpkg/prerm
diff --git a/extras/debian/rules b/extras/debian/rules
index 1448c3d..caf98ee 100755
--- a/extras/debian/rules
+++ b/extras/debian/rules
@@ -28,7 +28,6 @@ binary-install/foreman::
 	# Remove executable bit from files where not necessary
 	chmod a-x debian/foreman/usr/share/foreman/extras/jumpstart/rules.ok
 	chmod a-x debian/foreman/usr/share/foreman/vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
-	chmod a-x debian/foreman/usr/share/foreman/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/*.rb
 	chmod a-x debian/foreman/usr/share/foreman/vendor/rails/actionpack/lib/action_controller/request.rb
 	chmod a-x debian/foreman/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
 	chmod a-x debian/foreman/usr/share/foreman/vendor/rails/activerecord/lib/active_record/*.rb
-- 
1.7.0.4

