Skip to content

Instantly share code, notes, and snippets.

@lclibardi
Last active May 9, 2020 00:03
Show Gist options
  • Save lclibardi/1d5571af79890af4597aee95730e9498 to your computer and use it in GitHub Desktop.
Save lclibardi/1d5571af79890af4597aee95730e9498 to your computer and use it in GitHub Desktop.
Cygwin Windows Installation
@echo off
set curdir=%~dp0
if not exist "%curdir%\setup-x86_64.exe" (
wget "https://cygwin.com/setup-x86_64.exe"
)
set packages="bash,bash-completion,bind-utils,bzip2,ca-certificates,curl,cygwin-devel,git,git-svn,iso-codes,libOpenCL1,libatomic1,libbz2_1,libcurl4,libncursesw10,libopencv3.4,libopenssl100,libssh-common,libssh2_1,libssh4,libssl1.1,libzip,libzip2,lynx,nano,ncurses,opencv,openssh,openssl,python-pip-wheel,python-setuptools-wheel,python3,python3-appdirs,python3-bcrypt,python3-cffi,python3-chardet,python3-cv2,python3-imaging,python3-packaging,python3-paramiko,python3-ply,python3-pycparser,python3-pygments,python3-pyparsing,python3-setuptools,python3-six,python3-tkinter,python37,python37-asn1crypto,python37-bs4,python37-cffi,python37-cryptography,python37-html5lib,python37-imaging,python37-ipaddress,python37-lxml,python37-numpy,python37-openssl,python37-ply,python37-pycparser,python37-pyparsing,python37-requests,python37-setuptools,python37-six,python37-tkinter,python37-urllib3,rsync,ssh,subversion,tar,wget"
rem Install cygwin
%curdir%\setup-x86_64.exe -q -L -l "%curdir%\local" -P %packages%
if /i "%errorlevel%" equ "1" (
echo "Unable to install Cygwin, please install manually!"
pause
exit
)
rem Add cygwin tools to PATH
set PATH=%PATH%;C:\cygwin64\bin
rem Configure ssh server
bash --login -c "ssh-host-config -y"
rem Start sshd service
net start sshd
set rule_name=SSH
set port=22
rem Check if inbound SSH rule already exists
netsh advfirewall firewall show rule name="%rule_name%" dir="in" > nul
if /i "%errorlevel%" equ "1" (
echo Creating inbound %rule_name% firewal rule for port %port%
netsh advfirewall firewall add rule name=%rule_name% dir="in" localport=%port% protocol="TCP" action="allow"
)
rem Check of outbound SSH rule already exists
netsh advfirewall firewall show rule name="%rule_name%" dir="out" > nul
if /i "%errorlevel%" equ "1" (
echo Creating outbound %rule_name% firewal rule for port %port%
netsh advfirewall firewall add rule name=%rule_name% dir="out" localport=%port% protocol="TCP" action="allow"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment