@@ -13,6 +13,7 @@ function usage(){
13
13
echo " -k keep all downloaded, extracted files in \" /tmp\" "
14
14
echo " -s skip downloading"
15
15
echo " -f forcibly update no matter what version it is"
16
+ echo " -e don't modify the environment (no /cmd in path, /etc/profile.d)"
16
17
echo " -h this prints me..."
17
18
exit
18
19
}
@@ -108,6 +109,8 @@ until [ $# -eq 0 ]; do
108
109
force_update=1; shift ;;
109
110
-s)
110
111
skip_download=1; shift ;;
112
+ -e)
113
+ no_env=1; shift ;;
111
114
-h)
112
115
usage; shift ;;
113
116
* )
@@ -188,72 +191,79 @@ process "/mingw$bit/share/git-core"
188
191
process " /mingw$bit /share/git-gui"
189
192
process -f " /mingw$bit /share/perl5"
190
193
process -f " /mingw$bit /ssl"
191
- process " /cmd"
192
- process -f " /etc/profile.d"
194
+ if [[ ! x$no_env == x1 ]]; then
195
+ process " /cmd"
196
+ process -f " /etc/profile.d"
197
+ else
198
+ cp -f $gitupk /cmd/* $bin
199
+ fi
193
200
cp -f $gitupk /usr/bin/git* $bin
194
201
195
- echo " "
196
- # Generating scripts
197
- ctxmenu=/cmd/ctxmenu.bat
198
- echo ' @echo off' > $ctxmenu
199
- echo ' ' >> $ctxmenu
200
- echo ' set /p=Adding "Git GUI Here" ... <nul' >> $ctxmenu
201
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f /ve /d "Git &GUI Here"' >> $ctxmenu
202
- echo ' set /p=Adding icon for "Git GUI Here" ... <nul' >> $ctxmenu
203
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f /v Icon /d "%~dp0\git-gui.exe"' >> $ctxmenu
204
- echo ' set /p=Adding command for "Git GUI Here" ... <nul' >> $ctxmenu
205
- if [[ " $system " == " Msys" ]]; then
206
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui\command" ' \
207
- ' /f /ve /d "\"%~dp0\git-gui.exe\" \"--working-dir\" \"%%v.\""' >> $ctxmenu
208
- else # Cygwin
209
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui\command" ' \
210
- ' /f /ve /d "cmd.exe /s /c \"set \"PATH=%~dp0\..\bin\" ' \
211
- ' ^&^& \"%~dp0\git-gui.exe\" \"--working-dir\" \"%%v.\"\""' >> $ctxmenu
212
- fi
213
- echo ' ' >> $ctxmenu
214
- echo ' set /p=Adding "Git Bash Here" ... <nul' >> $ctxmenu
215
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f /ve /d "Git Ba&sh Here"' >> $ctxmenu
216
- echo ' set /p=Adding icon for "Git Bash Here" ... <nul' >> $ctxmenu
217
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f /v Icon /d "%~dp0\git-gui.exe"' >> $ctxmenu
218
- echo ' set /p=Adding command for "Git Bash Here" ... <nul' >> $ctxmenu
219
- if [[ " $system " == " Msys" ]]; then
220
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command" ' \
221
- ' /f /ve /d "\"%~dp0..\usr\bin\mintty.exe\" -i /cmd/git-gui.exe /usr/bin/bash -c ' \
222
- ' \"cd ' " '%%v'; export CHERE_INVOKING=1; export MSYSTEM=MINGW$bit ; exec /usr/bin/bash --login -i" ' \""' >> $ctxmenu
223
- else # Cygwin
224
- echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command" ' \
225
- ' /f /ve /d "\"%~dp0..\bin\mintty.exe\" -i /cmd/git-gui.exe /bin/bash -c ' \
226
- ' \"cd ' " '%%v'; export CHERE_INVOKING=1; export PATH=/mingw$bit /bin:\$ PATH; exec /bin/bash --login -i" ' \""' >> $ctxmenu
227
- fi
228
- echo ' ' >> $ctxmenu
229
- echo ' pause' >> $ctxmenu
230
- chmod +x $ctxmenu
231
- echo " A batch script by which the \" Git GUI Here\" and \" Git Bash Here\" could "
232
- echo " be added to the context menu is available as $ctxmenu "
202
+ if [[ ! x$no_env == x1 ]]; then
203
+ echo " "
204
+ # Generating scripts
205
+ ctxmenu=/cmd/ctxmenu.bat
206
+ echo ' @echo off' > $ctxmenu
207
+ echo ' ' >> $ctxmenu
208
+ echo ' set /p=Adding "Git GUI Here" ... <nul' >> $ctxmenu
209
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f /ve /d "Git &GUI Here"' >> $ctxmenu
210
+ echo ' set /p=Adding icon for "Git GUI Here" ... <nul' >> $ctxmenu
211
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f /v Icon /d "%~dp0\git-gui.exe"' >> $ctxmenu
212
+ echo ' set /p=Adding command for "Git GUI Here" ... <nul' >> $ctxmenu
213
+ if [[ " $system " == " Msys" ]]; then
214
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui\command" ' \
215
+ ' /f /ve /d "\"%~dp0\git-gui.exe\" \"--working-dir\" \"%%v.\""' >> $ctxmenu
216
+ else # Cygwin
217
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui\command" ' \
218
+ ' /f /ve /d "cmd.exe /s /c \"set \"PATH=%~dp0\..\bin\" ' \
219
+ ' ^&^& \"%~dp0\git-gui.exe\" \"--working-dir\" \"%%v.\"\""' >> $ctxmenu
220
+ fi
221
+ echo ' ' >> $ctxmenu
222
+ echo ' set /p=Adding "Git Bash Here" ... <nul' >> $ctxmenu
223
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f /ve /d "Git Ba&sh Here"' >> $ctxmenu
224
+ echo ' set /p=Adding icon for "Git Bash Here" ... <nul' >> $ctxmenu
225
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f /v Icon /d "%~dp0\git-gui.exe"' >> $ctxmenu
226
+ echo ' set /p=Adding command for "Git Bash Here" ... <nul' >> $ctxmenu
227
+ if [[ " $system " == " Msys" ]]; then
228
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command" ' \
229
+ ' /f /ve /d "\"%~dp0..\usr\bin\mintty.exe\" -i /cmd/git-gui.exe /usr/bin/bash -c ' \
230
+ ' \"cd ' " '%%v'; export CHERE_INVOKING=1; export MSYSTEM=MINGW$bit ; exec /usr/bin/bash --login -i" ' \""' >> $ctxmenu
231
+ else # Cygwin
232
+ echo ' reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command" ' \
233
+ ' /f /ve /d "\"%~dp0..\bin\mintty.exe\" -i /cmd/git-gui.exe /bin/bash -c ' \
234
+ ' \"cd ' " '%%v'; export CHERE_INVOKING=1; export PATH=/mingw$bit /bin:\$ PATH; exec /bin/bash --login -i" ' \""' >> $ctxmenu
235
+ fi
236
+ echo ' ' >> $ctxmenu
237
+ echo ' pause' >> $ctxmenu
238
+ chmod +x $ctxmenu
239
+ echo " A batch script by which the \" Git GUI Here\" and \" Git Bash Here\" could "
240
+ echo " be added to the context menu is available as $ctxmenu "
233
241
234
- echo " "
235
- rm_ctxmenu=/cmd/rm-ctxmenu.bat
236
- echo ' @echo off' > $rm_ctxmenu
237
- echo ' ' >> $rm_ctxmenu
238
- echo ' set /p=Deleting "Git GUI Here" ... <nul' >> $rm_ctxmenu
239
- echo ' reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f' >> $rm_ctxmenu
240
- echo ' set /p=Deleting "Git Bash Here" ... <nul' >> $rm_ctxmenu
241
- echo ' reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f' >> $rm_ctxmenu
242
- echo ' pause' >> $rm_ctxmenu
243
- echo ' ' >> $rm_ctxmenu
244
- chmod +x $rm_ctxmenu
245
- echo " A batch script by which the \" Git GUI Here\" and \" Git Bash Here\" could "
246
- echo " be removed from the context menu is available as $rm_ctxmenu "
242
+ echo " "
243
+ rm_ctxmenu=/cmd/rm-ctxmenu.bat
244
+ echo ' @echo off' > $rm_ctxmenu
245
+ echo ' ' >> $rm_ctxmenu
246
+ echo ' set /p=Deleting "Git GUI Here" ... <nul' >> $rm_ctxmenu
247
+ echo ' reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui" /f' >> $rm_ctxmenu
248
+ echo ' set /p=Deleting "Git Bash Here" ... <nul' >> $rm_ctxmenu
249
+ echo ' reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell" /f' >> $rm_ctxmenu
250
+ echo ' pause' >> $rm_ctxmenu
251
+ echo ' ' >> $rm_ctxmenu
252
+ chmod +x $rm_ctxmenu
253
+ echo " A batch script by which the \" Git GUI Here\" and \" Git Bash Here\" could "
254
+ echo " be removed from the context menu is available as $rm_ctxmenu "
247
255
248
- echo " "
249
- # Setting ENV
250
- echo -n " Setting env ..."
251
- userpath=$( reg query " HKEY_CURRENT_USER\Environment" //v Path 2> /dev/null | awk ' NR==3 {print $NF}' )
252
- if [[ " $userpath " == " " ]]; then
253
- setx PATH " $( cygpath -m /cmd) " > /dev/null 2>&1
254
- elif [[ " $userpath " != * " $( cygpath -m /cmd) " * ]]; then
255
- setx PATH " $( cygpath -m /cmd) ;$userpath " > /dev/null 2>&1
256
+ echo " "
257
+ # Setting ENV
258
+ echo -n " Setting env ..."
259
+ userpath=$( reg query " HKEY_CURRENT_USER\Environment" //v Path 2> /dev/null | awk ' NR==3 {print $NF}' )
260
+ if [[ " $userpath " == " " ]]; then
261
+ setx PATH " $( cygpath -m /cmd) " > /dev/null 2>&1
262
+ elif [[ " $userpath " != * " $( cygpath -m /cmd) " * ]]; then
263
+ setx PATH " $( cygpath -m /cmd) ;$userpath " > /dev/null 2>&1
264
+ fi
256
265
fi
266
+
257
267
echo done
258
268
259
269
echo " "
274
284
echo " Git is now available! If you want to add \" Git GUI Here\" and \" Git Bash"
275
285
echo " Here\" to the context menu, please help yourself with it using the "
276
286
echo " $ctxmenu script. If you want to use \" git svn\" , please install"
277
- echo " perl and subversion via $install_via_this "
287
+ echo " perl and subversion via $install_via_this "
0 commit comments