Skip to content

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

improvments to debianpackage: * autoupdate completely disabled, display hint * restart-button in interface works!

f1ori8931c8d6b481
diff --git a/addon/yacyInit.m4 b/addon/yacyInit.m4
index d2188e9e0..3f837da92 100644
--- a/addon/yacyInit.m4
+++ b/addon/yacyInit.m4
@@ -178,7 +178,7 @@ ifdef(`ArchLinux', `
')dnl
ARGS="$JAVA_ARGS -classpath $CLASSPATH yacy"
define(`START_YACY_WITH_START_STOP_DAEMON',`
- start-stop-daemon --start --background --make-pidfile --chuid $USER\
+ /sbin/start-stop-daemon --start --background --make-pidfile --chuid $USER\
--pidfile $PID_FILE --chdir $YACY_HOME --startas $JAVA\
--nicelevel $NICE_VAL\
-- $ARGS
diff --git a/build.xml b/build.xml
index 236902f87..46c95e91a 100644
--- a/build.xml
+++ b/build.xml
@@ -57,7 +57,8 @@
<property name="defaults" location="defaults"/>
<!-- variables for installonlinux target-->
<property name="DESTDIR" value="DESTDIR"/>
- <property name="pkgmanager" value="false"/>
+ <property name="PKGMANAGER" value="false"/>
+ <property name="RESTARTCMD" value="/etc/init.d/yacy restart"/>
<!-- determining if the .svn directory exists -->
<condition property="svnEntriesFileExists">
@@ -146,11 +147,10 @@
<!-- YaCy root directory -->
<filter token="REPL_YACY_ROOT_DIR" value="${yacyroot}"/>
- <filter token="REPL_PKGMANAGER" value="${pkgmanager}"/>
+ <filter token="REPL_PKGMANAGER" value="${PKGMANAGER}"/>
+ <filter token="REPL_RESTARTCMD" value="${RESTARTCMD}"/>
- <!-- deleting old file -->
- <delete file="${build}/yacy.java" failonerror="false"/>
- <copy file="${src}/yacy.java" tofile="${build}/yacy.java" overwrite="true" filtering="true" />
+ <!-- apply replacments -->
<delete file="${build}/de/anomic/yacy/yacyBuildProperties.java" failonerror="false"/>
<copy file="${src}/de/anomic/yacy/yacyBuildProperties.java" tofile="${build}/de/anomic/yacy/yacyBuildProperties.java" overwrite="true" filtering="true" />
@@ -197,11 +197,12 @@
<pathelement location="${lib}/xerces.jar" />
</path>
- <!-- compiling yacy.java -->
+ <!-- compiling yacyBuildProperties.java -->
<javac srcdir="${build}" destdir="${build}" sourcepath="${src}"
- includes="yacy.java,de/anomic/yacy/yacyBuildProperties.java"
+ includes="de/anomic/yacy/yacyBuildProperties.java"
source="${javacSource}" target="${javacTarget}">
<classpath refid="project.class.path" />
+ <!--<compilerarg value="-Xlint"/>-->
</javac>
<delete file="${build}/BuildProperties.java" />
@@ -211,6 +212,7 @@
debug="true" debuglevel="lines,vars,source"
source="${javacSource}" target="${javacTarget}">
<classpath refid="project.class.path" />
+ <!--<compilerarg value="-Xlint"/>-->
</javac>
<!-- compiling htroot, htroot/yacy and htroot/htdocsdefault -->
@@ -218,7 +220,9 @@
excludes="processing/**"
classpathref="project.class.path"
debug="true" debuglevel="lines,vars,source"
- source="${javacSource}" target="${javacTarget}"/>
+ source="${javacSource}" target="${javacTarget}">
+ <!--<compilerarg value="-Xlint"/>-->
+ </javac>
</target>
<target name="compileHtdocsWWW" depends="compileMain" description="Compiling and zipping userspecific servlets">
@@ -240,7 +244,6 @@
</target>
<target name="all" depends="compileMain">
- <delete file="${build}/yacy.java" />
</target>
<target name="copyMain4Dist" depends="compileMain">
@@ -591,7 +594,7 @@
<!-- make clean -->
<target name="clean" description="make clean">
<delete dir="${release_main}" failonerror="false"/>
- <delete file="${build}/yacy.java" failonerror="false"/>
+ <delete file="${build}/de/anomic/yacy/yacyBuildProperties.java" failonerror="false"/>
<delete file="yacy.jar" failonerror="false"/>
<delete file="yacy.exe" failonerror="false"/>
<delete file="${lib}/svnRevNr.jar" failonerror="false"/>
@@ -624,7 +627,6 @@
<include name="yacy.stopwords"/>
<include name="yacy.parser"/>
<include name="httpd.mime"/>
- <include name="build.properties"/>
</fileset>
</copy>
diff --git a/debian/changelog b/debian/changelog
index fc54839a7..a507b234d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-yacy (0.91svn6172) unstable; urgency=low
+yacy (*auto-svn-version*) unstable; urgency=low
* SVN Update
diff --git a/debian/control b/debian/control
index d78a9aea2..347838fad 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Standards-Version: 3.7.2
Package: yacy
Architecture: all
-Depends: java-virtual-machine, java2-runtime, sudo
+Depends: java-virtual-machine, java2-runtime, sudo, debconf
Description: P2P Web Search Engine
YaCy is a Java-based peer-2-peer search engine.
It provoids a personal websearch engine, which is
diff --git a/debian/rules b/debian/rules
index cb2cfa196..f110a8b1a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,7 +19,7 @@ build: build-stamp
build-stamp: configure-stamp
# build yacy
- ant build-jar
+ ant build-jar -DPKGMANAGER=true
m4 -DDebian addon/yacyInit.m4 >debian/yacy.init
clean:
diff --git a/htroot/ConfigUpdate_p.html b/htroot/ConfigUpdate_p.html
index ad75cac6f..ba66f77c4 100644
--- a/htroot/ConfigUpdate_p.html
+++ b/htroot/ConfigUpdate_p.html
@@ -110,8 +110,11 @@
</dl>
</fieldset>
::
+ You installed YaCy with a package manage. To update YaCy, use the packager manager:<p>
+ Debian: apt-get update yacy
+ ::
#(/candeploy)#
#%env/templates/footer.template%#
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/htroot/ConfigUpdate_p.java b/htroot/ConfigUpdate_p.java
index 1756f2205..58865fa5d 100644
--- a/htroot/ConfigUpdate_p.java
+++ b/htroot/ConfigUpdate_p.java
@@ -35,6 +35,7 @@ import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.serverSystem;
+import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.yacyVersion;
@@ -46,6 +47,19 @@ public class ConfigUpdate_p {
final serverObjects prop = new serverObjects();
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
+ // set if this should be visible
+ if (yacyBuildProperties.isPkgManager()) {
+ prop.put("candeploy", "2");
+ return prop;
+ } else if (serverSystem.canExecUnix || serverSystem.isWindows) {
+ // we can deploy a new system with (i.e.)
+ // cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy
+ prop.put("candeploy", "1");
+ } else {
+ prop.put("candeploy", "0");
+ }
+
+
prop.put("candeploy_configCommit", "0");
prop.put("candeploy_autoUpdate", "0");
@@ -107,7 +121,7 @@ public class ConfigUpdate_p {
sb.getLog().logInfo("AUTO-UPDATE: downloading more recent release " + updateVersion.getUrl());
final File downloaded = updateVersion.downloadRelease();
prop.putHTML("candeploy_autoUpdate_downloadedRelease", updateVersion.getName());
- final boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");
+ final boolean devenvironment = new File(sb.getRootPath(), ".svn").exists();
if (devenvironment) {
sb.getLog().logInfo("AUTO-UPDATE: omiting update because this is a development environment");
prop.put("candeploy_autoUpdate", "3");
@@ -133,20 +147,11 @@ public class ConfigUpdate_p {
}
}
- // set if this should be visible
- if (serverSystem.canExecUnix || serverSystem.isWindows) {
- // we can deploy a new system with (i.e.)
- // cd DATA/RELEASE;tar xfz $1;cp -Rf yacy/* ../../;rm -Rf yacy
- prop.put("candeploy", "1");
- } else {
- prop.put("candeploy", "0");
- }
-
// version information
- final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
+ final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
prop.putHTML("candeploy_versionpp", versionstring);
- final boolean devenvironment = versionstring.startsWith("dev");
- double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));
+ final boolean devenvironment = new File(sb.getRootPath(), ".svn").exists();
+ double thisVersion = Double.parseDouble(yacyBuildProperties.getVersion());
// cut off the SVN Rev in the Version
try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (final NumberFormatException e) {}
diff --git a/htroot/Status.java b/htroot/Status.java
index 5cea1c217..6d970992c 100644
--- a/htroot/Status.java
+++ b/htroot/Status.java
@@ -44,6 +44,7 @@ import de.anomic.server.serverObjects;
import de.anomic.server.serverProcessor;
import de.anomic.server.serverSwitch;
import de.anomic.tools.Formatter;
+import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyVersion;
@@ -138,13 +139,10 @@ public class Status {
// version information
- final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
+ //final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
+ final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
prop.put("versionpp", versionstring);
- double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));
- // cut off the SVN Rev in the Version
- try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (final NumberFormatException e) {}
-
// place some more hints
if ((adminaccess) && (sb.getThread(plasmaSwitchboardConstants.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0) && (sb.getThread(plasmaSwitchboardConstants.INDEXER).getJobCount() == 0)) {
prop.put("hintCrawlStart", "1");
diff --git a/htroot/Steering.java b/htroot/Steering.java
index af60c9494..18e5b3beb 100644
--- a/htroot/Steering.java
+++ b/htroot/Steering.java
@@ -67,7 +67,7 @@ public class Steering {
}
if (post.containsKey("update")) {
- final boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");
+ final boolean devenvironment = new File(sb.getRootPath(), ".svn").exists();
final String releaseFileName = post.get("releaseinstall", "");
final File releaseFile = new File(sb.getRootPath(), "DATA/RELEASE/".replace("/", File.separator) + releaseFileName);
if ((!devenvironment) && (releaseFile.length() > 0) && (releaseFile.exists())) {
diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.java
index c687b5518..b79f88aae 100644
--- a/htroot/Threaddump_p.java
+++ b/htroot/Threaddump_p.java
@@ -45,6 +45,7 @@ import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.tools.nxTools;
+import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacyVersion;
public class Threaddump_p {
@@ -62,7 +63,7 @@ public class Threaddump_p {
prop.put("dump", "1");
// Thread dump
final Date dt = new Date();
- final String versionstring = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1"));
+ final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
bufferappend(buffer, plain, "************* Start Thread Dump " + dt + " *******************");
bufferappend(buffer, plain, "");
diff --git a/htroot/User.java b/htroot/User.java
index da9bc1c0e..e8e5aff23 100644
--- a/htroot/User.java
+++ b/htroot/User.java
@@ -150,7 +150,7 @@ public class User{
sb.userDB.adminLogout(userDB.getLoginToken(requestHeader.getHeaderCookies()));
}
//XXX: This should not be needed anymore, because of isLoggedout
- if(! ((String) requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){
+ if(! (requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).equals("xxxxxx")){
prop.put("AUTHENTICATE","admin log-in");
}
}
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.java
index f9682343b..026ab9398 100644
--- a/htroot/ViewImage.java
+++ b/htroot/ViewImage.java
@@ -62,7 +62,7 @@ public class ViewImage {
String urlString = post.get("url", "");
final String urlLicense = post.get("code", "");
- final boolean auth = ((String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); // handle access rights
+ final boolean auth = (header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true); // handle access rights
yacyURL url = null;
if ((urlString.length() > 0) && (auth)) try {
diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java
index a71a25393..8ad3aa512 100644
--- a/htroot/ViewProfile.java
+++ b/htroot/ViewProfile.java
@@ -56,7 +56,7 @@ public class ViewProfile {
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
final int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0);
prop.put("display", display);
- final String hash = (post == null) ? null : (String) post.get("hash");
+ final String hash = (post == null) ? null : post.get("hash");
if ((hash == null) || (sb.peers == null)) {
// wrong access
diff --git a/htroot/api/version.java b/htroot/api/version.java
index 67b421dad..fb08b5fa3 100644
--- a/htroot/api/version.java
+++ b/htroot/api/version.java
@@ -3,6 +3,7 @@
import de.anomic.http.httpRequestHeader;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
+import de.anomic.yacy.yacyBuildProperties;
public class version {
@@ -10,9 +11,9 @@ public class version {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- prop.put("version", env.getConfig("version", "0.0"));
- prop.put("svnRev", env.getConfig("svnRevision", "0"));
- prop.put("buildDate", env.getConfig("vdate", "19700101"));
+ prop.put("versionstring", yacyBuildProperties.getLongVersion());
+ prop.put("svnRev", yacyBuildProperties.getSVNRevision());
+ prop.put("buildDate", yacyBuildProperties.getBuildDate());
// return rewrite properties
return prop;
}
diff --git a/htroot/api/version.xml b/htroot/api/version.xml
index 004341959..d75a5be48 100644
--- a/htroot/api/version.xml
+++ b/htroot/api/version.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<version>
- <number>#[version]#</number>
+ <number>#[versionstring]#</number>
<svnRevision>#[svnRev]#</svnRevision>
<buildDate>#[buildDate]#</buildDate>
</version>
diff --git a/htroot/opensearchdescription.java b/htroot/opensearchdescription.java
index 8c03eaa9d..ed1cc1725 100644
--- a/htroot/opensearchdescription.java
+++ b/htroot/opensearchdescription.java
@@ -39,7 +39,7 @@ public class opensearchdescription {
String promoteSearchPageGreeting = env.getConfig(plasmaSwitchboardConstants.GREETING, "");
if (env.getConfigBool(plasmaSwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
- String thisaddress = (String) header.get("Host", "localhost");
+ String thisaddress = header.get("Host", "localhost");
if (thisaddress.indexOf(":") == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));
int compareyacy = 0;
diff --git a/htroot/www/welcome.java b/htroot/www/welcome.java
index 48d64694f..92b0a67be 100644
--- a/htroot/www/welcome.java
+++ b/htroot/www/welcome.java
@@ -62,7 +62,7 @@ public class welcome {
prop.put("hostip", "Unknown Host Exception");
}
prop.put("port", serverCore.getPortNr(env.getConfig("port","8080")));
- prop.put("clientip", (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, ""));
+ prop.put("clientip", header.get(httpHeader.CONNECTION_PROP_CLIENTIP, ""));
final String peertype = (sb.peers.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));
diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java
index 206309594..25a4f2049 100644
--- a/htroot/yacy/hello.java
+++ b/htroot/yacy/hello.java
@@ -72,8 +72,8 @@ public final class hello {
final String countStr = post.get("count", "0");
int count = 0;
try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (final NumberFormatException e) {count = 0;}
-// final Date remoteTime = yacyCore.parseUniversalDate((String) post.get(MYTIME)); // read remote time
- final String clientip = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendum
+// final Date remoteTime = yacyCore.parseUniversalDate(post.get(MYTIME)); // read remote time
+ final String clientip = header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "<unknown>"); // read an artificial header addendum
final InetAddress ias = serverDomains.dnsResolve(clientip);
if (ias == null) {
prop.put("message", "cannot resolve your IP from your reported location " + clientip);
@@ -97,7 +97,7 @@ public final class hello {
// if ((properTest != null) && (! properTest.substring(0,1).equals("IP"))) { return null; }
// we easily know the caller's IP:
- final String userAgent = (String) header.get(httpHeader.USER_AGENT, "<unknown>");
+ final String userAgent = header.get(httpHeader.USER_AGENT, "<unknown>");
final String reportedip = remoteSeed.getIP();
final String reportedPeerType = remoteSeed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);
final float clientversion = remoteSeed.getVersion();
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index a71047296..0c3035ed8 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -602,7 +602,7 @@ public class yacysearch {
prop.put("depth", "0");
// adding some additional properties needed for the rss feed
- String hostName = (String) header.get("Host", "localhost");
+ String hostName = header.get("Host", "localhost");
if (hostName.indexOf(":") == -1) hostName += ":" + serverCore.getPortNr(env.getConfig("port", "8080"));
prop.put("searchBaseURL", "http://" + hostName + "/yacysearch.html");
prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index d3f47f77f..23937919d 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -62,7 +62,7 @@ public class yacysearchitem {
final String eventID = post.get("eventID", "");
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
final int item = post.getInt("item", -1);
- final boolean auth = ((String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true);
+ final boolean auth = (header.get(httpHeader.CONNECTION_PROP_CLIENTIP, "")).equals("localhost") || sb.verifyAuthentication(header, true);
final int display = (post == null) ? 0 : post.getInt("display", 0);
// default settings for blank item
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index a48a8007a..5bfa67de7 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -95,6 +95,7 @@ import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
import de.anomic.server.servletProperties;
+import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
import de.anomic.ymage.ymageMatrix;
@@ -785,7 +786,7 @@ public final class httpdFileHandler {
return;
}
// add the application version, the uptime and the client name to every rewrite table
- templatePatterns.put(servletProperties.PEER_STAT_VERSION, switchboard.getConfig("version", ""));
+ templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion());
templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic"));
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((plasmaSwitchboard) switchboard).peers.myID());
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index e5bdcee7e..1feaf6979 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -1557,7 +1557,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
// there is a version that is more recent. Load it and re-start with it
log.logInfo("AUTO-UPDATE: downloading more recent release " + updateVersion.getUrl());
final File downloaded = updateVersion.downloadRelease();
- final boolean devenvironment = yacyVersion.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");
+ final boolean devenvironment = new File(this.getRootPath(), ".svn").exists();
if (devenvironment) {
log.logInfo("AUTO-UPDATE: omiting update because this is a development environment");
} else if ((downloaded == null) || (!downloaded.exists()) || (downloaded.length() == 0)) {
@@ -1948,13 +1948,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
public int adminAuthenticated(final httpRequestHeader requestHeader) {
// authorization for localhost, only if flag is set to grant localhost access as admin
- final String clientIP = (String) requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "");
+ final String clientIP = requestHeader.get(httpHeader.CONNECTION_PROP_CLIENTIP, "");
final String refererHost = requestHeader.refererHost();
final boolean accessFromLocalhost = serverCore.isLocalhost(clientIP) && (refererHost.length() == 0 || serverCore.isLocalhost(refererHost));
if (getConfigBool("adminAccountForLocalhost", false) && accessFromLocalhost) return 3; // soft-authenticated for localhost
// get the authorization string from the header
- final String authorization = ((String) requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).trim().substring(6);
+ final String authorization = (requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx")).trim().substring(6);
// security check against too long authorization strings
if (authorization.length() > 256) return 0;
@@ -1964,7 +1964,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
if (accessFromLocalhost && (adminAccountBase64MD5.equals(authorization))) return 3; // soft-authenticated for localhost
// authorization by hit in userDB
- if (userDB.hasAdminRight((String) requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"), requestHeader.getHeaderCookies())) return 4; //return, because 4=max
+ if (userDB.hasAdminRight(requestHeader.get(httpRequestHeader.AUTHORIZATION, "xxxxxx"), requestHeader.getHeaderCookies())) return 4; //return, because 4=max
// authorization with admin keyword in configuration
return httpd.staticAdminAuthenticated(authorization, this);
diff --git a/source/de/anomic/yacy/yacyBuildProperties.java b/source/de/anomic/yacy/yacyBuildProperties.java
index 4bd0339e4..cf08d3941 100644
--- a/source/de/anomic/yacy/yacyBuildProperties.java
+++ b/source/de/anomic/yacy/yacyBuildProperties.java
@@ -1,4 +1,8 @@
package de.anomic.yacy;
+
+import java.util.Locale;
+import de.anomic.yacy.yacyBuildProperties;
+
/**
* Properties set when compiling this release/version
*/
@@ -6,12 +10,32 @@ public class yacyBuildProperties {
private yacyBuildProperties() {
}
- public static String getSVNVersion() {
+ /**
+ * returns the SVN-Revision Number as a String
+ */
+ public static String getSVNRevision() {
return "@REPL_REVISION_NR@";
}
+ /**
+ * returns the version String (e. g. 0.9)
+ */
public static String getVersion() {
- return "@VERSION@";
+ return "@REPL_VERSION@";
+ }
+
+ /**
+ * returns the long version String (e. g. 0.9106712)
+ */
+ public static String getLongVersion() {
+ return String.format(Locale.US, "%.3f%05d", Double.valueOf(getVersion()), Integer.valueOf(getSVNRevision()));
+ }
+
+ /**
+ * returns the date, when this release was build
+ */
+ public static String getBuildDate() {
+ return "@REPL_DATE@";
}
/**
@@ -21,4 +45,12 @@ public class yacyBuildProperties {
public static boolean isPkgManager() {
return "@REPL_PKGMANAGER@".equals("true");
}
+
+ /**
+ * returns command to use to restart the YaCy daemon,
+ * when YaCy was installed with a packagemanger
+ */
+ public static String getRestartCmd() {
+ return "@REPL_RESTARTCMD@";
+ }
}
diff --git a/source/de/anomic/yacy/yacyRelease.java b/source/de/anomic/yacy/yacyRelease.java
index 8765ecae6..2eb07cb17 100644
--- a/source/de/anomic/yacy/yacyRelease.java
+++ b/source/de/anomic/yacy/yacyRelease.java
@@ -60,6 +60,7 @@ import de.anomic.tools.CryptoLib;
import de.anomic.tools.SignatureOutputStream;
import de.anomic.tools.tarTools;
import de.anomic.yacy.logging.Log;
+import de.anomic.yacy.yacyBuildProperties;
public final class yacyRelease extends yacyVersion {
@@ -99,6 +100,12 @@ public final class yacyRelease extends yacyVersion {
// if false, null is returned
final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ // check if release was installed by packagemanager
+ if (yacyBuildProperties.isPkgManager()) {
+ yacyCore.log.logInfo("rulebasedUpdateInfo: package manager is used for update");
+ return null;
+ }
+
// check if update process allows update retrieve
final String process = sb.getConfig("update.process", "manual");
if ((!manual) && (!process.equals("auto"))) {
@@ -423,7 +430,22 @@ public final class yacyRelease extends yacyVersion {
}
- if (serverSystem.canExecUnix) {
+ if (yacyBuildProperties.isPkgManager()) {
+ // start a re-start daemon
+ try {
+ Log.logInfo("RESTART", "INITIATED");
+ final String script =
+ "#!/bin/sh" + serverCore.LF_STRING +
+ yacyBuildProperties.getRestartCmd() + " >/var/lib/yacy/RELEASE/log" + serverCore.LF_STRING;
+ final File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh");
+ serverSystem.deployScript(scriptFile, script);
+ Log.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
+ serverSystem.execAsynchronous(scriptFile);
+ Log.logInfo("RESTART", "script is running");
+ } catch (final IOException e) {
+ Log.logSevere("RESTART", "restart failed", e);
+ }
+ } else if (serverSystem.canExecUnix) {
// start a re-start daemon
try {
Log.logInfo("RESTART", "INITIATED");
@@ -452,6 +474,9 @@ public final class yacyRelease extends yacyVersion {
* @param releaseFile
*/
public static void deployRelease(final File releaseFile) {
+ if(yacyBuildProperties.isPkgManager()) {
+ return;
+ }
//byte[] script = ("cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + ";while [ -e ../yacy.running ]; do sleep 1;done;tar xfz " + release + ";cp -Rf yacy/* ../../;rm -Rf yacy;cd ../../;startYACY.sh").getBytes();
try {
final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java
index 9ccbc9be6..b7290dcf7 100644
--- a/source/de/anomic/yacy/yacyVersion.java
+++ b/source/de/anomic/yacy/yacyVersion.java
@@ -88,12 +88,11 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
if (thisVersion == null) {
final plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
if (sb == null) return null;
- final boolean full = new File(sb.getRootPath(), "libx").exists();
thisVersion = new yacyVersion(
- "yacy" + ((full) ? "" : "_emb") +
- "_v" + sb.getConfig("version", "0.1") + "_" +
- sb.getConfig("vdate", "19700101") + "_" +
- sb.getConfig("svnRevision", "0") + ".tar.gz");
+ "yacy" +
+ "_v" + yacyBuildProperties.getVersion() + "_" +
+ yacyBuildProperties.getBuildDate() + "_" +
+ yacyBuildProperties.getSVNRevision() + ".tar.gz");
}
return thisVersion;
}
@@ -203,4 +202,4 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
return name;
}
-}
\ No newline at end of file
+}
diff --git a/source/yacy.java b/source/yacy.java
index 08a2491f8..f279173de 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -78,6 +78,7 @@ import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.Tray;
import de.anomic.yacy.yacyURL;
+import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.yacyVersion;
import de.anomic.yacy.logging.Log;
@@ -121,11 +122,11 @@ import de.anomic.yacy.logging.Log;
public final class yacy {
// static objects
- public static final String vString = "@REPL_VERSION@";
+ public static final String vString = yacyBuildProperties.getVersion();
public static double version = 0.1;
public static boolean pro = false;
- public static final String vDATE = "@REPL_DATE@";
+ public static final String vDATE = yacyBuildProperties.getBuildDate();
public static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]";
public static final String hline = "-------------------------------------------------------------------------------";
@@ -155,9 +156,6 @@ public final class yacy {
* @param startupFree free memory at startup time, to be used later for statistics
*/
private static void startup(final File homePath, final long startupMemFree, final long startupMemTotal) {
- int oldRev=0;
- int newRev=0;
-
try {
// start up
System.out.println(copyright);
@@ -232,41 +230,15 @@ public final class yacy {
sb.setConfig("htTemplatePath", "htroot/env/templates");
sb.setConfig("parseableExt", "html,htm,txt,php,shtml,asp");
- // if we are running an SVN version, we try to detect the used svn revision now ...
- final Properties buildProp = new Properties();
- final File buildPropFile = new File(homePath,"build.properties");
- try {
- buildProp.load(new FileInputStream(buildPropFile));
- } catch (final Exception e) {
- Log.logWarning("STARTUP", buildPropFile.toString() + " not found in settings path");
- }
-
- oldRev=Integer.parseInt(sb.getConfig("svnRevision", "0"));
- try {
- if (buildProp.containsKey("releaseNr")) {
- // this normally looks like this: $Revision$
- final String svnReleaseNrStr = buildProp.getProperty("releaseNr");
- final Pattern pattern = Pattern.compile("\\$Revision:\\s(.*)\\s\\$",Pattern.DOTALL+Pattern.CASE_INSENSITIVE);
- final Matcher matcher = pattern.matcher(svnReleaseNrStr);
- if (matcher.find()) {
- final String svrReleaseNr = matcher.group(1);
- try {
- try {version = Double.parseDouble(vString);} catch (final NumberFormatException e) {version = (float) 0.1;}
- version = yacyVersion.versvn2combinedVersion(version, Integer.parseInt(svrReleaseNr));
- } catch (final NumberFormatException e) {}
- sb.setConfig("svnRevision", svrReleaseNr);
- }
- }
- newRev=Integer.parseInt(sb.getConfig("svnRevision", "0"));
- } catch (final Exception e) {
- System.err.println("Unable to determine the currently used SVN revision number.");
- }
+ int oldRev = Integer.parseInt(sb.getConfig("svnRevision", "0"));
+ sb.setConfig("svnRevision", yacyBuildProperties.getSVNRevision());
+ int newRev = Integer.parseInt(yacyBuildProperties.getSVNRevision());
- sb.setConfig("version", Double.toString(version));
- sb.setConfig("vString", yacyVersion.combined2prettyVersion(Double.toString(version)));
- sb.setConfig("vdate", (vDATE.startsWith("@")) ? DateFormatter.formatShortDay() : vDATE);
+ // TODO: remove!
+ //sb.setConfig("version", Double.toString(version));
+ //sb.setConfig("vString", yacyVersion.combined2prettyVersion(Double.toString(version)));
+ //sb.setConfig("vdate", (vDATE.startsWith("@")) ? DateFormatter.formatShortDay() : vDATE);
sb.setConfig("applicationRoot", homePath.toString());
- Log.logConfig("STARTUP", "YACY Version: " + version + ", Built " + sb.getConfig("vdate", "00000000"));
yacyVersion.latestRelease = version;
// read environment