I have made the following changes intended for : CE:MW:MTF / meegotouch-applauncherd
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/4200 Thank You, Marko Saukko [This message was auto-generated] --- Request # 4200: Messages from BOSS: State: review at 2012-01-26T15:33:18 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: Project:MTF:MW / meegotouch-applauncherd -> CE:MW:MTF / meegotouch-applauncherd changes files: -------------- --- meegotouch-applauncherd.changes +++ meegotouch-applauncherd.changes @@ -0,0 +1,3 @@ +* Thu Jan 26 2012 Marko Saukko <[email protected]> - 2.0.16 +- Updated 0001-BMC22845-Move-var-run-to-home.patch to use env instead of hardcoded values. + spec files: ----------- other changes: -------------- ++++++ 0001-BMC22845-Move-var-run-to-home.patch --- 0001-BMC22845-Move-var-run-to-home.patch +++ 0001-BMC22845-Move-var-run-to-home.patch @@ -1,19 +1,19 @@ -From 8877911860c617e14b50769fd7d868466a12d1df Mon Sep 17 00:00:00 2001 -From: Robin Burchell <[email protected]> -Date: Tue, 22 Nov 2011 18:34:12 +0100 -Subject: [PATCH 1/2] BMC22845: Move /var/run to /home. +From c392920307384656b7f0eb879fa53ca17df2c265 Mon Sep 17 00:00:00 2001 +From: Marko Saukko <[email protected]> +Date: Thu, 26 Jan 2012 17:19:38 +0200 +Subject: [PATCH] Move files from /var/run/ to users home directory. -TODO: don't hardcode /home/meego. --- doc/singleinstance.dox | 2 +- - src/launcherlib/daemon.cpp | 2 +- + src/launcherlib/daemon.cpp | 35 +++++++++++-------- + src/launcherlib/daemon.h | 4 +- src/qdeclarativebooster/README-QDECLARATIVEBOOSTER | 2 +- - src/single-instance/main.cpp | 4 ++-- + src/single-instance/main.cpp | 5 ++- tests/meego/testscripts/utils.py | 2 +- - 5 files changed, 6 insertions(+), 6 deletions(-) + 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/doc/singleinstance.dox b/doc/singleinstance.dox -index ab01de4..707ee3d 100644 +index ab01de4..d7b5ef6 100644 --- a/doc/singleinstance.dox +++ b/doc/singleinstance.dox @@ -20,7 +20,7 @@ Exec=/usr/bin/invoker --single-instance --type=e /usr/bin/myApp @@ -21,25 +21,143 @@ As a result, a lock file -\c /var/run/single-instance-locks/usr/bin/myApp/instance.lock is created. -+\c /home/meego/.single-instance-locks/usr/bin/myApp/instance.lock is created. ++\c $HOME/.single-instance-locks/usr/bin/myApp/instance.lock is created. If applauncherd cannot acquire the lock, it tries to find the corresponding window and activates it. diff --git a/src/launcherlib/daemon.cpp b/src/launcherlib/daemon.cpp -index 3cd446d..fe69f1b 100644 +index 2af7a19..c8f0306 100644 --- a/src/launcherlib/daemon.cpp +++ b/src/launcherlib/daemon.cpp -@@ -116,7 +116,7 @@ bool Daemon::lock() +@@ -40,6 +40,7 @@ + #include <stdexcept> + #include <fstream> + #include <sstream> ++#include <stdlib.h> + + #ifdef HAVE_AEGIS_CRYPTO + #include <aegis_crypto.h> +@@ -53,8 +54,9 @@ extern char ** environ; + Daemon * Daemon::m_instance = NULL; + int Daemon::m_lockFd = -1; + const int Daemon::m_boosterSleepTime = 2; +-const char *Daemon::m_stateDir = "/var/run/applauncherd"; +-const char *Daemon::m_stateFile = "/var/run/applauncherd/saved-state"; ++ ++const std::string Daemon::m_stateDir = std::string(getenv("HOME"))+"/.applauncherd"; ++const std::string Daemon::m_stateFile = Daemon::m_stateDir + "/saved-state"; + + Daemon::Daemon(int & argc, char * argv[]) : + m_daemon(false), +@@ -116,7 +118,10 @@ bool Daemon::lock() fl.l_start = 0; fl.l_len = 1; - if((m_lockFd = open("/var/run/applauncherd.lock", O_WRONLY | O_CREAT, 0666)) == -1) -+ if((m_lockFd = open("/home/meego/applauncherd.lock", O_WRONLY | O_CREAT, 0666)) == -1) ++ std::stringstream lock_file; ++ lock_file << getenv("HOME") << "/applauncherd.lock"; ++ ++ if((m_lockFd = open(lock_file.str().c_str(), O_WRONLY | O_CREAT, 0666)) == -1) return false; if(fcntl(m_lockFd, F_SETLK, &fl) == -1) +@@ -844,31 +849,31 @@ void Daemon::reExec() + Logger::logInfo("Daemon: Re-exec requested."); + + struct stat st; +- if (stat(m_stateDir, &st) != 0) ++ if (stat(m_stateDir.c_str(), &st) != 0) + { +- Logger::logDebug("Daemon: State saving directory %s does not exist", m_stateDir); ++ Logger::logDebug("Daemon: State saving directory %s does not exist", m_stateDir.c_str()); + Logger::logDebug("Daemon: Attempting to create it"); + +- if (mkdir(m_stateDir, S_IRUSR | S_IWUSR | S_IXUSR) != 0) ++ if (mkdir(m_stateDir.c_str(), S_IRUSR | S_IWUSR | S_IXUSR) != 0) + { + Logger::logDebug("Daemon: Failed to create directory, re-exec failed, exiting."); + _exit(1); + } + } + +- if (stat(m_stateDir, &st) != 0) ++ if (stat(m_stateDir.c_str(), &st) != 0) + { + Logger::logDebug("Daemon: Directory vanished, re-exec failed, exiting."); + _exit(1); + } + if (!S_ISDIR(st.st_mode)) + { +- Logger::logDebug("Daemon: %s exists but it is not a directory, re-exec failed, exiting.", m_stateDir); ++ Logger::logDebug("Daemon: %s exists but it is not a directory, re-exec failed, exiting.", m_stateDir.c_str()); + _exit(1); + } + + try { +- std::ofstream ss(m_stateFile); ++ std::ofstream ss(m_stateFile.c_str()); + ss.exceptions (std::ifstream::failbit | std::ifstream::badbit); + + // dump the pid to double check that the state file is from this process +@@ -954,7 +959,7 @@ void Daemon::restoreState() + { + #ifdef HAVE_AEGIS_CRYPTO + aegis_system_mode_t aegisMode; +- if (aegis_crypto_verify_aegisfs(m_stateDir, &aegisMode) != 0 ++ if (aegis_crypto_verify_aegisfs(m_stateDir.c_str(), &aegisMode) != 0 + || aegisMode != aegis_system_protected) + { + #ifndef DEBUG_BUILD +@@ -969,7 +974,7 @@ void Daemon::restoreState() + try + { + // We have saved state, try to restore it. +- std::ifstream ss(m_stateFile); ++ std::ifstream ss(m_stateFile.c_str()); + ss.exceptions (std::ifstream::failbit | std::ifstream::badbit); + + std::string token; +@@ -1008,9 +1013,9 @@ void Daemon::restoreState() + + // In debug mode it is better to leave the file there + // so it can be examined. +- if (!m_debugMode && remove(m_stateFile) == -1) ++ if (!m_debugMode && remove(m_stateFile.c_str()) == -1) + { +- Logger::logError("Daemon: could not remove state file %s", m_stateFile); ++ Logger::logError("Daemon: could not remove state file %s", m_stateFile.c_str()); + } + Logger::logDebug("Daemon: state restore completed"); + return; +@@ -1113,9 +1118,9 @@ void Daemon::restoreState() + + // In debug mode it is better to leave the file there + // so it can be examined. +- if (!m_debugMode && remove(m_stateFile) == -1) ++ if (!m_debugMode && remove(m_stateFile.c_str()) == -1) + { +- Logger::logError("Daemon: could not remove state file %s", m_stateFile); ++ Logger::logError("Daemon: could not remove state file %s", m_stateFile.c_str()); + } + + // This is only reached if state restore was unsuccessful. +diff --git a/src/launcherlib/daemon.h b/src/launcherlib/daemon.h +index 42063f0..c506f28 100644 +--- a/src/launcherlib/daemon.h ++++ b/src/launcherlib/daemon.h +@@ -241,8 +241,8 @@ private: + bool m_reExec; + + //! Name of the state saving directory and file +- static const char *m_stateDir; +- static const char *m_stateFile; ++ static const std::string m_stateDir; ++ static const std::string m_stateFile; + + #ifdef UNIT_TEST + friend class Ut_Daemon; diff --git a/src/qdeclarativebooster/README-QDECLARATIVEBOOSTER b/src/qdeclarativebooster/README-QDECLARATIVEBOOSTER -index addeb9f..2c1a77f 100644 +index addeb9f..83b8a8e 100644 --- a/src/qdeclarativebooster/README-QDECLARATIVEBOOSTER +++ b/src/qdeclarativebooster/README-QDECLARATIVEBOOSTER @@ -178,7 +178,7 @@ This can be achieved by adding --single-instance to the invoker command: @@ -47,34 +165,41 @@ Exec=/usr/bin/invoker --single-instance --type=d /usr/bin/<application_name> -As a result, a lock file /var/run/single-instance-locks/<application_name>/instance.lock -+As a result, a lock file /home/meego/.single-instance-locks/<application_name>/instance.lock ++As a result, a lock file $HOME/.single-instance-locks/<application_name>/instance.lock is created. If applauncherd cannot acquire the lock, it tries to find the corresponding window and activates it. diff --git a/src/single-instance/main.cpp b/src/single-instance/main.cpp -index 5acf748..706b2c3 100644 +index 9267aad..388243c 100644 --- a/src/single-instance/main.cpp +++ b/src/single-instance/main.cpp -@@ -36,7 +36,7 @@ +@@ -30,13 +30,14 @@ + #include <fstream> + #include <iostream> + #include <sys/stat.h> ++#include <stdlib.h> + + #define DECL_EXPORT extern "C" __attribute__ ((__visibility__("default"))) (40 more lines skipped)
