Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
implemented update function: after downloading a release using the download button on the status page the user can choose any of the downloaded versions for a update. this enables also a downgrade to a older version. when the update button is pushed, yacy terminates, installes the choosen version and restarts
orbiter3421c64d26f0
diff --git a/build.properties b/build.propertiesindex 4ceb86f73..05ba7f403 100644--- a/build.properties+++ b/build.properties@@ -3,7 +3,7 @@ javacSource=1.4javacTarget=1.4# Release Configuration-releaseVersion=0.534+releaseVersion=0.535releaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gzproReleaseFile=yacy_pro_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gzreleaseFileParentDir=yacydiff --git a/htroot/Status.html b/htroot/Status.htmlindex 2f57d7a6a..ab9785495 100644--- a/htroot/Status.html+++ b/htroot/Status.html@@ -148,12 +148,12 @@</form>#(candeploy)#::- <form action="Status.html" method="get"><fieldset><legend>System Update</legend><dl><dt>Available Releases</dt>- <dd> <select name="releasedownload">+ <dd><form action="Status.html" method="get">+ <select name="releasedownload">#{availreleases}#<option #(selected)#::selected#(/selected)# value="#[url]#">#[name]#</option>#{/availreleases}#@@ -161,22 +161,22 @@ <button type="submit" name="downloadRelease" value="DownloadRelease"><img src="/env/grafics/lock.gif" alt="" />Download Release- </button><br>- </dd>+ </button><br><br>+ </form></dd><dt>Downloaded Releases</dt>- <dd> <select name="releaseinstall">+ <dd><form action="Steering.html" method="get">+ <select name="releaseinstall">#{downloadedreleases}#<option #(selected)#::selected#(/selected)# value="#[file]#">#[name]#</option>#{/downloadedreleases}#- </select><!--- <button type="submit" name="installRelease" value="InstallRelease">+ </select>#(deployenabled)#::no automated installation on development environments::+ <button type="submit" name="update" value="InstallRelease"><img src="/env/grafics/lock.gif" alt="" />Install Release- </button> -->- </dd>+ </button>#(/deployenabled)#+ </form></dd></dl></fieldset>- </form>#(/candeploy)#<fieldset>diff --git a/htroot/Status.java b/htroot/Status.javaindex 9e2fab7db..da5c0dbfd 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -158,8 +158,9 @@ public class Status {}// version information- prop.put("versionpp", yacy.combined2prettyVersion(sb.getConfig("version","0.1")));-+ String versionstring = yacy.combined2prettyVersion(sb.getConfig("version","0.1"));+ prop.put("versionpp", versionstring);+ boolean devenvironment = versionstring.startsWith("dev");double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));// cut off the SVN Rev in the Versiontry {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {}@@ -168,11 +169,12 @@ public class Status {// 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);-// list downloaded releasesyacyVersion release, dflt;String[] downloaded = sb.releasePath.list();+ prop.put("candeploy", 1);+ prop.put("candeploy_deployenabled", (downloaded.length == 0) ? 0 : ((devenvironment) ? 1 : 2)); // prevent that a developer-version is over-deployed+TreeSet downloadedreleases = new TreeSet();for (int j = 0; j < downloaded.length; j++) {try {@@ -184,44 +186,44 @@ public class Status {}}dflt = (downloadedreleases.size() == 0) ? null : (yacyVersion) downloadedreleases.last();- Iterator i = downloadedreleases.iterator();- int relcount = 0;- while (i.hasNext()) {- release = (yacyVersion) i.next();- prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);- prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);- prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);- relcount++;- }- prop.put("candeploy_downloadedreleases", relcount);-- // list remotely available releases- TreeSet[] releasess = yacyVersion.allReleases(); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}- relcount = 0;- // main- TreeSet releases = releasess[(yacy.pro) ? 0 : 2];- releases.removeAll(downloadedreleases);- i = releases.iterator();- while (i.hasNext()) {- release = (yacyVersion) i.next();- prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);- prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());- prop.put("candeploy_availreleases_" + relcount + "_selected", 0);- relcount++;- }- // dev- dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();- releases = releasess[(yacy.pro) ? 1 : 3];- releases.removeAll(downloadedreleases);- i = releases.iterator();- while (i.hasNext()) {- release = (yacyVersion) i.next();- prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);- prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());- prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);- relcount++;- }- prop.put("candeploy_availreleases", relcount);+ Iterator i = downloadedreleases.iterator();+ int relcount = 0;+ while (i.hasNext()) {+ release = (yacyVersion) i.next();+ prop.put("candeploy_downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);+ prop.put("candeploy_downloadedreleases_" + relcount + "_file", release.name);+ prop.put("candeploy_downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);+ relcount++;+ }+ prop.put("candeploy_downloadedreleases", relcount);++ // list remotely available releases+ TreeSet[] releasess = yacyVersion.allReleases(); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}+ relcount = 0;+ // main+ TreeSet releases = releasess[(yacy.pro) ? 0 : 2];+ releases.removeAll(downloadedreleases);+ i = releases.iterator();+ while (i.hasNext()) {+ release = (yacyVersion) i.next();+ prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);+ prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());+ prop.put("candeploy_availreleases_" + relcount + "_selected", 0);+ relcount++;+ }+ // dev+ dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();+ releases = releasess[(yacy.pro) ? 1 : 3];+ releases.removeAll(downloadedreleases);+ i = releases.iterator();+ while (i.hasNext()) {+ release = (yacyVersion) i.next();+ prop.put("candeploy_availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);+ prop.put("candeploy_availreleases_" + relcount + "_url", release.url.toString());+ prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);+ relcount++;+ }+ prop.put("candeploy_availreleases", relcount);} else {prop.put("candeploy", 0);}diff --git a/htroot/Steering.html b/htroot/Steering.htmlindex 851d5df5b..22c039a6d 100644--- a/htroot/Steering.html+++ b/htroot/Steering.html@@ -6,11 +6,9 @@</head><body style="margin:40px;"><h2>Steering Receipt:</h2>- <p>#(info)#- <b>No information has been submitted</b><br />- Nothing changed- </p>- <p>You can now go back to the <a href="Settings_p.html">Settings</a> page if you want to make more changes.</p>+ #(info)#+ <b>No action submitted</b><br />+ <p>Go back to the <a href="Settings_p.html">Settings</a> page</p>::<b>Your system is not protected by a password</b><br />Please go to the <a href="/Settings_p.html">Settings</a> page and set an administration password.@@ -25,7 +23,11 @@<b>Restart YaCy.</b><br />Application will terminate after working off all scheduled tasks.<br />Then YaCy will restart.<br />- If you can't reach YaCy's interface after 5 minutes restart failed.#(/info)#+ If you can't reach YaCy's interface after 5 minutes restart failed.+::+ <b>Installing release #[release]#</b><br />+ <p>YaCy will be restartet after installation</p>+ #(/info)#</p></body></html>\ No newline at end of filediff --git a/htroot/Steering.java b/htroot/Steering.javaindex bcc19d9dc..8c18766f5 100644--- a/htroot/Steering.java+++ b/htroot/Steering.java@@ -46,6 +46,8 @@// javac -classpath .:../Classes SettingsAck_p.java// if the shell's current path is HTROOT+import java.io.File;+import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;@@ -80,7 +82,19 @@ public class Steering {return prop;}++ if (post.containsKey("update")) {+ boolean devenvironment = yacy.combined2prettyVersion(sb.getConfig("version","0.1")).startsWith("dev");+ String releaseFileName = post.get("releaseinstall", "");+ File releaseFile = new File(sb.getRootPath(), "DATA/RELEASE/" + releaseFileName);+ if ((!devenvironment) && (releaseFile.length() > 0) && (releaseFile.exists())) {+ yacyVersion.deployRelease(releaseFileName);+ }+ prop.put("info", 5);+ prop.put("info_release", releaseFileName);+ return prop;+ }return prop;}diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex d2a4e687a..39896c2fe 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -933,9 +933,19 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser}}- // set auto-updater locations- yacyVersion.latestDevReleaseLocation = getConfig("network.unit.update.location.dev", "");- yacyVersion.latestMainReleaseLocation = getConfig("network.unit.update.location.main", "");+ // set release locations+ int i = 0;+ String location;+ while (true) {+ location = getConfig("network.unit.update.location" + i, "");+ if (location.length() == 0) break;+ try {+ yacyVersion.latestReleaseLocations.add(new URL(location));+ } catch (MalformedURLException e) {+ break;+ }+ i++;+ }// load values from configsthis.plasmaPath = new File(rootPath, getConfig(DBPATH, DBPATH_DEFAULT));@@ -1159,7 +1169,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serint count = 0;try {ArrayList sbQueueEntries = this.sbQueue.list();- for (int i = 0; i < sbQueueEntries.size(); i++) {+ for (i = 0; i < sbQueueEntries.size(); i++) {plasmaSwitchboardQueue.Entry entry = (plasmaSwitchboardQueue.Entry) sbQueueEntries.get(i);if ((entry != null) && (entry.url() != null) && (entry.cacheFile().exists())) {plasmaHTCache.filesInUse.add(entry.cacheFile());@@ -1269,7 +1279,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser// init nameCacheNoCachingListString noCachingList = getConfig(HTTPC_NAME_CACHE_CACHING_PATTERNS_NO,"");String[] noCachingEntries = noCachingList.split(",");- for (int i=0; i<noCachingEntries.length; i++) {+ for (i = 0; i < noCachingEntries.length; i++) {String entry = noCachingEntries[i].trim();httpc.nameCacheNoCachingPatterns.add(entry);}@@ -1320,7 +1330,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serdeployThread(INDEXER, "Parsing/Indexing", "thread that performes document parsing and indexing", "/IndexCreateIndexingQueue_p.html",new serverInstantThread(this, INDEXER_METHOD_START, INDEXER_METHOD_JOBCOUNT, INDEXER_METHOD_FREEMEM), 10000);- for (int i = 1; i < indexing_cluster; i++) {+ for (i = 1; i < indexing_cluster; i++) {setConfig((i + 80) + "_indexing_idlesleep", getConfig(INDEXER_IDLESLEEP, ""));setConfig((i + 80) + "_indexing_busysleep", getConfig(INDEXER_BUSYSLEEP, ""));deployThread((i + 80) + "_indexing", "Parsing/Indexing (cluster job)", "thread that performes document parsing and indexing", null,diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.javaindex 04b64578a..47cbcd5d1 100644--- a/source/de/anomic/yacy/yacyVersion.java+++ b/source/de/anomic/yacy/yacyVersion.java@@ -30,7 +30,9 @@ package de.anomic.yacy;import java.io.File;import java.io.IOException;import java.net.MalformedURLException;+import java.util.ArrayList;import java.util.Comparator;+import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.TreeSet;@@ -59,10 +61,8 @@ public final class yacyVersion implements Comparator, Comparable {// information about latest release, retrieved from download pages// this static information should be overwritten by network-specific locations// for details see yacy.network.unit- private static TreeSet[] allDevReleases = null;- private static TreeSet[] allMainReleases = null;- public static String latestDevReleaseLocation = ""; // will be initialized with value in yacy.network.unit- public static String latestMainReleaseLocation = ""; // will be initialized with value in yacy.network.unit+ private static HashMap /* URL:TreeSet[]*/ latestReleases = new HashMap();+ public static ArrayList latestReleaseLocations /*string*/ = new ArrayList(); // will be initialized with value in yacy.network.unit// class variablespublic float releaseNr;@@ -150,62 +150,38 @@ public final class yacyVersion implements Comparator, Comparable {// generates an anchor string that can be used to embed in an html for direct downloadreturn "<a href=" + this.url.toNormalform() + ">YaCy " + ((this.proRelease) ? "pro release" : "standard release") + " v" + this.releaseNr + ", SVN " + this.svn + "</a>";}- /*- public static yacyVersion latestStandardRelease() {- // get the latest release info from a internet resource- yacyVersion devrel = (yacyVersion) allDevReleases().last();- yacyVersion mainrel = (yacyVersion) allDevReleases().last();- }- public static yacyVersion latestProRelease() {- // get the latest release info from a internet resource- return (yacyVersion) allMainReleases().last();- }- */public static TreeSet[] allReleases() {// join the release infos- // {promainreleases, prodevreleases, stdmainreleases, stddevreleases}- TreeSet[] a = allMainReleases();- TreeSet[] b = allDevReleases();+ // {promainreleases, prodevreleases, stdmainreleases, stddevreleases}+ Object[] a = new Object[latestReleaseLocations.size()];+ for (int j = 0; j < latestReleaseLocations.size(); j++) {+ a[j] = getReleases((URL) latestReleaseLocations.get(j));+ }TreeSet[] r = new TreeSet[4];TreeSet s;for (int i = 0; i < 4; i++) {s = new TreeSet();- if ((b != null) && (b[i] != null)) s.addAll((TreeSet) b[i]);- if ((a != null) && (a[i] != null)) s.addAll((TreeSet) a[i]);+ for (int j = 0; j < a.length; j++) {+ if ((a[j] != null) && (((TreeSet[]) a[j])[i] != null)) s.addAll(((TreeSet[]) a[j])[i]);+ }r[i] = s;}return r;}- private static TreeSet[] allDevReleases() {- // get release info from a internet resource- // {promainreleases, prodevreleases, stdmainreleases, stddevreleases}- if ((allDevReleases == null) ||- ((allDevReleases[0].size() == 0) &&- (allDevReleases[1].size() == 0) &&- (allDevReleases[2].size() == 0) &&- (allDevReleases[3].size() == 0) )) try {- allDevReleases = allReleaseFrom(new URL(latestDevReleaseLocation));- } catch (MalformedURLException e) {- return null;- }- return allDevReleases;- }-- private static TreeSet[] allMainReleases() {+ private static TreeSet[] getReleases(URL location) {// get release info from a internet resource// {promainreleases, prodevreleases, stdmainreleases, stddevreleases}- if ((allMainReleases == null) ||- ((allMainReleases[0].size() == 0) &&- (allMainReleases[1].size() == 0) &&- (allMainReleases[2].size() == 0) &&- (allMainReleases[3].size() == 0) )) try {- allMainReleases = allReleaseFrom(new URL(latestMainReleaseLocation));- } catch (MalformedURLException e) {- return null;+ TreeSet[] latestRelease = (TreeSet[]) latestReleases.get(location);+ if ((latestRelease == null) ||+ ((latestRelease[0].size() == 0) &&+ (latestRelease[1].size() == 0) &&+ (latestRelease[2].size() == 0) &&+ (latestRelease[3].size() == 0) )) {+ latestRelease = allReleaseFrom(location);}- return allMainReleases;+ return latestRelease;}private static TreeSet[] allReleaseFrom(URL url) {@@ -257,7 +233,7 @@ public final class yacyVersion implements Comparator, Comparable {byte[] file = httpc.wget(release.url,release.url.getHost(),- 10000,+ 1000,null,null,plasmaSwitchboard.getSwitchboard().remoteProxyConfig@@ -287,7 +263,13 @@ public final class yacyVersion implements Comparator, Comparable {// start a re-start daemontry {serverLog.logInfo("RESTART", "INITIATED");- String script = "cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring + "while [ -e ../yacy.running ]; do" + serverCore.lfstring + "sleep 1" + serverCore.lfstring + "done" + serverCore.lfstring + "cd ../../" + serverCore.lfstring + "nohup ./startYACY.sh > /dev/null";+ String script =+ "cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring ++ "while [ -e ../yacy.running ]; do" + serverCore.lfstring ++ "sleep 1" + serverCore.lfstring ++ "done" + serverCore.lfstring ++ "cd ../../" + serverCore.lfstring ++ "nohup ./startYACY.sh > /dev/null" + serverCore.lfstring;File scriptFile = new File(plasmaSwitchboard.getSwitchboard().getRootPath(), "DATA/RELEASE/restart.sh");serverSystem.deployScript(scriptFile, script);serverLog.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());@@ -300,8 +282,28 @@ public final class yacyVersion implements Comparator, Comparable {}}- public static void writeDeployScript(String release) {+ public static void deployRelease(String release) {//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 {+ serverLog.logInfo("UPDATE", "INITIATED");+ String script =+ "cd " + plasmaSwitchboard.getSwitchboard().getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring ++ "tar xfz " + release + serverCore.lfstring ++ "while [ -e ../yacy.running ]; do" + serverCore.lfstring ++ "sleep 1" + serverCore.lfstring ++ "done" + serverCore.lfstring ++ "cp -Rf yacy/* ../../" + serverCore.lfstring ++ "rm -Rf yacy" + serverCore.lfstring ++ "cd ../../" + serverCore.lfstring ++ "nohup ./startYACY.sh > /dev/null" + serverCore.lfstring;+ File scriptFile = new File(plasmaSwitchboard.getSwitchboard().getRootPath(), "DATA/RELEASE/update.sh");+ serverSystem.deployScript(scriptFile, script);+ serverLog.logInfo("UPDATE", "wrote update-script to " + scriptFile.getAbsolutePath());+ serverSystem.execAsynchronous(scriptFile);+ serverLog.logInfo("UPDATE", "script is running");+ plasmaSwitchboard.getSwitchboard().terminate(5000);+ } catch (IOException e) {+ serverLog.logSevere("UPDATE", "update failed", e);+ }}}diff --git a/yacy.network.unit b/yacy.network.unitindex 13720a503..53e800a40 100644--- a/yacy.network.unit+++ b/yacy.network.unit@@ -64,8 +64,9 @@ network.unit.bootstrap.seedlist6 = http://www.dc-art.de/yacy/seed.txt# each network may use different yacy distributions.# the auto-updater can access network-specific update locations-network.unit.update.location.dev = http://latest.yacy-forum.net-network.unit.update.location.main = http://yacy.net/yacy/Download.html+network.unit.update.location0 = http://yacy.net/yacy/Download.html+network.unit.update.location1 = http://latest.yacy.net+network.unit.update.location2 = http://latest.yacy-forum.net# properties for in-protocol response authentification:#network.unit.protocol.control = uncontrolled