public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.877-9-gc123d34
@ 2017-01-24 14:09 jturney
0 siblings, 0 replies; only message in thread
From: jturney @ 2017-01-24 14:09 UTC (permalink / raw)
To: cygwin-apps-cvs
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=c123d344c7702e8d2d48a378991c130a20e337b8
commit c123d344c7702e8d2d48a378991c130a20e337b8
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sat Jan 21 18:07:02 2017 +0000
Add --allow-unsupported-windows option
This patch was suggested in a discussion with Peter Castro.
The concern is that using old versions of setup to install time machine
mirrors is not ideal, as it misses possible fixes in newer versions of
setup.
However, we do want to make it hard for someone to destroy their working XP
installation, so allowing setup to simply run on XP, which will break it by
upgrading it to the latest version (which doesn't work on XP), seems
contraindicated.
When --allow-unsupported-windows is on:
- Don't check the windows version
- Don't read the mirror list from cygwin.com
- Don't use any stored mirror selection in the 'last-mirror' key (as this
may point to a cygwin mirror, which, if we install from will break things)
- Retain the mirror selection (presumably a time machine circa given with
--site or via the GUI) in an alternate key 'last-mirror-unsupported'
Also, for discoverability, rearrange things so --help works even on
unsupported windows versions
Diff:
---
main.cc | 21 ++++++++++++---------
site.cc | 18 ++++++++++++++++--
site.h | 1 +
3 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/main.cc b/main.cc
index e1f1def..fe1d6c1 100644
--- a/main.cc
+++ b/main.cc
@@ -94,6 +94,7 @@ static BoolOption NoAdminOption (false, 'B', "no-admin", "Do not check for and e
static BoolOption WaitOption (false, 'W', "wait", "When elevating, wait for elevated child process");
static BoolOption HelpOption (false, 'h', "help", "print help");
static StringOption SetupBaseNameOpt ("setup", 'i', "ini-basename", "Use a different basename, e.g. \"foo\", instead of \"setup\"", false);
+BoolOption UnsupportedOption (false, '0', "allow-unsupported-windows", "Allow old, unsupported Windows versions");
std::string SetupBaseName;
static void inline
@@ -286,14 +287,6 @@ WinMain (HINSTANCE h,
<< setup_version << endLog;
}
- /* Check if Cygwin works on this Windows version */
- if (OSMajorVersion () < 6)
- {
- mbox (NULL, "Cygwin is not supported on this Windows version",
- "Cygwin Setup", MB_ICONEXCLAMATION | MB_OK);
- Logger ().exit (1, false);
- }
-
if (help_option)
{
if (invalid_option)
@@ -302,8 +295,18 @@ WinMain (HINSTANCE h,
GetOption::GetInstance ().ParameterUsage (Log (LOG_PLAIN));
Log (LOG_PLAIN) << endLog;
Logger ().exit (invalid_option ? 1 : 0, false);
+ goto finish_up;
}
- else if (elevate)
+
+ /* Check if Cygwin works on this Windows version */
+ if (!UnsupportedOption && (OSMajorVersion () < 6))
+ {
+ mbox (NULL, "Cygwin is not supported on this Windows version",
+ "Cygwin Setup", MB_ICONEXCLAMATION | MB_OK);
+ Logger ().exit (1, false);
+ }
+
+ if (elevate)
{
char exe_path[MAX_PATH];
if (!GetModuleFileName(NULL, exe_path, ARRAYSIZE(exe_path)))
diff --git a/site.cc b/site.cc
index 1ff3a39..b05657b 100644
--- a/site.cc
+++ b/site.cc
@@ -97,6 +97,7 @@ SiteList dropped_site_list;
StringArrayOption SiteOption('s', "site", "Download site");
BoolOption OnlySiteOption(false, 'O', "only-site", "Ignore all sites except for -s");
+extern BoolOption UnsupportedOption;
SiteSetting::SiteSetting (): saved (false)
{
@@ -111,10 +112,19 @@ SiteSetting::SiteSetting (): saved (false)
getSavedSites ();
}
+const char *
+SiteSetting::lastMirrorKey ()
+{
+ if (UnsupportedOption)
+ return "last-mirror-unsupported";
+
+ return "last-mirror";
+}
+
void
SiteSetting::save()
{
- io_stream *f = UserSettings::instance().open ("last-mirror");
+ io_stream *f = UserSettings::instance().open (lastMirrorKey ());
if (f)
{
for (SiteList::const_iterator n = site_list.begin ();
@@ -305,6 +315,10 @@ get_site_list (HINSTANCE h, HWND owner)
char mirror_url[1000];
char *theMirrorString, *theCachedString;
+
+ if (UnsupportedOption)
+ return 0;
+
const char *cached_mirrors = OnlySiteOption ? NULL : UserSettings::instance().get ("mirrors-lst");
if (cached_mirrors)
{
@@ -385,7 +399,7 @@ SiteSetting::registerSavedSite (const char * site)
void
SiteSetting::getSavedSites ()
{
- const char *buf = UserSettings::instance().get ("last-mirror");
+ const char *buf = UserSettings::instance().get (lastMirrorKey ());
if (!buf)
return;
char *fg_ret = strdup (buf);
diff --git a/site.h b/site.h
index 529ac31..457aaee 100644
--- a/site.h
+++ b/site.h
@@ -87,6 +87,7 @@ class SiteSetting
bool saved;
void getSavedSites();
void registerSavedSite(char const *);
+ const char *lastMirrorKey();
};
#endif /* SETUP_SITE_H */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-24 14:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 14:09 [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.877-9-gc123d34 jturney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).