Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

* add build target "deb" to create debian packages from svn still needs testing...

f1oric2d49cc01e77
diff --git a/addon/yacyInit.m4 b/addon/yacyInit.m4
new file mode 100644
index 000000000..630f44ae0
--- /dev/null
+++ b/addon/yacyInit.m4
@@ -0,0 +1,289 @@
+dnl automatically generate initscripts for different distros
+dnl by Florian Richter <[email protected]>
+dnl
+define(helptext, `Usage:
+ m4 -DopenSUSE yacyInit.m4 > yacy.init.openSUSE
+or: m4 -DDebian yacyInit.m4 > yacy.init.Debian
+or: m4 -DFedora yacyInit.m4 > yacy.init.Fedora
+or: m4 -DArchLinux yacyInit.m4 > yacy.init.ArchLinux
+')dnl
+ifdef(`openSUSE',, ifdef(`ArchLinux',, ifdef(`Fedora',, ifdef(`Debian',,````errprint(helptext())m4exit(0)''''))))dnl
+#!/bin/bash
+#
+# init script for YaCy
+#
+# Provided by Matthias Kempka, 26.12.2004
+# Updated by Florian Richter, 17.7.2008
+#
+ifdef(`Fedora', `
+# chkconfig: - 20 80
+# description: Distributed web search engine
+')dnl
+### BEGIN INIT INFO
+# Provides: yacy
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 3 5
+# Default-Stop:
+# Short-Description: Distributed web search engine
+# Description: yacy is a distributed search engine
+# config-file is /etc/yacy/yacy.conf
+### END INIT INFO
+
+NAME="yacy"
+DESC="YaCy P2P Web Search"
+YACY_HOME="/usr/share/yacy"
+DATA_HOME="/var/lib/yacy"
+PID_FILE="/var/run/yacy.pid"
+USER=yacy
+
+
+# Set this to the maximum number of seconds the script should try to shutdown
+# yacy. You might want to increase this on slower peers or for bigger
+# databases.
+SHUTDOWN_TIMEOUT=50
+
+# Default niceness if not set in config file
+NICE_VAL=0
+
+ifdef(`openSUSE', `dnl
+. /etc/rc.status
+rc_reset
+
+')dnl
+ifdef(`ArchLinux', `dnl
+[ -f /etc/profile.d/jre.sh ] && . /etc/profile.d/jre.sh
+
+[ -f /etc/conf.d/yacy ] && . /etc/conf.d/yacy
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+')dnl
+ifdef(`Fedora', `dnl
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
+')dnl
+if [ "$(id -u)" != "0" ] ; then
+ echo "please run this script as root!"
+ exit 4
+fi
+
+JAVA=$(which java 2> /dev/null)
+if [ ! -x "$JAVA" ]; then
+ echo "The 'java' command is not executable."
+ echo "Either you have not installed java or it is not in your PATH"
+ if [ $1 == "stop" -a $2 == "--force" ]; then exit 0; else exit 1; fi
+fi
+
+cd $YACY_HOME
+
+JAVA_ARGS="-Djava.awt.headless=true"
+#get javastart args
+if [ -f DATA/SETTINGS/yacy.conf ]
+then
+ # startup memory
+ for i in Xmx Xms; do
+ j=$(grep javastart_$i DATA/SETTINGS/yacy.conf | sed 's/^[^=]*=//');
+ if [ -n $j ]; then JAVA_ARGS="-$j $JAVA_ARGS"; fi;
+ done
+
+ # Priority
+ j=$(grep javastart_priority DATA/SETTINGS/yacy.conf | sed 's/^[^=]*=//');
+
+ if [ ! -z "$j" ];then
+ if [ -n $j ]; then NICE_VAL=$j; fi;
+ fi
+
+fi
+
+# generating the proper classpath
+CP=/usr/share/java/yacy.jar:$YACY_HOME/htroot
+for name in /usr/share/java/yacy/*.jar; do
+ CP=$CP:$name
+done
+ifdef(`Debian', `
+#CP="$CP:/usr/share/java/javatar.jar"
+#CP="$CP:/usr/share/java/commons-httpclient.jar"
+#CP="$CP:/usr/share/java/commons-logging.jar"
+#CP="$CP:/usr/share/java/commons-codec.jar"
+#CP="$CP:/usr/share/java/commons-discovery.jar"
+#CP="$CP:/usr/share/java/pdfbox.jar"
+#CP="$CP:/usr/share/java/jakarta-poi.jar"
+#CP="$CP:/usr/share/java/oro.jar"
+#CP="$CP:/usr/share/java/xerces.jar"
+#CP="$CP:/usr/share/java/jsch.jar"
+')dnl
+CLASSPATH=$CP
+
+if [ -f $PID_FILE ]; then
+ pid=$(cat "$PID_FILE")
+ pidno=$( ps ax | grep "$pid" | awk '{ print $1 }' | grep "$pid" )
+fi
+
+RETVAL=0
+case "$1" in
+ start)
+ if [ -n "$pidno" ]; then
+ echo "already running"
+ exit 0
+ fi
+ifdef(`openSUSE', `
+ echo -n "Starting $DESC. "
+')dnl
+ifdef(`Debian', `
+ echo -n "Starting $DESC: "
+')dnl
+ifdef(`Fedora', `
+ echo -n "Starting $DESC: "
+')dnl
+ifdef(`ArchLinux', `
+ stat_busy "Starting YaCy Daemon"
+')dnl
+ ARGS="$JAVA_ARGS -classpath $CLASSPATH yacy"
+define(`START_YACY_WITH_START_STOP_DAEMON',`
+ start-stop-daemon --start --background --make-pidfile --chuid $USER\
+ --pidfile $PID_FILE --chdir $YACY_HOME --startas $JAVA\
+ --nicelevel $NICE_VAL\
+ -- $ARGS
+')dnl
+define(`START_YACY_WITH_SUDO', `
+ cmdline="$JAVA $ARGS"
+ nice -$NICE_VAL sudo -u yacy $cmdline &>/dev/null &
+ echo $! >$PID_FILE
+')dnl
+ifdef(`ArchLinux', `START_YACY_WITH_SUDO()')dnl
+ifdef(`openSUSE', `START_YACY_WITH_SUDO()')dnl
+ifdef(`Fedora', `START_YACY_WITH_SUDO()')dnl
+ifdef(`Debian', `START_YACY_WITH_START_STOP_DAEMON()')dnl
+ sleep 1
+ ps ax|grep "^ *$(cat $PID_FILE)" > /dev/null
+ if [ "$?" == "0" ]; then
+ifdef(`Debian', `
+ echo "$NAME."
+')dnl
+ifdef(`Fedora', `
+ echo
+')dnl
+ifdef(`openSUSE', `
+ rc_status -v
+')dnl
+ifdef(`ArchLinux', `
+ add_daemon yacy
+ stat_done
+')dnl
+ RETVAL=0
+ else
+ifdef(`Debian', `
+ echo "failed."
+')dnl
+ifdef(`Fedora', `
+ echo
+')dnl
+ifdef(`openSUSE', `
+ rc_failed
+ rc_status -v
+')dnl
+ifdef(`ArchLinux', `
+ stat_fail
+')dnl
+ RETVAL=1
+ fi
+ ;;
+
+ stop)
+ if [ -n "$pidno" ]; then
+ifdef(`openSUSE', `
+ echo -n "Shutting down $DESC: "
+')dnl
+ifdef(`Debian', `
+ echo -n "Stopping $DESC: "
+')dnl
+ifdef(`Fedora', `
+ echo -n "Stopping $DESC: "
+')dnl
+ifdef(`ArchLinux', `
+ stat_busy "Stopping YaCy Daemon"
+')dnl
+ cd $YACY_HOME
+ cmdline="$JAVA $JAVA_ARGS -cp $CLASSPATH yacy -shutdown"
+ sudo -u yacy $cmdline &>/dev/null &
+ shutdown_pid=$!
+
+ timeout=$SHUTDOWN_TIMEOUT
+ while [ -n "$pidno" ]; do
+ let timeout=$timeout-1
+ if [ $timeout -eq 0 ]; then
+define(`KILL_YACY_WITH_START_STOP_DAEMON',`dnl
+ start-stop-daemon --stop --pidfile $PID_FILE --oknodo
+')dnl
+define(`KILL_YACY_WITH_SUDO', `dnl
+ kill -9 $pid &>/dev/null
+')dnl
+ifdef(`ArchLinux', KILL_YACY_WITH_SUDO())dnl
+ifdef(`openSUSE', `KILL_YACY_WITH_SUDO()')dnl
+ifdef(`Fedora', `KILL_YACY_WITH_SUDO()')dnl
+ifdef(`Debian', `KILL_YACY_WITH_START_STOP_DAEMON()')dnl
+ # dont forget to kill shutdown process if necessary
+ shutdown_pid=$( ps ax | grep $shutdown_pid | awk '{ print $1 }' | grep $shutdown_pid )
+ if [ -n "$shutdown_pid" ] ; then
+ kill -9 $shutdown_pid
+ fi
+ break
+ fi
+ echo -n "."
+ sleep 1
+ pidno=$( ps ax | grep $pid | awk '{ print $1 }' | grep $pid )
+ done
+ rm $PID_FILE
+ cd - >/dev/null
+ifdef(`Debian', `
+ echo "$NAME."
+')dnl
+ifdef(`Fedora', `
+ echo
+')dnl
+ifdef(`openSUSE', `
+ rc_status -v
+')dnl
+ifdef(`ArchLinux', `
+ rm_daemon yacy
+ stat_done
+')dnl
+ exit 0
+ fi
+ echo "not running."
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ $0 restart
+ ;;
+ status)
+ # needed by Fedora
+ if [ -n "$pidno" ]; then
+ echo "is running."
+ exit 0
+ else
+ if [ -f $PID_FILE ]; then
+ echo "is dead, but pid file exists."
+ exit 1
+ else
+ echo "is not running."
+ exit 3
+ fi
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}" >&2
+ exit 1
+ ;;
+esac
+
+exit $RETVAL
diff --git a/build.xml b/build.xml
index 7eb3b918f..0864b6b35 100644
--- a/build.xml
+++ b/build.xml
@@ -769,6 +769,7 @@
<include name="yacy.stopwords"/>
<include name="yacy.parser"/>
<include name="httpd.mime"/>
+ <include name="build.properties"/>
</fileset>
</copy>
@@ -811,9 +812,9 @@
<fileset dir=".">
<include name="readme.txt"/>
<include name="gpl.txt"/>
- <include name="ChangeLog"/>
- <include name="AUTHORS"/>
- <include name="COPYRIGHT"/>
+ <include name="ChangeLog"/>
+ <include name="AUTHORS"/>
+ <include name="COPYRIGHT"/>
<include name="NOTICE"/>
</fileset>
</copy>
@@ -1055,4 +1056,19 @@
<delete dir="${release_windows}" failonerror="false" />
</target>
+ <target name="deb" depends="init" description="Creates a debian package">
+ <!-- replacing the old with the new revision number -->
+ <replaceregexp file="debian/changelog"
+ match="yacy \(.*\) unstable; urgency=low"
+ replace="yacy (${releaseVersion}svn${baseRevisionNr}) unstable; urgency=low" />
+
+ <!-- build debian package -->
+ <exec executable="dpkg-buildpackage">
+ <arg value="-b"/>
+ <arg value="-rfakeroot"/>
+ </exec>
+ <replaceregexp file="debian/changelog"
+ match="yacy \(.*\) unstable; urgency=low"
+ replace="yacy (*auto-svn-version*) unstable; urgency=low" />
+ </target>
</project>
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 000000000..a507b234d
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,6 @@
+yacy (*auto-svn-version*) unstable; urgency=low
+
+ * SVN Update
+
+ -- root <root@debian> Wed, 28 May 2008 19:15:45 +0200
+
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 000000000..7ed6ff82d
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 000000000..d0b85dccf
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,21 @@
+Source: yacy
+Section: network
+Priority: extra
+Maintainer: root <root@debian>
+Build-Depends: ant, sun-java6-jdk, debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: yacy
+Architecture: any
+Depends: sun-java6-jre, sudo
+Description: P2P Web Search Engine
+ YaCy is a Java-based peer-2-peer search engine.
+ It provoids a personal websearch engine, which is
+ free and decentral. The search index is distributed
+ over a peer2peer network. It contains a crawler, an indexer
+ and an own database engine. In the robinson-modus, yacy
+ can be used for a topic-oriented search protal or to index an
+ intranet.
+ Also included in YaCy is a Wiki, a P2P-message-system, a
+ Blog and a bookmark management system.
+Homepage: http://yacy.net/
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 000000000..4809d0b59
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,30 @@
+This package was debianized by Florian Richter <[email protected]> on
+Wed, 28 May 2008 19:15:45 +0200.
+
+It was downloaded from <http://yacy.net>
+
+Upstream Author: Michael Peter Christen <[email protected]>
+
+Copyright: (C) by Michael Peter Christen; [email protected]
+
+License:
+All parts of the software known as YaCy are covered under the
+terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or
+(at your option) any later version unless stated otherwise.
+
+You should have received a copy of the GNU General Public License
+along with this software; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+People who have contributed to this software in addition to those
+mentioned in the source code or other files belonging to YaCy:
+
+Jakub Steiner (bookmarkpriv.png, bookmarkpub.png)
+
+
+The Debian packaging is (C) 2008, Florian Richter <[email protected]> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
+
+Some libraries of yacy have different licenses. Please have a look at lib/ and libx/
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 000000000..1aa304e84
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,61 @@
+#!/bin/sh
+# postinst script for yacy
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+add_group_if_missing() {
+ if [ -x /usr/sbin/adduser ]; then
+ if ! id -g yacy >/dev/null 2>&1; then
+ addgroup --gid 265 --force-badname yacy
+ fi
+ fi
+}
+
+add_user_if_missing() {
+ if [ -x /usr/sbin/adduser ]; then
+ if ! id -u yacy > /dev/null 2>&1; then
+ adduser --system --home /var/lib/yacy --no-create-home \
+ --uid 264 --gid 265 --disabled-password --force-badname \
+ yacy
+ fi
+ fi
+}
+
+add_group_if_missing
+add_user_if_missing
+
+chown yacy:yacy -R /var/lib/yacy
+
+case "$1" in
+ configure)
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100644
index 000000000..c32ea85c7
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,40 @@
+#!/bin/sh
+# postrm script for yacy
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+
+case "$1" in
+ purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/preinst b/debian/preinst
new file mode 100644
index 000000000..bd16c2f4c
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,37 @@
+#!/bin/sh
+# preinst script for yacy
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ install|upgrade)
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
index 000000000..8cadc5263
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,40 @@
+#!/bin/sh
+# prerm script for yacy
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <prerm> `remove'
+# * <old-prerm> `upgrade' <new-version>
+# * <new-prerm> `failed-upgrade' <old-version>
+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+# * <deconfigured's-prerm> `deconfigure' `in-favour'
+# <package-being-installed> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..5e6241813
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,54 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+configure: configure-stamp
+configure-stamp:
+ # Add here commands to configure the package.
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ ant all
+ m4 -DDebian addon/yacyInit.m4 >debian/yacy.init
+
+clean:
+ ant clean
+ rm -f debian/yacy.init
+ dh_clean
+
+install: build
+ # Add here commands to install the package into debian/yacy.
+ ant installonlinux -DDESTDIR=$(CURDIR)/debian/yacy
+ mkdir -p $(CURDIR)/debian/yacy/usr/share/java/yacy/
+ cp lib/*.jar $(CURDIR)/debian/yacy/usr/share/java/yacy/
+ cp libx/*.jar $(CURDIR)/debian/yacy/usr/share/java/yacy/
+ #cp -r classes $(CURDIR)/debian/yacy/usr/share/java/yacy/
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_installchangelogs
+ dh_installdocs
+ dh_installinit
+# dh_installman
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure