[PATCH setup 00/11] Add options to choose symlink type (v2)

2021-08-10 Thread Jon Turney
Revised from [1], this adds an '--symlink-type {sys, native, wsl}' option, which controls the type of symlinks created by setup and the post-install scripts it invokes [2]. If creating the symlink using the selected method fails, setup falls back to using a sys symlink. '--symlink-type lnk' is no

[PATCH setup 01/11] Add support for creating WSL symlinks

2021-08-10 Thread Jon Turney
--- inilintmain.cc | 7 +++ mklink2.cc | 143 +++-- mklink2.h | 10 3 files changed, 157 insertions(+), 3 deletions(-) diff --git a/inilintmain.cc b/inilintmain.cc index f31e5eb..886c152 100644 --- a/inilintmain.cc +++ b/inilintmain.cc

[PATCH setup 02/11] Add support for creating native symlinks

2021-08-10 Thread Jon Turney
--- filemanip.cc | 27 filemanip.h | 1 + mklink2.cc | 113 +++ 3 files changed, 141 insertions(+) diff --git a/filemanip.cc b/filemanip.cc index 48f5117..ca5e4ac 100644 --- a/filemanip.cc +++ b/filemanip.cc @@ -247,6 +247,33 @@ m

[PATCH setup 03/11] Factor out the iteration over archive files to install

2021-08-10 Thread Jon Turney
--- install.cc | 53 + 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/install.cc b/install.cc index 51ec4b5..cec31a9 100644 --- a/install.cc +++ b/install.cc @@ -93,7 +93,13 @@ class Installer private: bool extract_replac

[PATCH setup 04/11] Add seek() method to archive and compress file classes

2021-08-10 Thread Jon Turney
Add seek() method to archive and compressed file isostream classes (which can only rewind to the start). Also clean up some cruft in archive class. This still needs testing on a .gz archive (slightly involved as there aren't any currently!) --- archive.cc | 52 -

[PATCH setup 05/11] Add separate symlink-creation phase when extracting archive

2021-08-10 Thread Jon Turney
Add a separate symlink-creation phase when extracting an archive, by ignoring symlinks on the first pass, rewinding the archive, and then extracting only symlinks on the second pass. This helps a lot with native symlinks (which require the destination to exist when created, so we can determine if

[PATCH setup 07/11] Add symlink capabilities to user-agent telemetry

2021-08-10 Thread Jon Turney
Report if (i) we have the symlink creation privilege, and (ii) if developer mode is on, so unprivileged symlink creation is allowed. --- nio-ie5.cc | 12 +++- win32.cc | 18 ++ win32.h| 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/nio-ie5.cc b/

[PATCH setup 06/11] Enable SeCreateSymbolicLink privilege

2021-08-10 Thread Jon Turney
I'm not sure if SeCreateSymbolicLink privilege can get removed by UAC filtering, but to make sure to enable it, if we can. Also report if it's available to log. --- win32.cc | 58 win32.h | 2 ++ 2 files changed, 60 insertions(+) diff --

[PATCH setup 08/11] Factor out StringChoiceOption

2021-08-10 Thread Jon Turney
Factor out logic for 'a string option which is one of a set of choices' from CompactOsStringOption as StringChoiceOption. v2: Allow different behaviour for option without a choice, and option absent. Future work: This doesn't say anything other that "Error during option processing" if you've give

[PATCH setup 09/11] Add a command line option to choose symlink type used

2021-08-10 Thread Jon Turney
The default is 'sys', the historical behaviour of setup. v2: Adjust to use StringChoiceOption Align option names with winsymlink values --- main.cc | 42 +++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/main.cc b/main.cc index b3854a8..023d

[PATCH setup 10/11] Propagate --symlink-type setting to post-install scripts

2021-08-10 Thread Jon Turney
Propagate --symlink-type setting to post-install scripts, by setting the CYGWIN env var appropriately. --- script.cc | 36 1 file changed, 36 insertions(+) diff --git a/script.cc b/script.cc index 69dc115..6818f4b 100644 --- a/script.cc +++ b/script.cc @@ -36,

[PATCH setup 11/11] Default symlink mode from CYGWIN env var

2021-08-10 Thread Jon Turney
--- main.cc | 44 +++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/main.cc b/main.cc index 023d505..f4756c7 100644 --- a/main.cc +++ b/main.cc @@ -284,6 +284,7 @@ WinMain (HINSTANCE h, /* Check if we have to elevate. */ bool eleva