Skip to content

Commit

Permalink
rm unused build properties PKGMANAGER, RESTARTCMD, DESTDIR
Browse files Browse the repository at this point in the history
PKGMANAGER is always false, thus the java code wrapped in
if statements for this property is dead code and can also
be removed.

The Debian packaging removed in c4659f0
did set the PKGMANAGER property to true. When we do distro
packages again, we can revisit this commit and redo it with
property files instead.

RESTARTCMD is only used inside those dead code.

DESTDIR is never used even in the build.xml
  • Loading branch information
thkoch2001 committed Jul 10, 2022
1 parent 4503b9e commit 5725582
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 127 deletions.
7 changes: 0 additions & 7 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@
<property name="jquery" location="htroot/jquery/"/>
<property name="portalsearch" location="htroot/portalsearch/"/>
<property name="img-2" location="htroot/yacy/ui/img-2"/>

<!-- variables for installonlinux target-->
<property name="DESTDIR" value="DESTDIR"/>
<property name="PKGMANAGER" value="false"/>
<property name="RESTARTCMD" value="/etc/init.d/yacy restart"/>

<!-- determining if the .git directory exists -->
<condition property="isGit">
Expand Down Expand Up @@ -162,8 +157,6 @@

<!-- YaCy root directory -->
<filter token="REPL_YACY_ROOT_DIR" value="${yacyroot}"/>
<filter token="REPL_PKGMANAGER" value="${PKGMANAGER}"/>
<filter token="REPL_RESTARTCMD" value="${RESTARTCMD}"/>

<!-- apply replacments -->
<copy file="${src}/net/yacy/peers/operation/yacyBuildProperties.java.template" tofile="${src}/net/yacy/peers/operation/yacyBuildProperties.java" overwrite="true" filtering="true" />
Expand Down
5 changes: 1 addition & 4 deletions htroot/ConfigUpdate_p.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
final Switchboard sb = (Switchboard) env;

// set if this should be visible
if (yacyBuildProperties.isPkgManager()) {
prop.put("candeploy", "2");
return prop;
} else if (OS.isWindows && sb.appPath.toString().indexOf("Program Files") > -1) {
if (OS.isWindows && sb.appPath.toString().indexOf("Program Files") > -1) {
prop.put("candeploy", "3");
return prop;
} else if (OS.canExecUnix || OS.isWindows) {
Expand Down
1 change: 1 addition & 0 deletions source/net/yacy/peers/operation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yacyBuildProperties.java
72 changes: 0 additions & 72 deletions source/net/yacy/peers/operation/yacyBuildProperties.java

This file was deleted.

19 changes: 0 additions & 19 deletions source/net/yacy/peers/operation/yacyBuildProperties.java.template
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,4 @@ public final class yacyBuildProperties {
}
return "@REPL_DATE@";
}

/**
* determines, if this release was compiled and installed
* by a package manager
*/
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() {
if ("@REPL_RESTARTCMD@".contains("@")) {
return "echo 'error'";
}
return "@REPL_RESTARTCMD@";
}
}
26 changes: 1 addition & 25 deletions source/net/yacy/peers/operation/yacyRelease.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ public static final yacyRelease rulebasedUpdateInfo(final boolean manual) {
// if false, null is returned
final Switchboard sb = Switchboard.getSwitchboard();

// check if release was installed by packagemanager
if (yacyBuildProperties.isPkgManager()) {
Network.log.info("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"))) {
Expand Down Expand Up @@ -445,22 +439,7 @@ public static void restart() {
}
}

if (yacyBuildProperties.isPkgManager()) {
// start a re-start daemon
try {
ConcurrentLog.info("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.getDataPath(), "DATA/RELEASE/restart.sh");
OS.deployScript(scriptFile, script);
ConcurrentLog.info("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
OS.execAsynchronous(scriptFile);
ConcurrentLog.info("RESTART", "script is running");
} catch (final IOException e) {
ConcurrentLog.severe("RESTART", "restart failed", e);
}
} else if (OS.canExecUnix) {
if (OS.canExecUnix) {
// start a re-start daemon
try {
ConcurrentLog.info("RESTART", "INITIATED");
Expand Down Expand Up @@ -492,9 +471,6 @@ public static void restart() {
*/
public static boolean deployRelease(final File releaseFile) {
boolean restartTriggered = false;
if (yacyBuildProperties.isPkgManager()) {
return restartTriggered;
}
try {
final Switchboard sb = Switchboard.getSwitchboard();
ConcurrentLog.info("UPDATE", "INITIATED");
Expand Down

0 comments on commit 5725582

Please sign in to comment.