This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
creator.cmd
77 lines (66 loc) · 1.73 KB
/
creator.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@rem
@rem Copyright © since 2013 Lars Knickrehm, [email protected]
@rem
@rem This script creates a pseudo prompt for Windows users to comfortably enter
@rem command line arguments for the installer creator script.
@rem Disable too many output.
@echo off
rem Path to cygwin directory
set cygwin_path=C:\cygwin64
if not exist "%cygwin_path%\bin\bash.exe" (
goto notFound
)
rem Set path variables
set file=%~n0
set path=%~dp0
rem Lower case drive letter, replace back slashes by slashes and remove colons.
set drive=%path:~0,1%
SET drive=%drive:A=a%
SET drive=%drive:B=b%
SET drive=%drive:C=c%
SET drive=%drive:D=d%
SET drive=%drive:E=e%
SET drive=%drive:F=f%
SET drive=%drive:G=g%
SET drive=%drive:H=h%
SET drive=%drive:I=i%
SET drive=%drive:J=j%
SET drive=%drive:K=k%
SET drive=%drive:L=l%
SET drive=%drive:M=m%
SET drive=%drive:n=n%
SET drive=%drive:O=o%
SET drive=%drive:P=p%
SET drive=%drive:Q=q%
SET drive=%drive:R=r%
SET drive=%drive:S=s%
SET drive=%drive:T=t%
SET drive=%drive:U=u%
SET drive=%drive:V=v%
SET drive=%drive:W=w%
SET drive=%drive:X=x%
SET drive=%drive:Y=y%
SET drive=%drive:Z=z%
set unix_path=%path:\=/%
set unix_path=%drive%%unix_path:~2%
rem Remember current working directory in order to revert it correctly.
set old_cd=%CD%
cd /d "%cygwin_path%\bin"
rem Show the installer creator help.
echo %path:~0,-1%>"%file%.sh" --help
bash --login -i -- "/cygdrive/%unix_path%/%file%.sh" --help
echo.
rem Read arguments.
set /P args="%path:~0,-1%>%file%.sh "
echo.
rem Pass through all given arguments.
bash --login -i -- "/cygdrive/%unix_path%/%file%.sh" %args%
rem Revert working directory.
cd /d "%old_cd%"
echo.
pause
goto:eof
:notFound
echo Cygwin not found.
echo.
pause