-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.cmd
204 lines (158 loc) · 6.43 KB
/
install.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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
@echo off
setlocal enableextensions enabledelayedexpansion
:: Set variables
call "%~dp0utils\set_dirs.cmd"
call "%~dp0utils\set_recipes.cmd"
if %errorlevel% neq 0 exit /b 1
set "lang_list=en-US (default), zh-HK"
set "is_installer_exist=unknown"
:: Show Notice
echo.
echo Usage:
echo.
echo install [en-US ^| zh-HK]
echo.
echo - Expect all installers are correct version in "downloads" directory
echo - Expect language of all applications is as same as language of OS
echo - Only work on Windows 10 x64 (not x86)
echo - For details: https://github.com/Edditoria/windows-initial-setup
echo.
:: Show Licenses
echo Before you install any package, please read their license agreements.
echo When you download and install, you already agree their terms.
echo Please read them carefully:
echo - This script: https://github.com/Edditoria/windows-initial-setup/blob/master/LICENSE.txt
echo - 7-Zip: https://www.7-zip.org/license.txt
echo - Adobe Acrobat Reader DC: https://www.adobe.com/content/dam/acom/en/legal/licenses-terms/pdf/PlatformClients_PC_WWEULA-en_US-20150407_1357.pdf
echo - CDBurnerXP: https://cdburnerxp.se/help/intro/license
echo - Google Chrome: https://www.google.com/chrome/browser/privacy/eula_text.html
echo - Java Runtime (JRE): https://www.oracle.com/downloads/licenses/javase-license1.html
echo - LibreOffice: https://www.libreoffice.org/about-us/licenses
echo - VLC Media Player: https://www.videolan.org/legal.html
echo.
:: Check Admin Rights
call "%utils_dir%is_admin.cmd" true
echo.
if "%is_admin%"=="true" goto is_admin_pass
:: else
exit /b 1
:is_admin_pass
:: Language
set "lang=%~1"
if "[%lang%]"=="[]" (
set "lang=en-US"
echo You are going to install in language: !lang!
goto lang_pass
)
if "%lang%"=="en-US" (
echo You are going to install in language: %lang%
goto lang_pass
)
if "%lang%"=="zh-HK" (
echo You are going to install in language: %lang%
goto lang_pass
)
:: else
echo [error] Argument(s) is not supported
echo Acceptable arguments: %lang_list%
exit /b 1
:lang_pass
echo.
:: Check Installation Files
call "%utils_dir%is_installer_exist.cmd" "%a_7_zip_x64_filename%"
call "%utils_dir%is_installer_exist.cmd" "%adobe_acrobat_reader_filename%"
call "%utils_dir%is_installer_exist.cmd" "%cdburnerxp_filename%"
call "%utils_dir%is_installer_exist.cmd" "%google_chrome_x64_filename%"
call "%utils_dir%is_installer_exist.cmd" "%java_x86_filename%"
call "%utils_dir%is_installer_exist.cmd" "%java_x64_filename%"
call "%utils_dir%is_installer_exist.cmd" "%libreoffice_filename%"
call "%utils_dir%is_installer_exist.cmd" "%vlc_x64_filename%"
:: note: %is_installer_exist% will change from "unknown" to "false" if any file is missing
:: note: %is_installer_exist% will not becomes "true"
if "%is_installer_exist%"=="false" (
exit /b 1
)
:: Ask for Confirmation
set /p "start_install=Do you want to start the installations? (type [y] to continue) "
if "%start_install%"=="y" goto confirm_pass
:: else
echo.
echo [error] This script will continue only if you answer "y"
exit /b 1
:confirm_pass
echo.
:: Install Google Chrome
echo Installing %google_chrome_x64_fullname%...
start /w "" msiexec /i "%downloads_dir%%google_chrome_x64_filename%" /passive /norestart
echo Setting options...
set "master_preferences=Google\Chrome\Application\master_preferences"
if exist "%PROGRAMFILES(X86)%\%master_preferences%" (
copy /y "%recipes_dir%%google_chrome_recipe_name%\master_preferences.json" "%PROGRAMFILES(X86)%\%master_preferences%"
)
if exist "%PROGRAMFILES%\%master_preferences%" (
copy /y "%recipes_dir%%google_chrome_recipe_name%\master_preferences.json" "%PROGRAMFILES%\%master_preferences%"
)
echo [done]
echo.
:: Install VLC
echo Installing %vlc_x64_fullname%...
start /w "" "%downloads_dir%%vlc_x64_filename%" /S
echo Setting options...
reg import "%recipes_dir%%vlc_recipe_name%\options.%lang%.reg"
echo Simplifying app list in start menu...
copy /y "%program_menu_allusers%VideoLAN\VLC media player.lnk" "%program_menu_allusers%VLC media player.lnk"
rmdir /s /q "%program_menu_allusers%VideoLAN"
echo [done]
echo.
:: Install LibreOffice
echo Installing %libreoffice_fullname%...
set "install_args=ADDLOCAL=ALL ALLUSERS=1 CREATEDESKTOPLINK=1 RebootYesNo=No ISCHECKFORPRODUCTUPDATES=1 REGISTER_ALL_MSO_TYPES=1 VC_REDIST=1 QUICKSTART=0"
start /w "" msiexec /i "%downloads_dir%%libreoffice_filename%" /passive /norestart %install_args%
echo Setting options...
set "options_dir=%APPDATA%\LibreOffice\4\user\"
mkdir "%options_dir%"
copy /y "%recipes_dir%%libreoffice_recipe_name%\registrymodifications.xcu.%lang%.xml" "%options_dir%registrymodifications.xcu"
echo [done]
echo.
:: Install Adobe Acrobat Reader DC
echo Installing %adobe_acrobat_reader_fullname%...
if "%lang%"=="en-US" set "adobe_lang_id=1033"
if "%lang%"=="zh-HK" set "adobe_lang_id=1028"
set "install_args=/sPB /rs /norestart /sl %adobe_lang_id% /msi ALLUSERS=1 ENABLE_CHROMEEXT=0 EULA_ACCEPT=YES"
start /w "" "%downloads_dir%%adobe_acrobat_reader_filename%" %install_args%
echo [done]
echo.
:: Install CDBurnerXP
echo Installing %cdburnerxp_fullname%...
set "install_args=/silent /sp- /norestart /q /v^"ALLUSERS=2 /qn^" /loadinf=^"%recipes_dir%%cdburnerxp_recipe_name%\options.%lang%.cfg^""
start /w "" "%downloads_dir%%cdburnerxp_filename%" %install_args%
echo Setting options...
reg import "%recipes_dir%%cdburnerxp_recipe_name%\options.%lang%.reg"
set "options_dir=%ALLUSERSPROFILE%\Canneverbe Limited\CDBurnerXP\"
mkdir "%options_dir%"
copy /y "%recipes_dir%%cdburnerxp_recipe_name%\Application.ini" "%options_dir%Application.ini"
echo [done]
echo.
:: Install 7-Zip
echo Installing %a_7_zip_x64_fullname%...
start /w "" "%downloads_dir%%a_7_zip_x64_filename%" /S
echo Setting options...
reg import "%recipes_dir%%a_7_zip_recipe_name%\options.reg"
reg import "%recipes_dir%%a_7_zip_recipe_name%\options.%lang%.reg"
echo Simplifying app list in start menu,
copy /y "%program_menu_allusers%7-Zip\7-Zip File Manager.lnk" "%program_menu_allusers%7-Zip File Manager.lnk"
echo and adding shortcut to Desktop...
copy /y "%program_menu_allusers%7-Zip\7-Zip File Manager.lnk" "%USERPROFILE%\Desktop\7-Zip File Manager.lnk"
rmdir /s /q "%program_menu_allusers%7-Zip"
echo [done]
echo.
:: Install JRE
set "install_args=/s auto_update=1 web_analytics=0 eula=0 reboot=0 sponsors=0 removeoutofdatejres=1"
echo Installing %java_x86_fullname%...
start /w "" "%downloads_dir%%java_x86_filename%" %install_args%
echo [done]
echo.
echo Installing %java_x64_fullname%...
start /w "" "%downloads_dir%%java_x64_filename%" %install_args%
echo [done]
echo.