[Libreoffice-commits] online.git: 2 commits - Makefile.am wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp

László Németh laszlo.nemeth at collabora.com
Wed Feb 1 13:33:46 UTC 2017


 Makefile.am     |    2 ++
 wsd/LOOLWSD.cpp |   20 ++++++++++++++------
 wsd/LOOLWSD.hpp |    1 +
 3 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 3616b4a6a850f02be4ca8c1d20af79f09ddb4d28
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Thu Jan 26 09:19:50 2017 +0100

    wsd: fix snap support
    
    - add loolwsd option --config-file=path
    
    - search all data files in the actual data directory
      instead of the default one.
    
    (cherry-picked from commit c4e9681fd17381c7af2936726262d7357a7dda10)
    
    Change-Id: I028ff8a696aa6336da55bcac2952f13b12ba8eb8
    Reviewed-on: https://gerrit.libreoffice.org/33504
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 8964c80..ffaf669 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -566,7 +566,7 @@ private:
         std::string discPath = Path(Application::instance().commandPath()).parent().toString() + "discovery.xml";
         if (!File(discPath).exists())
         {
-            discPath = LOOLWSD_DATADIR "/discovery.xml";
+            discPath = LOOLWSD::FileServerRoot + "/discovery.xml";
         }
 
         InputSource input(discPath);
@@ -1243,7 +1243,7 @@ private:
         std::string discoveryPath = Path(Application::instance().commandPath()).parent().toString() + "discovery.xml";
         if (!File(discoveryPath).exists())
         {
-            discoveryPath = LOOLWSD_DATADIR "/discovery.xml";
+            discoveryPath = LOOLWSD::FileServerRoot + "/discovery.xml";
         }
 
         const std::string mediaType = "text/xml";
@@ -1351,7 +1351,7 @@ public:
                 std::string faviconPath = Path(Application::instance().commandPath()).parent().toString() + "favicon.ico";
                 if (!File(faviconPath).exists())
                 {
-                    faviconPath = LOOLWSD_DATADIR "/favicon.ico";
+                    faviconPath = LOOLWSD::FileServerRoot + "/favicon.ico";
                 }
                 response.setContentType(mimeType);
                 response.sendFile(faviconPath, mimeType);
@@ -1694,6 +1694,7 @@ std::string LOOLWSD::ChildRoot;
 std::string LOOLWSD::ServerName;
 std::string LOOLWSD::FileServerRoot;
 std::string LOOLWSD::LOKitVersion;
+std::string LOOLWSD::ConfigFile = LOOLWSD_CONFIGDIR "/loolwsd.xml";
 Util::RuntimeConstant<bool> LOOLWSD::SSLEnabled;
 Util::RuntimeConstant<bool> LOOLWSD::SSLTermination;
 
@@ -1782,9 +1783,8 @@ void LOOLWSD::initialize(Application& self)
     // Load default configuration files, if present.
     if (loadConfiguration(PRIO_DEFAULT) == 0)
     {
-        // Fallback to the default path.
-        const std::string configPath = LOOLWSD_CONFIGDIR "/loolwsd.xml";
-        loadConfiguration(configPath, PRIO_DEFAULT);
+        // Fallback to the LOOLWSD_CONFIGDIR or --config-file path.
+        loadConfiguration(ConfigFile, PRIO_DEFAULT);
     }
 
     // Override any settings passed on the command-line.
@@ -1861,6 +1861,7 @@ void LOOLWSD::initialize(Application& self)
     LoTemplate = getPathFromConfig("lo_template_path");
     ChildRoot = getPathFromConfig("child_root_path");
     ServerName = config().getString("server_name");
+
     FileServerRoot = getPathFromConfig("file_server_root_path");
     NumPreSpawnedChildren = getConfigValue<int>(conf, "num_prespawn_children", 1);
     if (NumPreSpawnedChildren < 1)
@@ -2021,6 +2022,11 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
                         .repeatable(true)
                         .argument("xmlpath"));
 
+    optionSet.addOption(Option("config-file", "", "Override configuration file path.")
+                        .required(false)
+                        .repeatable(false)
+                        .argument("path"));
+
 #if ENABLE_DEBUG
     optionSet.addOption(Option("unitlib", "", "Unit testing library path.")
                         .required(false)
@@ -2061,6 +2067,8 @@ void LOOLWSD::handleOption(const std::string& optionName,
         LOOLProtocol::parseNameValuePair(value, optName, optValue);
         _overrideSettings[optName] = optValue;
     }
+    else if (optionName == "config-file")
+        ConfigFile = value;
 #if ENABLE_DEBUG
     else if (optionName == "unitlib")
         UnitTestLibrary = value;
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index fa6ec5f..536b18e 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -39,6 +39,7 @@ public:
     static std::atomic<int> ForKitWritePipe;
     static std::atomic<int> ForKitProcId;
     static std::string Cache;
+    static std::string ConfigFile;
     static std::string SysTemplate;
     static std::string LoTemplate;
     static std::string ChildRoot;
commit 57abb860f4b09525d31cdabff7a9d4580e64b04b
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Mon Jan 30 15:54:10 2017 +0100

    add alternative Poco library search path for loolforkit and loolmount
    
    These executables are binaries with Linux capabilities, in which case
    LD_LIBRARY_PATH is ignored. As a workaround, we can use rpath to support
    the alternative Poco library path of a "classic" snap package.
    
    (cherry-picked from commit 74bc911efbf4882f389a49c8e627e7e8057d4a4b)
    
    Change-Id: I23c1d58cce64875abb9629943bfffd7ea633b2bc
    Reviewed-on: https://gerrit.libreoffice.org/33705
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/Makefile.am b/Makefile.am
index 0ddcc7b..8a08027 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,6 +29,8 @@ include_paths = -I${top_srcdir}/common -I${top_srcdir}/wsd -I${top_srcdir}/kit
 
 AM_CPPFLAGS = -pthread -DLOOLWSD_DATADIR='"@LOOLWSD_DATADIR@"' -DLOOLWSD_CONFIGDIR='"@LOOLWSD_CONFIGDIR@"' ${include_paths}
 AM_LDFLAGS = -pthread -Wl,-E
+loolforkit_LDFLAGS = -pthread -Wl,-E,-rpath,/snap/loolwsd/current/usr/lib
+loolmount_LDFLAGS = -pthread -Wl,-E,-rpath,/snap/loolwsd/current/usr/lib
 
 AM_ETAGSFLAGS = --c++-kinds=+p --fields=+iaS --extra=+q -R --totals=yes *
 AM_CTAGSFLAGS = $(AM_ETAGSFLAGS)


More information about the Libreoffice-commits mailing list