This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: Patch for unattended setup (updated)
The above ChangeLog is not standard. Just take a look at all of the other
entries in this file and you'll see things like it's missing a blank line after the
initial entry, it's missing filenames, and it is missing function names. Also
the "voice" used is supposed to be active not passive, i.e., change:
* Exit code IDS_REBOOT_REQUIRED is returned if needed.
* install.cc (do_install_thread): Return exit code IDS_REBOOT_REQUIRED
if needed.
See also: http://www.gnu.org/prep/standards/html_node/Change-Logs.html .
Thank you - a very useful link. I have followed it to produce the attached
patch for consideration. Please do point out any further problems.
Yours,
FrankCommon subdirectories: setup-2.590-cvs/.deps and setup-2.590-rfl/.deps
Common subdirectories: setup-2.590-cvs/.libs and setup-2.590-rfl/.libs
Common subdirectories: setup-2.590-cvs/CVS and setup-2.590-rfl/CVS
diff -u setup-2.590-cvs/ChangeLog setup-2.590-rfl/ChangeLog
--- setup-2.590-cvs/ChangeLog 2008-04-10 13:36:07.000000000 +0100
+++ setup-2.590-rfl/ChangeLog 2008-04-10 14:08:16.090147800 +0100
@@ -1,3 +1,8 @@
+2008-04-10 Frank Lee <rl201@cam.ac.uk>
+ * Add command-line option '-s' to select software packages.
+ * Intercept calls to message boxes if unattended flag (-q) is set.
+ * Exit code IDS_REBOOT_REQUIRED is returned if needed.
+
2008-04-10 Brian Dessent <brian@dessent.net>
* Makefile.am (setup_LDFLAGS): Make sure static libbz2 and zlib
Only in setup-2.590-rfl: ChangeLog.orig
Only in setup-2.590-rfl: ChangeLog.rej
Common subdirectories: setup-2.590-cvs/autom4te.cache and setup-2.590-rfl/autom4te.cache
Common subdirectories: setup-2.590-cvs/bz2lib and setup-2.590-rfl/bz2lib
Common subdirectories: setup-2.590-cvs/cfgaux and setup-2.590-rfl/cfgaux
Common subdirectories: setup-2.590-cvs/csu_util and setup-2.590-rfl/csu_util
diff -u setup-2.590-cvs/install.cc setup-2.590-rfl/install.cc
--- setup-2.590-cvs/install.cc 2008-04-09 03:25:27.000000000 +0100
+++ setup-2.590-rfl/install.cc 2008-04-10 14:07:25.542625800 +0100
@@ -135,7 +135,6 @@
static int num_installs, num_uninstalls;
static void md5_one (const packagesource& source);
-static bool rebootneeded;
void
Installer::preremoveOne (packagemeta & pkg)
@@ -636,6 +635,9 @@
exit_msg = IDS_INSTALL_INCOMPLETE;
else if (!unattended_mode)
exit_msg = IDS_INSTALL_COMPLETE;
+
+ if (rebootneeded)
+ exit_msg = IDS_REBOOT_REQUIRED;
}
static DWORD WINAPI
Common subdirectories: setup-2.590-cvs/libgetopt++ and setup-2.590-rfl/libgetopt++
Common subdirectories: setup-2.590-cvs/libmd5-rfc and setup-2.590-rfl/libmd5-rfc
diff -u setup-2.590-cvs/main.cc setup-2.590-rfl/main.cc
--- setup-2.590-cvs/main.cc 2007-02-28 00:55:04.000000000 +0000
+++ setup-2.590-rfl/main.cc 2008-04-10 14:07:25.542625800 +0100
@@ -200,8 +200,11 @@
// Clean exit.. save user options.
UserSettings::Instance().saveAllSettings();
-
- theLog->exit (0);
+ if (rebootneeded) {
+ theLog->exit (IDS_REBOOT_REQUIRED);
+ } else {
+ theLog->exit (0);
+ }
}
TOPLEVEL_CATCH("main");
diff -u setup-2.590-cvs/msg.cc setup-2.590-rfl/msg.cc
--- setup-2.590-cvs/msg.cc 2004-12-27 16:12:44.000000000 +0000
+++ setup-2.590-rfl/msg.cc 2008-04-10 14:07:25.542625800 +0100
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdarg.h>
#include "dialog.h"
+#include "state.h"
void
msg (const char *fmt, ...)
@@ -50,6 +51,27 @@
vsnprintf (buf, 1000, fmt, args);
log (LOG_PLAIN) << "mbox " << name << ": " << buf << endLog;
+ if (unattended_mode) {
+ // Return some default values.
+ log (LOG_PLAIN) << "unattended_mode is set at mbox: returning default value" << endLog;
+ switch (type & MB_TYPEMASK)
+ {
+ case MB_OK | MB_OKCANCEL:
+ return IDOK;
+ break;
+ case MB_YESNO | MB_YESNOCANCEL:
+ return IDYES;
+ break;
+ case MB_ABORTRETRYIGNORE:
+ return IDIGNORE;
+ break;
+ case MB_RETRYCANCEL:
+ return IDCANCEL;
+ break;
+ default:
+ return 0;
+ }
+ }
return MessageBox (owner, buf, "Cygwin Setup", type);
}
diff -u setup-2.590-cvs/package_db.cc setup-2.590-rfl/package_db.cc
--- setup-2.590-cvs/package_db.cc 2008-04-09 00:50:54.000000000 +0100
+++ setup-2.590-rfl/package_db.cc 2008-04-10 14:07:25.558251000 +0100
@@ -401,6 +401,7 @@
void
packagedb::fillMissingCategory ()
{
+ for_each(packages.begin(), packages.end(), visit_if(mem_fun(&packagemeta::addToCategoryBase), mem_fun(&packagemeta::isManuallyWanted)));
for_each(packages.begin(), packages.end(), visit_if(mem_fun(&packagemeta::setDefaultCategories), mem_fun(&packagemeta::hasNoCategories)));
for_each(packages.begin(), packages.end(), mem_fun(&packagemeta::addToCategoryAll));
}
diff -u setup-2.590-cvs/package_db.h setup-2.590-rfl/package_db.h
--- setup-2.590-cvs/package_db.h 2006-04-17 16:40:11.000000000 +0100
+++ setup-2.590-rfl/package_db.h 2008-04-10 14:07:25.558251000 +0100
@@ -47,6 +47,7 @@
void fillMissingCategory();
void markUnVisited();
void setExistence();
+ void addFromCmdLine();
/* all seen binary packages */
static std::vector < packagemeta *> packages;
/* all seen source packages */
diff -u setup-2.590-cvs/package_meta.cc setup-2.590-rfl/package_meta.cc
--- setup-2.590-cvs/package_meta.cc 2006-04-17 17:13:17.000000000 +0100
+++ setup-2.590-rfl/package_meta.cc 2008-04-10 14:07:25.558251000 +0100
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
+#include "getopt++/StringOption.h"
#include "io_stream.h"
#include "compress.h"
@@ -242,6 +243,26 @@
return pkg.SDesc().size();
}
+static StringOption PackageOption ("", 's', "software", "Software packages to include");
+
+bool packagemeta::isManuallyWanted() const
+{
+ string packages_option = PackageOption;
+ string tname;
+ /* Split the packages listed in the option up */
+ string::size_type loc = packages_option.find(",",0);
+ bool bReturn = false;
+ while ( loc != string::npos ) {
+ tname = packages_option.substr(0,loc);
+ packages_option = packages_option.substr(loc+1);
+ bReturn = bReturn || (name.compare(tname) == 0);
+ loc = packages_option.find(",",0);
+ }
+ /* At this point, no "," exists in packages_option */
+ bReturn = bReturn || (name.compare(packages_option) == 0);
+ return bReturn;
+}
+
const std::string
packagemeta::SDesc () const
{
@@ -647,6 +668,12 @@
referenced are unselectable anyway. */
}
+void
+packagemeta::addToCategoryBase()
+{
+ add_category ("Base");
+}
+
bool
packagemeta::hasNoCategories() const
{
diff -u setup-2.590-cvs/package_meta.h setup-2.590-rfl/package_meta.h
--- setup-2.590-cvs/package_meta.h 2006-04-17 17:13:17.000000000 +0100
+++ setup-2.590-rfl/package_meta.h 2008-04-10 14:07:25.573876200 +0100
@@ -54,8 +54,10 @@
void visited(bool const &);
bool visited() const;
bool hasNoCategories() const;
+ bool isManuallyWanted() const;
void setDefaultCategories();
void addToCategoryAll();
+ void addToCategoryBase();
class _actions
{
Common subdirectories: setup-2.590-cvs/rsync and setup-2.590-rfl/rsync
diff -u setup-2.590-cvs/state.cc setup-2.590-rfl/state.cc
--- setup-2.590-cvs/state.cc 2006-04-15 22:21:25.000000000 +0100
+++ setup-2.590-rfl/state.cc 2008-04-10 14:07:25.573876200 +0100
@@ -23,6 +23,7 @@
#include "state.h"
bool unattended_mode;
+bool rebootneeded;
int source;
diff -u setup-2.590-cvs/state.h setup-2.590-rfl/state.h
--- setup-2.590-cvs/state.h 2006-04-15 22:21:25.000000000 +0100
+++ setup-2.590-rfl/state.h 2008-04-10 14:07:25.589501400 +0100
@@ -32,10 +32,12 @@
#include <string>
extern bool unattended_mode;
+extern bool rebootneeded;
extern int source;
extern std::string local_dir;
+extern std::string packages_option;
extern int root_text;
extern int root_scope;
Common subdirectories: setup-2.590-cvs/temp and setup-2.590-rfl/temp
Common subdirectories: setup-2.590-cvs/tests and setup-2.590-rfl/tests
Common subdirectories: setup-2.590-cvs/zlib and setup-2.590-rfl/zlib