[-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 9340 bytes --] https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=b5b442157755ec33779783188b88e3349379c79b commit b5b442157755ec33779783188b88e3349379c79b Author: Jon Turney <jon.turney@dronecode.org.uk> Date: Wed Aug 24 13:31:49 2022 +0100 Drop setting root_scope as a side-effect of read_mounts() Default root_scope as appropriate, allowing GUI to override it Only enable 'Install For All Users' if we have Admin privs Drop some comment cruft https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=b82456741ed3fc9d382f3f4cb520985f06cf9084 commit b82456741ed3fc9d382f3f4cb520985f06cf9084 Author: Jon Turney <jon.turney@dronecode.org.uk> Date: Mon Aug 22 15:25:24 2022 +0100 Update POT file Also tweak some translated strings for consistency Diff: --- mount.cc | 30 +++++++++++++++++++++++------- mount.h | 9 +-------- po/fr/res.po | 11 +++++++---- res.pot | 21 ++++++++++++++++++--- res/en/res.rc | 2 +- res/fr/res.rc | 8 ++++---- root.cc | 12 ++++++++++++ 7 files changed, 66 insertions(+), 27 deletions(-) diff --git a/mount.cc b/mount.cc index 01363965..a38f52ce 100644 --- a/mount.cc +++ b/mount.cc @@ -140,10 +140,6 @@ create_install_root () : "LOCAL_MACHINE\\") << buf << "\\rootdir = \"" << get_root_dir () << "\"" << endLog; - - // The mount table is already in the right shape at this point. - // Reading it again is not necessary. - //read_mounts (std::string ()); } inline char * @@ -316,8 +312,6 @@ read_mounts (const std::string val) } got_usr_bin = got_usr_lib = false; - root_scope = (nt_sec.isRunAsAdmin ())? IDC_ROOT_SYSTEM : IDC_ROOT_USER; - if (val.size ()) { /* Cygwin rootdir always < MAX_PATH. */ @@ -353,7 +347,6 @@ read_mounts (const std::string val) { m->native = std::string (aBuffer); m->posix = "/"; - root_scope = isuser ? IDC_ROOT_USER : IDC_ROOT_SYSTEM; root_here = m++; from_fstab (m, root_here->native); add_usr_mnts (m); @@ -376,6 +369,29 @@ read_mounts (const std::string val) } } +// set default root_scope: USER if only HKEY_CURRENT_USER registry key exists, +// otherwise SYSTEM. +void set_default_root_scope() +{ + root_scope = IDC_ROOT_SYSTEM; + + char buf[10000]; + for (int isuser = 0; isuser <= 1; isuser++) + { + snprintf (buf, sizeof(buf), "Software\\%s\\%s", + CYGWIN_INFO_CYGWIN_REGISTRY_NAME, + CYGWIN_INFO_CYGWIN_SETUP_REGISTRY_NAME); + HKEY key = isuser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; + if (RegOpenKeyEx (key, buf, 0, KEY_ALL_ACCESS | SETUP_KEY_WOW64, + &key) == ERROR_SUCCESS) + { + RegCloseKey (key); + root_scope = isuser ? IDC_ROOT_USER : IDC_ROOT_SYSTEM; + break; + } + } +} + void set_root_dir (const std::string val) { diff --git a/mount.h b/mount.h index a7d7e393..c451a02d 100644 --- a/mount.h +++ b/mount.h @@ -15,11 +15,6 @@ #ifndef SETUP_MOUNT_H #define SETUP_MOUNT_H - -/* Finds the existing root mount, or returns NULL. istext is set to - nonzero if the existing mount is a text mount, else zero for - binary. */ - #include <string> #include "String++.h" @@ -27,9 +22,7 @@ void create_install_root (); void read_mounts (const std::string); - -/* Sets the cygdrive flags. Used to make the automounted drives' binary/text -mode consistent with the standard Cygwin mounts. */ +void set_default_root_scope(); std::string cygpath (const std::string&); void set_root_dir (const std::string); diff --git a/po/fr/res.po b/po/fr/res.po index 78d57d17..ec0e52b1 100644 --- a/po/fr/res.po +++ b/po/fr/res.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-16 14:29+0100\n" +"POT-Creation-Date: 2022-08-22 15:26+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -365,8 +365,7 @@ msgstr "" "durant l'installation. \n" "\n" "Notez que Cygwin inclus un grand nombre de paquets destinés à de multiples " -"usages. Nous ne pourrons installer par défaut qu'un jeu de paquets de base.\r" -"\n" +"usages. Nous ne pourrons installer par défaut qu'un jeu de paquets de base.\n" "\n" "Redémarrez ce programme ultérieurement pour ajouter, enlever ou mettre à " "jour des paquets si nécessaire." @@ -1108,9 +1107,13 @@ msgid "" "\"Continue\"\" to go on anyway (the file will be updated after a reboot).\n" msgstr "" "Incapable d'extraire /%s -- erreur à l'écriture du fichier\n" +"\n" "Le fichier est utilisé ou une autre erreur est survenue.\n" +"\n" "Arrêtez tous les processus Cygwin et sélectionnez «Recommencer», ou\n" +"\n" "«Continuer» pour poursuivre (il faudra redémarrer).\n" +"\n" #: STRINGTABLE.IDS_INSTALL_OLD_CYGWIN msgid "" @@ -1429,7 +1432,7 @@ msgid "Enable old cygwin.com keys" msgstr "Utiliser les anciennes clés de cygwin.com" #: STRINGTABLE.IDS_HELPTEXT_ONLY_SITE -msgid "Do not download mirror list. Only use sites specified with -s." +msgid "Do not download mirror list. Only use sites specified with -s" msgstr "Ignorer tous les sites sauf ceux spécifiés par -s" #: STRINGTABLE.IDS_HELPTEXT_PACKAGES diff --git a/res.pot b/res.pot index 2e82da7f..64079c8c 100644 --- a/res.pot +++ b/res.pot @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-16 14:28+0100\n" +"POT-Creation-Date: 2022-08-27 12:54+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -771,7 +771,14 @@ msgid "" "haven't been selected for installation.\n" "\n" "Picked: Show installed packages that were selected, not installed as a " -"dependency." +"dependency.\n" +"\n" +"Removable: Show installed packages that were selected and could be safely " +"removed. No other installed or selected packages depend on these packages.\n" +"\n" +"Unneeded: Show automatically installed packages that could now be safely " +"removed. Other installed or selected packages no longer depend on these " +"packages." msgstr "" #: STRINGTABLE.IDS_HIDEOBS_TOOLTIP @@ -934,6 +941,14 @@ msgstr "" msgid "Picked" msgstr "" +#: STRINGTABLE.IDS_VIEW_REMOVABLE +msgid "Removable" +msgstr "" + +#: STRINGTABLE.IDS_VIEW_UNNEEDED +msgid "Unneeded" +msgstr "" + #: STRINGTABLE.IDS_VIEW_CATEGORY msgid "Category" msgstr "" @@ -1263,7 +1278,7 @@ msgid "Enable old cygwin.com keys" msgstr "" #: STRINGTABLE.IDS_HELPTEXT_ONLY_SITE -msgid "Do not download mirror list. Only use sites specified with -s." +msgid "Do not download mirror list. Only use sites specified with -s" msgstr "" #: STRINGTABLE.IDS_HELPTEXT_PACKAGES diff --git a/res/en/res.rc b/res/en/res.rc index fc61e598..ef5e8b19 100644 --- a/res/en/res.rc +++ b/res/en/res.rc @@ -691,7 +691,7 @@ BEGIN IDS_HELPTEXT_NO_WARN_DEPRECATED_WINDOWS "Don't warn about deprecated Windows versions" IDS_HELPTEXT_NO_WRITE_REGISTRY "Don't write root installation directory to registry" IDS_HELPTEXT_OLD_KEYS "Enable old cygwin.com keys" - IDS_HELPTEXT_ONLY_SITE "Do not download mirror list. Only use sites specified with -s." + IDS_HELPTEXT_ONLY_SITE "Do not download mirror list. Only use sites specified with -s" IDS_HELPTEXT_PACKAGES "Specify packages to install" IDS_HELPTEXT_PACKAGE_MANAGER "Semi-attended chooser-only mode" IDS_HELPTEXT_PROXY "HTTP/FTP proxy (host:port)" diff --git a/res/fr/res.rc b/res/fr/res.rc index 681aea43..d081bb2c 100644 --- a/res/fr/res.rc +++ b/res/fr/res.rc @@ -579,10 +579,10 @@ BEGIN IDS_MBOX_CAPTION "Assistant Cygwin" IDS_EXTRACTION_FAILED "Impossible d'extraire /%s -- paquet corrompu ?" IDS_EXTRACTION_INUSE - "Incapable d'extraire /%s -- erreur à l'écriture du fichier\n" - "Le fichier est utilisé ou une autre erreur est survenue.\n" - "Arrêtez tous les processus Cygwin et sélectionnez «Recommencer», ou\n" - "«Continuer» pour poursuivre (il faudra redémarrer).\n" + "Incapable d'extraire /%s -- erreur à l'écriture du fichier\n\n" + "Le fichier est utilisé ou une autre erreur est survenue.\n\n" + "Arrêtez tous les processus Cygwin et sélectionnez «Recommencer», ou\n\n" + "«Continuer» pour poursuivre (il faudra redémarrer).\n\n" IDS_INSTALL_OLD_CYGWIN "Une ancienne version de cygwin1.dll a été trouvée ici :\n%s\nEffacer ?" IDS_INSTALL_DELETE_OLD_CYGWIN_FAILED "Impossible de supprimer le fichier %s.\n" "La DLL est peut être utilisée par une autre application ?\n" diff --git a/root.cc b/root.cc index 9f072d7a..ccbd6ae3 100644 --- a/root.cc +++ b/root.cc @@ -259,6 +259,18 @@ RootPage::OnInit () if (!get_root_dir ().size()) read_mounts (std::string ()); orig_root_dir = get_root_dir(); + + if (!nt_sec.isRunAsAdmin()) + { + // disable IDC_ROOT_SYSTEM if not running as admin + EnableWindow(GetDlgItem(IDC_ROOT_SYSTEM), FALSE); + root_scope = IDC_ROOT_USER; + } + else + { + set_default_root_scope(); + } + load_dialog (GetHWND ()); }