forked from vgough/encfs
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathpackage.bat
165 lines (114 loc) · 4.32 KB
/
package.bat
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@ECHO OFF
REM build.bat
REM *****************************************************************************
REM Author: Charles Munson <jetwhiz@jetwhiz.com>
REM
REM ****************************************************************************
REM Copyright (c) 2019, Charles Munson
REM
REM This program is free software: you can redistribute it and/or modify it
REM under the terms of the GNU Lesser General Public License as published by the
REM Free Software Foundation, either version 3 of the License, or (at your
REM option) any later version.
REM
REM This program is distributed in the hope that it will be useful, but WITHOUT
REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
REM for more details.
REM
REM You should have received a copy of the GNU Lesser General Public License
REM along with this program. If not, see <http://www.gnu.org/licenses/>.
REM Up front environment variables
set PROJECT_DIR=%CD%
set DEP_DIR="%PROJECT_DIR%\..\encfs-bin\"
set PRODUCT_VERSION="1.10.2"
set DOKAN_VERSION="1.3.1.1000"
REM Make sure nsis is installed
echo Looking for NSIS installation ...
where /q makensis || goto :no_nsis
echo.
REM Make sure dependencies exist
echo.
echo Checking encfs binaries ...
echo Looking for encfs\win\dialog-password.ico ...
if NOT exist "%PROJECT_DIR%\encfs\win\dialog-password.ico" goto :no_deps
echo Looking for encfs\Release\encfs.exe ...
if NOT exist "%PROJECT_DIR%\encfs\Release\encfs.exe" goto :no_deps
echo Looking for encfs\Release\encfsctl.exe ...
if NOT exist "%PROJECT_DIR%\encfs\Release\encfsctl.exe" goto :no_deps
echo Looking for encfs\Release\encfsw.exe ...
if NOT exist "%PROJECT_DIR%\encfs\Release\encfsw.exe" goto :no_deps
echo.
echo Checking openssl binaries in '%OPENSSL_ROOT%' ...
echo Looking for libeay32.dll ...
if NOT exist "%OPENSSL_ROOT%\bin\libeay32.dll" goto :no_deps
echo Looking for ssleay32.dll ...
if NOT exist "%OPENSSL_ROOT%\bin\ssleay32.dll" goto :no_deps
echo.
echo Checking dependencies folder '%DEP_DIR%'
echo Looking for encfs4win.ico ...
if NOT exist "%DEP_DIR%\encfs4win.ico" goto :no_deps
echo Looking for DokanSetup_redist-%DOKAN_VERSION%.exe
if NOT exist "%DEP_DIR%\DokanSetup_redist-%DOKAN_VERSION%.exe" goto :no_deps
REM Package encfs
echo.
echo ==================================================
echo BUILDING ENCFS INSTALLER
echo ==================================================
if exist "%DEP_DIR%\encfs-installer.exe" del "%DEP_DIR%\encfs-installer.exe"
makensis /V3 /DDOKAN_VERSION="%DOKAN_VERSION%" /DPRODUCT_VERSION="%PRODUCT_VERSION%" "%PROJECT_DIR%\encfs\encfs-installer.nsi"
REM verify necessary executables were successfully built
if NOT exist "%DEP_DIR%\encfs-installer.exe" goto :pkg_failure
echo.
echo ==================================================
echo PACKAGING ENCFS ZIP
echo ==================================================
where /q 7z
IF ERRORLEVEL 1 (
echo Cannot find 7z, skipping zip creation
) ELSE (
if exist "%DEP_DIR%\encfs-nodeps.zip" del "%DEP_DIR%\encfs-nodeps.zip"
7z a -aos "%DEP_DIR%\encfs-nodeps.zip"^
"%PROJECT_DIR%\encfs\win\dialog-password.ico"^
"%PROJECT_DIR%\encfs\Release\encfs.exe"^
"%PROJECT_DIR%\encfs\Release\encfsctl.exe"^
"%PROJECT_DIR%\encfs\Release\encfsw.exe"^
"%OPENSSL_ROOT%\bin\libeay32.dll"^
"%OPENSSL_ROOT%\bin\ssleay32.dll"
REM verify necessary executables were successfully built
if NOT exist "%DEP_DIR%\encfs-nodeps.zip" goto :pkg_failure
)
goto :pkg_success
:pkg_success
echo.
echo ==================================================
echo Encfs successfully packaged!
echo ==================================================
echo.
goto :end
:pkg_failure
echo.
echo ==================================================
echo Failed to package Encfs!
echo ==================================================
echo.
exit /b 1
goto :end
:no_deps
echo.
echo ==================================================
echo Could not find needed dependencies!
echo ==================================================
echo.
exit /b 1
goto :end
:no_nsis
echo.
echo ==================================================
echo NSIS is required to package this project!
echo ==================================================
echo.
exit /b 1
goto :end
:end
exit /b 0