Jon Turney wrote:
Jon Turney (2):
Drop group change while running postinstall scripts
Defer setting group until after All Users/Just For Me is chosen
main.cc | 2 +-
postinstall.cc | 13 -------------
root.cc | 5 +++++
win32.cc | 13 ++-----------
win32.h | 2 +-
5 files changed, 9 insertions(+), 26 deletions(-)
Works for me as expected. Primary group of dirs/files of "All Users"
installed files are now local administrator (like before Feb 2012),
including those generated by postinstall scripts (new behavior).
As already mentioned in the '--no-write-registry' thread, "Just me"
installs only work with non-elevated user and '-B' option. Attached is a
temporary patch I used to log changes of root_scope variable.
diff --git a/state.cc b/state.cc
index 111b890..b4e3410 100644
--- a/state.cc
+++ b/state.cc
@@ -24,7 +24,7 @@ int source;
std::string local_dir;
-int root_scope;
+root_scope_holder root_scope;
int root_menu;
int root_desktop;
diff --git a/state.h b/state.h
index b211de3..c561ea5 100644
--- a/state.h
+++ b/state.h
@@ -32,6 +32,7 @@
*/
#include <string>
+#include "LogSingleton.h"
enum attend_mode { attended = 0, unattended, chooseronly };
extern enum attend_mode unattended_mode;
@@ -42,7 +43,22 @@ extern int source;
extern std::string local_dir;
extern int root_text;
-extern int root_scope;
+
+class root_scope_holder
+{
+public:
+ void operator=(int v) {
+ int old = val;
+ val = v;
+ Log(LOG_TIMESTAMP) << "root_scope: " << old << " -> " << v << endLog;
+ }
+ operator int() const { return val; }
+private:
+ int val = 0;
+};
+
+extern root_scope_holder root_scope;
+
extern int root_menu;
extern int root_desktop;