From 1d166bc7765bfb8f344fdb03625c0cd2f0f4cf7e Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 19 Sep 2012 10:25:47 -0400
Subject: [PATCH] Added deb package generation.

---
 build.xml                 | 15 +++++++++++++++
 packages/DEBIAN/changelog |  6 ++++++
 packages/DEBIAN/conffiles |  1 +
 packages/DEBIAN/control   | 14 ++++++++++++++
 packages/DEBIAN/copyright |  8 ++++++++
 packages/DEBIAN/postinst  | 36 ++++++++++++++++++++++++++++++++++++
 6 files changed, 80 insertions(+)
 create mode 100644 packages/DEBIAN/changelog
 create mode 100644 packages/DEBIAN/conffiles
 create mode 100644 packages/DEBIAN/control
 create mode 100644 packages/DEBIAN/copyright
 create mode 100644 packages/DEBIAN/postinst

diff --git a/build.xml b/build.xml
index 45fbc185c43..c132d9bebac 100644
--- a/build.xml
+++ b/build.xml
@@ -160,6 +160,21 @@
     <exec command="git archive master --format=tar --prefix=vufind-${version}/ -o ${builddir}/packages/vufind-${version}.tar" />
     <exec command="gzip ${builddir}/packages/vufind-${version}.tar" />
 
+    <!-- build the DEB package -->
+    <mkdir dir="${builddir}/export/vufind/usr/local" />
+    <copy todir="${builddir}/export/vufind/usr/local/vufind2">
+      <fileset dir="${srcdir}">
+        <include name="**" />
+        <exclude name=".git" />
+      </fileset>
+    </copy>
+    <move file="${builddir}/export/vufind/usr/local/vufind2/packages/DEBIAN" todir="${builddir}/export/vufind" includeemptydirs="true"/>
+    <exec command="chmod 0775 ${builddir}/export/vufind/DEBIAN/postinst" />
+    <exec command="dpkg-deb -b ${builddir}/export/vufind ${builddir}/packages/vufind_${version}.deb" />
+
+    <!-- clean up -->
+    <delete dir="${builddir}/export" includeemptydirs="true" failonerror="true" />
+
     <!-- report success -->
     <echo message="Packages successfully generated in ${builddir}/packages" />
   </target>
diff --git a/packages/DEBIAN/changelog b/packages/DEBIAN/changelog
new file mode 100644
index 00000000000..04a04ec9f4e
--- /dev/null
+++ b/packages/DEBIAN/changelog
@@ -0,0 +1,6 @@
+vufind 2.0beta distribution; urgency=low
+
+  * VuFind 2.0beta release (see http://vufind.org/wiki/vufind2:changelog for details) 
+
+ -- maintainer VuFind Project Administration Team <vufind-admins@lists.sourceforge.net>  Mo 1 Oct 2012 12:07:33 UTC
+
diff --git a/packages/DEBIAN/conffiles b/packages/DEBIAN/conffiles
new file mode 100644
index 00000000000..d05e80e4240
--- /dev/null
+++ b/packages/DEBIAN/conffiles
@@ -0,0 +1 @@
+/usr/local/vufind2/solr/biblio/conf/solrconfig.xml
diff --git a/packages/DEBIAN/control b/packages/DEBIAN/control
new file mode 100644
index 00000000000..2caa712d0d1
--- /dev/null
+++ b/packages/DEBIAN/control
@@ -0,0 +1,14 @@
+Package: vufind2
+Version: 2.0beta
+Section: World Wide Web
+Priority: Optional
+Architecture: all
+Depends: default-jdk, apache2, php5, php5-dev, php-pear, php5-intl, php5-ldap, php5-mysql, php5-xsl, php5-gd, mysql-server
+Maintainer: VuFind Project Administration Team <vufind-admins@lists.sourceforge.net>
+Homepage: http://vufind.org/
+Description: A library resource discovery portal
+ VuFind is a library resource portal designed and developed for libraries by
+ libraries. The goal of VuFind is to enable your users to search and browse
+ through all of your library's resources by replacing the traditional OPAC.
+ You can find more information at http://vufind.org.
+
diff --git a/packages/DEBIAN/copyright b/packages/DEBIAN/copyright
new file mode 100644
index 00000000000..3fec040f010
--- /dev/null
+++ b/packages/DEBIAN/copyright
@@ -0,0 +1,8 @@
+This package was debianized by Gerald Steilen <steilen@gbv.de>
+
+Mon 5 Jul 2010 08:47:18 UTC
+
+It was downloaded from: http://vufind.org/
+
+Upstream Author(s): VuFind Project Administration Team <vufind-admins@lists.sourceforge.net> 
+
diff --git a/packages/DEBIAN/postinst b/packages/DEBIAN/postinst
new file mode 100644
index 00000000000..1087b1514be
--- /dev/null
+++ b/packages/DEBIAN/postinst
@@ -0,0 +1,36 @@
+#!/bin/bash
+ 
+# Script for installing VuFind 2.x on Ubuntu
+# This does not include the OCI8 libraries
+
+# Update the profile file to set required environment variables (unless they are
+# already defined there):
+grep -q JAVA_HOME= /etc/profile
+if [ $? -ne 0 ]; then
+    sudo sh -c 'echo export JAVA_HOME=\"/usr/lib/jvm/default-java\" >> /etc/profile'
+fi
+grep -q VUFIND_HOME= /etc/profile
+if [ $? -ne 0 ]; then
+    sudo sh -c 'echo export VUFIND_HOME=\"/usr/local/vufind2\"  >> /etc/profile'
+fi
+grep -q VUFIND_LOCAL_DIR= /etc/profile
+if [ $? -ne 0 ]; then
+    sudo sh -c 'echo export VUFIND_LOCAL_DIR=\"$VUFIND_HOME/local\"  >> /etc/profile'
+fi
+source /etc/profile
+
+# Turn on mod_rewrite in Apache.
+sudo a2enmod rewrite
+ 
+# Set permissions so Apache can write to certain directories.
+sudo chown -R www-data:www-data $VUFIND_LOCAL_DIR/cache
+sudo chown -R www-data:www-data $VUFIND_LOCAL_DIR/config
+ 
+# set up Apache for VuFind and reload configuration
+sudo ln -s $VUFIND_LOCAL_DIR/httpd-vufind.conf /etc/apache2/conf.d/vufind
+sudo /etc/init.d/apache2 force-reload
+ 
+# Finalize the installation 
+cd $VUFIND_HOME
+sudo php install.php --use-defaults
+
-- 
GitLab