├── README.md ├── LICENSE.txt └── ConCygSys-installer.cmd /README.md: -------------------------------------------------------------------------------- 1 | # ConCygSys 2 | 3 | [![GitHub release (latest by date)](https://img.shields.io/github/v/release/0zhu/cygwin-portable?style=flat-square)](../../releases) 4 | ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/0zhu/cygwin-portable?style=flat-square) 5 | ![HitCount](http://hits.dwyl.io/0zhu/cygwin-portable.svg) 6 | [![GitHub](https://img.shields.io/github/license/0zhu/cygwin-portable?style=flat-square)](LICENSE) 7 | 8 | - [Description](#description) 9 | - [Features](#features) 10 | - [Installation](#installation) 11 | - [Usage](#usage) 12 | - [Update](#update) 13 | - [Customization](#customization) 14 | - [FAQ](#faq) 15 | 16 | ## Description 17 | 18 | **ConCygSys** is a lightweight tool that installs portable [Cygwin](https://www.cygwin.com/) Unix-like environment and connects to portable [ConEmu](https://conemu.github.io/) console emulator, with self-update feature. 19 | 20 | > This is an independent fork of amazing [cygwin-portable-installer](https://github.com/vegardit/cygwin-portable-installer) project. At first minimally modified for sysadmin purposes, later on filled with improvements and new features. 21 | 22 | ## Features 23 | 24 | - Downloads and installs the latest Cygwin and makes it **fully portable**, so you can: 25 | - move it to a different directory at any time 26 | - replicate it by copying its folder 27 | - rename the folder 28 | - run from USB or network drive 29 | - use it in folders with spaces 30 | - Downloads and installs the latest portable ConEmu 31 | - WSL support via WSLtty 32 | - Only pure base with a couple of config files to make the installtion portable, no hacks with Cygwin/ConEmu code 33 | - The installer is flexible, you can customize the installation process per your requirements 34 | - You can add your own scripts to execute during installation/update (from URL or locally) 35 | - Being portable, the script can also **upgrade** itself and its components 36 | - Windows 7+ supported 37 | 38 | ## Installation 39 | 40 | > **Optional:** Disable antivirus software on your PC during installation. [Why it is recommended](https://cygwin.com/faq/faq.html#faq.using.bloda) 41 | 42 | - Download the [latest ConCygSys release](../../releases), extract the archive and go to the extracted folder 43 | 44 | > **Optional:** Edit **`ConCygSys-installer.cmd`** to [customize](#customization) the installation per your requirements 45 | 46 | - Launch **`ConCygSys-installer.cmd`** 47 | 48 | > If Windows complains with a **Windows protected your PC** popup, you may need to click **Run anyway** to proceed with the installation. 49 | 50 | - Once the installation is finished, use **`Launch-*.cmd`** to run Cygwin/WSL. 51 | 52 | ## Usage 53 | 54 | Default behaviour of Cygwin console: 55 | 56 | - **Select by Left Click and release** - copy 57 | - **Right click** - paste 58 | 59 | Shortcuts if using Cygwin via ConEmu console: 60 | 61 | - **Ctrl+\`** - open/hide console (quake style) 62 | - **Double click on Tab** - rename a tab 63 | - **Double click on Tab Panel** - open a new tab 64 | - **Win+X** - open a new tab with standard Windows console 65 | 66 | ## Update 67 | 68 | Use **`update.cmd`** launcher in the root of your ConCygSys directory to update the installation. 69 | 70 | You will be able either to update **Cygwin only** or to perform a **full update**: Cygwin + ConCygSys core making the installation protable. ConEmu is already set to check its updates on startup and can update itself independently. 71 | 72 | > If you cannot find **`update`** launcher or something goes wrong: 73 | > - Download [**`ConCygSys-installer.cmd`**](../../raw/master/ConCygSys-installer.cmd) *(right click > save link as)* to existing ConCygSys directory 74 | > - Launch **`ConCygSys-installer.cmd`** 75 | 76 | ## Customization 77 | 78 | Open **`ConCygSys-installer.cmd`** with text editor on your PC before installation to get a control over the installation process. Available options will be in **SCRIPT SETTINGS** section. All settings are accompanied with description. 79 | 80 | [List of options](ConCygSys-installer.cmd#L11-L78) 81 | 82 | After the installation, in order to change settings / add components, edit **:cygwinsettings** and **:installoptions** sections of **`update.cmd`** launcher (Right click > Edit). 83 | 84 | [Cygwin extras collection](https://github.com/zhubanRuban/cygwin-extras) 85 | 86 | ## FAQ 87 | 88 | ### How much disk space does it take after installation? 89 | 90 | If installed with default settings: `205M` zip: `70.3M` 7z: `40.3M` 91 | 92 | ### What is the path to Windows drives when I'm in Cygwin console? 93 | 94 | `/cygdrive/DRIVE` 95 | 96 | BTW, different Windows files are symlinked in Cygwin environment. For instance, `/etc/hosts` file in Cygwin is linked to `%WINDIR%\System32\drivers\etc\hosts`. If you go to `/proc/registry` folder, you will see Windows registry structure. Many Windows programs can be executed from Cygwin as well, for instance: 97 | 98 | `ipconfig /flushdns` - to flush your local DNS cache 99 | `cygstart "notepad"` - open Windows Notepad 100 | 101 | ### Сan I install a package from command line? 102 | 103 | If you've chosen to install `apt-cyg` *(enabled by default in installer)*, you can istall packages from command line, for instance: 104 | 105 | ``` 106 | apt-cyg install nano 107 | ``` 108 | 109 | [More info about apt-cyg usage](https://github.com/transcode-open/apt-cyg) | [Available packages](https://cygwin.com/packages/package_list.html) 110 | 111 | ### I cannot find a desired package in Cygwin repository, what should I do? 112 | 113 | This can happen. Fortunately, the packages can still be built from source. 114 | Below are some examples for the reference: 115 | 116 | [MTR](https://github.com/traviscross/mtr) | [ipmitool](https://stackoverflow.com/questions/12907005/ipmitool-for-windows) 117 | 118 | Pre-built packages: 119 | 120 | [MTR](https://github.com/zhubanRuban/mtr-mobaxterm-plugin-cygwin) | [ipmitool](https://github.com/zhubanRuban/ipmitool-mobaxterm-plugin-cygwin) 121 | 122 | ### Can I use this installation for organisation? 123 | 124 | - change `CYGWIN_HOME` to `/%%H/SOMEFOLDER` in **`ConCygSys-installer.cmd`** (% must be escaped) 125 | - install with admin rights to shared location, like C:\Program Files\cygwin 126 | 127 | In this example every user who launched Cygwin will have own home folder in C:\Users\USER\SOMEFOLDER 128 | 129 | For existing installation you can change home folder in [/etc/nsswitch.conf](https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch-home). % sign does not need to be escaped in this case. 130 | 131 | ### How to check ConCygSys version? 132 | 133 | The version can be found at the beginning of: 134 | - README.txt file 135 | - any launcher file 136 | 137 | ### Where can I report an issue or get a support? 138 | 139 | [![GitHub issues](https://img.shields.io/github/issues-raw/zhubanRuban/cygwin-portable?style=flat-square) ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/zhubanRuban/cygwin-portable?style=flat-square) ![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](../../issues) 140 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /ConCygSys-installer.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: ConCygSys: Cygwin and ConEmu portable installer: https://github.com/zhubanRuban/cygwin-portable 4 | :: Copyright zhubanRuban: https://github.com/zhubanRuban 5 | :: Licensed under the Apache License 2.0: http://www.apache.org/licenses/LICENSE-2.0 6 | :: Independent fork of cygwin-portable-installer: https://github.com/vegardit/cygwin-portable-installer 7 | 8 | set CONCYGSYS_VERSION=190915 9 | 10 | 11 | ::======================= begin SCRIPT SETTINGS ======================= 12 | 13 | ::+++++++++++++ Cygwin settings 14 | 15 | :: Custom home folder: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch-home 16 | :: Applicable for new installations only. For existing ones home folder can be modified in /etc/nsswitch.conf 17 | :: Examples: 18 | :: /home/cygwinhome 19 | :: /cygdrive/c/Users/YOURUSERNAME/cygwinhome 20 | :: /%%H/cygwinhome (% sign should be escaped) 21 | :: Leave empty to use default one - /home/concygsys 22 | set CYGWIN_HOME= 23 | 24 | :: Specify default launcher for Cygwin: conemu mintty cmd 25 | :: If specified launcher is not available, defaults to next available one in the following order: conemu mintty cmd 26 | set LAUNCHER_CYGWIN= 27 | 28 | :: Comma-separated list of the packages to be installed automatically: https://cygwin.com/packages/package_list.html 29 | :: You will be able to install other packages later with apt-cyg if INSTALL_APT_CYG is set to yes below 30 | set CYGWIN_PACKAGES=bind-utils,inetutils,openssh,vim,whois 31 | 32 | :: You can choose the closest mirror: https://cygwin.com/mirrors.html 33 | set CYGWIN_MIRROR= 34 | 35 | :: Set proxy, if required, in the following format: proxyip:port 36 | :: Applicable to installation process only 37 | set PROXY_HOST= 38 | 39 | :: Override OS architecture, if required: "32" bit or "64" bit system. Leave empty for autodetect 40 | set CYGWIN_ARCH= 41 | 42 | ::+++++++++++++ Addons 43 | 44 | :: Install apt-cyg command line package manager for Cygwin: https://github.com/transcode-open/apt-cyg 45 | :: Why not using https://github.com/kou1okada/apt-cyg : https://github.com/kou1okada/apt-cyg#requirements https://github.com/kou1okada/apt-cyg/issues/24 46 | set INSTALL_APT_CYG=yes 47 | 48 | :: Configure ssh-agent: https://github.com/zhubanRuban/cygwin-extras#ssh-agent-tweak 49 | set INSTALL_SSH_AGENT_TWEAK=yes 50 | 51 | :: Space-separated list of additional scripts URL to execute after Cygwin installation 52 | :: They will be downloaded with wget and passed to bash. Commands available by default to custom scripts: cygwin base + wget + apt-cyg 53 | :: The example can be found here: https://github.com/zhubanRuban/cygwin-extras/raw/master/ssh-pageant_install.sh 54 | set INSTALL_ADDONS= 55 | :: Alternatively you can create a folder called 'addons' near installer and place your sh scripts there 56 | :: They will be executed during installation and during next update 57 | 58 | ::+++++++++++++ ConEmu settings 59 | 60 | :: Install ConEmu quake-style terminal https://conemu.github.io/ 61 | set INSTALL_CONEMU=yes 62 | 63 | :: How Cygwin or WSL will be launched in ConEmu multitab terminal, available options: 64 | :: Mintty : will be launched via mintty 65 | :: Connector : will be launched via ConEmu connector https://conemu.github.io/en/CygwinMsysConnector.html 66 | :: Cmd : will be launched via standard Windown console 67 | set CONEMUTASK_DEFAULT= 68 | 69 | ::+++++++++++++ Settings for WSL 70 | 71 | :: Install WSLbridge allowing to access WSL via Mintty https://github.com/rprichard/wslbridge (WSLtty emulation https://github.com/mintty/wsltty) 72 | set INSTALL_WSLBRIDGE=no 73 | 74 | :: Specify default launcher for WSL: conemu mintty cmd 75 | :: If specified launcher is not available, defaults to next available one in the following order: conemu mintty cmd 76 | set LAUNCHER_WSLBRIDGE= 77 | 78 | ::======================= end SCRIPT SETTINGS ======================= 79 | 80 | 81 | echo. 82 | set CONCYGSYS_LINK=https://github.com/zhubanRuban/cygwin-portable 83 | set CONCYGSYS_INFO=ConCygSys v.%CONCYGSYS_VERSION% %CONCYGSYS_LINK% 84 | echo %CONCYGSYS_INFO% 85 | echo. 86 | 87 | set INSTALL_ROOT=%~dp0 88 | set CYGWIN_DIR=cygwin 89 | set CYGWIN_ROOT=%~dp0%CYGWIN_DIR% 90 | set CONCYGSYS_SETTINGS=update.cmd 91 | set "PATH=%CYGWIN_ROOT%\bin;%CYGWIN_ROOT%\usr\local\bin;%PATH%" 92 | set BASH=bash --noprofile --norc -c 93 | 94 | ::========================================================== 95 | 96 | :retryupdate 97 | setlocal EnableDelayedExpansion 98 | if exist %CYGWIN_DIR% ( 99 | echo Existing Cygwin folder detected, switching to update mode... 100 | set UPDATEMODE=yes 101 | %SystemRoot%\System32\wbem\WMIC.exe process get ExecutablePath | findstr "%INSTALL_ROOT%" >NUL 2>&1 102 | :: multiple :: in if loop cause"system cannot find disk" warning, using rem further 103 | rem why not using "%ERRORLEVEL%"=="0": https://social.technet.microsoft.com/Forums/en-US/e72cb532-3da0-4c7f-a61e-9ffbf8050b55/batch-errorlevel-always-reports-back-level-0?forum=ITCG 104 | if not ErrorLevel 1 ( 105 | echo. 106 | echo ^^!^^!^^! Active Cygwin processes detected ^^!^^!^^! 107 | echo ========================================== 108 | %SystemRoot%\System32\wbem\WMIC.exe process where "ExecutablePath like '%%%INSTALL_ROOT:\=\\%%%'" get ExecutablePath, ProcessId 109 | echo. 110 | echo They will be terminated during update, please make sure you saved everything before proceeding 111 | pause 112 | for /f "usebackq" %%p in (`%SystemRoot%\System32\wbem\WMIC.exe process where "ExecutablePath like '%%%INSTALL_ROOT:\=\\%%%'" get ProcessId`) do taskkill /f /pid %%p >NUL 2>&1 113 | goto :retryupdate 114 | ) else ( 115 | if exist "%CONCYGSYS_SETTINGS%" ( 116 | call "%CONCYGSYS_SETTINGS%" cygwinsettings 117 | call "%CONCYGSYS_SETTINGS%" installoptions 118 | :: making sure settings from previous versions are transferred properly 119 | if not "!PROXY_PORT!" == "" (if not "!PROXY_HOST!" == "" (set PROXY_HOST=!PROXY_HOST!:!PROXY_PORT!)) 120 | ) 121 | echo. 122 | set /p UPDATECYGWINONLY= [1] then [Enter] : update Cygwin only [Enter] : update everything 123 | echo. 124 | echo ^^!^^!^^! Before you proceed with update... ^^!^^!^^! 125 | echo ========================================= 126 | echo. 127 | echo You may need to backup your cygwin home directory just in case 128 | echo. 129 | echo To customize update process: 130 | echo - close this window 131 | echo - modify :installoptions section of %CONCYGSYS_SETTINGS% file 132 | echo - re-run update 133 | echo. 134 | echo If you are good with existing setup, just hit [Enter] to start update 135 | echo ======================================================================= 136 | echo. 137 | pause 138 | ) 139 | ) else ( 140 | mkdir %CYGWIN_DIR% >NUL 2>&1 141 | ) 142 | setlocal DisableDelayedExpansion 143 | 144 | ::========================================================== 145 | 146 | set DOWNLOADER=ConCygSys-downloader.vbs 147 | echo. 148 | if "%PROXY_HOST%" == "" (set DOWNLOADER_PROXY=.) else ( 149 | set DOWNLOADER_PROXY= req.SetProxy 2, "%PROXY_HOST%", "" 150 | set http_proxy=http://%PROXY_HOST% 151 | set https_proxy=https://%PROXY_HOST% 152 | set ftp_proxy=ftp://%PROXY_HOST% 153 | ) 154 | echo Creating script that can download files, not using PowerShell which may be blocked by group policies... 155 | ( 156 | echo url = Wscript.Arguments(0^) 157 | echo target = Wscript.Arguments(1^) 158 | echo WScript.Echo "Downloading '" ^& url ^& "' to '" ^& target ^& "'..." 159 | echo Set req = CreateObject("WinHttp.WinHttpRequest.5.1"^) 160 | echo%DOWNLOADER_PROXY% 161 | echo req.Open "GET", url, False 162 | echo req.Send 163 | echo If req.Status ^<^> 200 Then 164 | echo WScript.Echo "FAILED to download: HTTP Status " ^& req.Status 165 | echo WScript.Quit 1 166 | echo End If 167 | echo Set buff = CreateObject("ADODB.Stream"^) 168 | echo buff.Open 169 | echo buff.Type = 1 170 | echo buff.Write req.ResponseBody 171 | echo buff.Position = 0 172 | echo buff.SaveToFile target 173 | echo buff.Close 174 | echo. 175 | ) > %DOWNLOADER% || goto :fail 176 | 177 | ::========================================================== 178 | 179 | echo. 180 | if "%CYGWIN_ARCH%" == "" ( 181 | echo CYGWIN_ARCH setting is empty, autodetecting... 182 | if "%PROCESSOR_ARCHITECTURE%" == "x86" ( 183 | if defined PROCESSOR_ARCHITEW6432 (set CYGWIN_ARCH=64) else (set CYGWIN_ARCH=32) 184 | ) else (set CYGWIN_ARCH=64) 185 | ) 186 | echo Choosing correct version of Cygwin installer... 187 | if "%CYGWIN_ARCH%" == "64" (set CYGWIN_SETUP=setup-x86_64.exe) else (set CYGWIN_SETUP=setup-x86.exe) 188 | echo Chosen installer: %CYGWIN_SETUP% 189 | set CYGWIN_SETUP_PATH=%CYGWIN_DIR%\%CYGWIN_SETUP% 190 | cscript //Nologo %DOWNLOADER% https://cygwin.org/%CYGWIN_SETUP% %CYGWIN_SETUP_PATH% || goto :fail 191 | 192 | :: https://cygwin.com/faq/faq.html#faq.setup.cli 193 | if "%CYGWIN_MIRROR%" == "" (set CYGWIN_MIRROR=http://mirror.checkdomain.de/cygwin/) 194 | if "%PROXY_HOST%" == "" (set CYGWIN_PROXY=) else (set CYGWIN_PROXY=--proxy "%PROXY_HOST%") 195 | 196 | :: adding required packages for special software 197 | if "%INSTALL_CONEMU%" == "yes" (set CYGWIN_PACKAGES=bsdtar,wget,%CYGWIN_PACKAGES%) 198 | if "%INSTALL_WSLBRIDGE%" == "yes" (set CYGWIN_PACKAGES=bsdtar,wget,%CYGWIN_PACKAGES%) 199 | if "%INSTALL_APT_CYG%" == "yes" (set CYGWIN_PACKAGES=wget,%CYGWIN_PACKAGES%) 200 | if "%INSTALL_SSH_AGENT_TWEAK%" == "yes" (set CYGWIN_PACKAGES=openssh,wget,%CYGWIN_PACKAGES%) 201 | if not "%INSTALL_ADDONS%" == "" (set CYGWIN_PACKAGES=wget,%CYGWIN_PACKAGES%& set INSTALL_APT_CYG=yes) 202 | 203 | :: https://www.cygwin.com/faq/faq.html#faq.setup.cli 204 | echo. 205 | echo Running Cygwin setup... 206 | %CYGWIN_SETUP_PATH% ^ 207 | --allow-unsupported-windows ^ 208 | --delete-orphans ^ 209 | --local-package-dir "%TEMP%\cygwin-local-package-dir" ^ 210 | --no-admin ^ 211 | --no-desktop ^ 212 | --no-replaceonreboot ^ 213 | --no-shortcuts ^ 214 | --no-startmenu ^ 215 | --packages dos2unix,%CYGWIN_PACKAGES% ^ 216 | --quiet-mode ^ 217 | --root %CYGWIN_DIR% ^ 218 | --site %CYGWIN_MIRROR% %CYGWIN_PROXY% ^ 219 | --upgrade-also || goto :fail 220 | 221 | del /f /q %CYGWIN_SETUP_PATH% >NUL 2>&1 & rmdir /s /q "%TEMP%\cygwin-local-package-dir" >NUL 2>&1 222 | :: warning for standard Cygwin launcher 223 | echo %CONCYGSYS_INFO% > %CYGWIN_DIR%\DO-NOT-LAUNCH-CYGWIN-FROM-HERE 224 | 225 | :: permanent noacl to prevent issues 226 | set FSTAB=%CYGWIN_ROOT:\=/% 227 | set FSTAB=%FSTAB: =\040% 228 | ( 229 | echo # %CONCYGSYS_INFO% 230 | echo %FSTAB%/bin /usr/bin none noacl,posix=0,user 0 0 231 | echo %FSTAB%/lib /usr/lib none noacl,posix=0,user 0 0 232 | echo %FSTAB% / none override,noacl 0 0 233 | echo none /tmp usertemp noacl,posix=0,user 0 0 234 | echo none /cygdrive cygdrive noacl,user 0 0 235 | echo # %CONCYGSYS_INFO% 236 | ) > %CYGWIN_DIR%\etc\fstab & dos2unix -q %CYGWIN_DIR%\etc\fstab 237 | 238 | :: adjusting home folder if not set 239 | if "%CYGWIN_HOME%" == "" (set CYGWIN_HOME=/home/concygsys) 240 | sed -i 's/^^#.*db_home:.*/db_home: %CYGWIN_HOME:/=\/%/' /etc/nsswitch.conf 241 | 242 | :: inputrc fix for ctrl+left and ctrl+right to work as expected: https://github.com/zhubanRuban/cygwin-extras#custom-inputrc 243 | copy /y %CYGWIN_DIR%\etc\defaults\etc\skel\.inputrc %CYGWIN_DIR%\etc\skel\.inputrc >NUL 2>&1 244 | ( 245 | echo. 246 | echo # %CONCYGSYS_INFO% 247 | echo "\e[1;5C": forward-word # ctrl + right 248 | echo "\e[1;5D": backward-word # ctrl + left 249 | echo # %CONCYGSYS_INFO% 250 | ) >> %CYGWIN_DIR%\etc\skel\.inputrc & dos2unix -q %CYGWIN_DIR%\etc\skel\.inputrc 251 | 252 | if not "%UPDATECYGWINONLY%" == "" goto :aftercygwinupdate 253 | ::========================================================== 254 | 255 | if "%INSTALL_APT_CYG%" == "yes" ( 256 | echo. & echo Installing apt-cyg... 257 | wget -nv --show-progress -O /usr/local/bin/apt-cyg https://github.com/transcode-open/apt-cyg/raw/master/apt-cyg 258 | chmod +x /usr/local/bin/apt-cyg 259 | ) 260 | 261 | if "%INSTALL_SSH_AGENT_TWEAK%" == "yes" ( 262 | echo. & echo Configuring ssh-agent... 263 | wget -nv --show-progress -O /etc/profile.d/ssh-agent-tweak.sh https://github.com/zhubanRuban/cygwin-extras/raw/master/ssh-agent-tweak 264 | grep -q AddKeysToAgent %CYGWIN_DIR%\etc\ssh_config >NUL 2>&1 || echo AddKeysToAgent yes >> %CYGWIN_DIR%\etc\ssh_config & dos2unix -q %CYGWIN_DIR%\etc\ssh_config 265 | :: removing previous possible ssh-agent implementations 266 | rm -f /opt/ssh-agent-tweak & sed -i '/\/opt\/ssh-agent-tweak/d' ~/.bashrc >NUL 2>&1 267 | ) 268 | 269 | set ADDONS_DIR=addons 270 | if not "%INSTALL_ADDONS%" == "" (echo. & echo Downloading addons... 271 | for %%a in (%INSTALL_ADDONS%) do (wget -nv --show-progress -NP %ADDONS_DIR% %%a) 272 | ) 273 | if exist "%ADDONS_DIR%" ( 274 | for %%a in (%ADDONS_DIR%\*) do (echo. & echo Installing addon: %%a ... & bash --noprofile --norc %%a) 275 | ) 276 | 277 | ::========================================================== 278 | 279 | :: Mintty options for ConEmu task: https://cdn.rawgit.com/mintty/mintty/master/docs/mintty.1.html#CONFIGURATION 280 | :: for better experience in running Mintty via ConEmu 281 | set MINTTY_OPTIONS= ^ 282 | -o FontHeight=10 ^ 283 | -o BoldAsFont=yes ^ 284 | -o AllowBlinking=yes ^ 285 | -o CopyOnSelect=yes ^ 286 | -o RightClickAction=paste ^ 287 | -o ScrollbackLines=5000 ^ 288 | -o Transparency=off ^ 289 | -o ConfirmExit=no 290 | 291 | set CONEMU_DIR=conemu 292 | set CONEMU_ARCHIVE=%CONEMU_DIR%.7z 293 | set CONEMU_CONFIG=%CONEMU_DIR%\ConEmu.xml 294 | 295 | if "%INSTALL_CONEMU%" == "yes" (echo. 296 | if not exist %CONEMU_DIR% ( 297 | echo Installing ConEmu... 298 | %BASH% "wget -nv --show-progress -O %CONEMU_ARCHIVE% https://github.com$(wget -qO- https://github.com/Maximus5/ConEmu/releases/latest|grep /.*/releases/download/.*/.*7z -o)" || goto :fail 299 | mkdir %CONEMU_DIR% >NUL 2>&1 300 | echo Extracting... & bsdtar -xf %CONEMU_ARCHIVE% -C %CONEMU_DIR% || goto :fail 301 | echo %CONCYGSYS_INFO% > %CONEMU_DIR%\DO-NOT-LAUNCH-CONEMU-FROM-HERE 302 | rm -f %CONEMU_ARCHIVE% 303 | ) 304 | rem Commented until ConEmu allows importing tasks via command line without replacing the whole config 305 | rem if not exist "%CONEMU_CONFIG%" ( 306 | echo Replacing ConEmu config... 307 | ( 308 | echo ^ 309 | echo ^