source: hadoop4win-setup/hadoop4win-setup.bat

Last change on this file was 242, checked in by jazz, 13 years ago
  • modified hadoop4win-setup.bat
    • remove copying hadoop/conf-examples
  • removed my_packages/hadoop/conf-examples
  • modified hadoop4win-init
    • [BUGFIX] when using conf-examples, Win7 will not able to set the correct permission. Now we use copy default conf folder to conf-pseudo.
  • Property svn:executable set to *
File size: 6.0 KB
Line 
1@echo off
2
3REM ####################################################################
4REM # Unattended hadoop for windows installation
5REM #
6REM # License     : GPL
7REM # Author      : Jazz Yao-Tsung Wang <jazz@nchc.org.tw>
8REM # Last update : $Date$
9REM # Version   : $Rev$
10REM #
11REM # Usage: hadoop4win-setup.bat
12REM #
13REM # References:
14REM # [1] Henrik Bengtsson, Unattended Cygwin Installation, June 2, 2004.
15REM #     http://www.maths.lth.se/help/windows/cygwin/
16REM # [2] DRBL-WinRoll
17REM #     http://drbl.nchc.org.tw/drbl-winroll
18REM #     This script is modified from winroll-setup.bat
19REM ####################################################################
20
21set JDK_FILE=jdk1.6.0_18.zip
22set ANT_FILE=ant-current-bin.zip
23set HBASE_FILE=hbase-0.20.6.tar.gz
24set HADOOP_FILE=hadoop-0.20.2.tar.gz
25set JDK_MIRROR=http://www.classcloud.org/hadoop4win
26set ANT_MIRROR=http://ftp.twaren.net/Unix/Web/apache/ant/
27set HBASE_MIRROR=http://ftp.twaren.net/Unix/Web/apache/hbase/hbase-0.20.6/
28set HADOOP_MIRROR=http://ftp.twaren.net/Unix/Web/apache/hadoop/core/hadoop-0.20.2
29set CYGWIN_ROOT=C:\hadoop4win
30set LOCAL_REPOSITORY=%cd%
31set CYGWIN_SETUP=%LOCAL_REPOSITORY%\cygwin_mirror\cyg-setup.exe
32set OLDPATH=%PATH%
33set PATH=%PATH%;%cd%\bin
34set CYGWIN=nodosfilewarning
35
36set MY_PACKAGE=%LOCAL_REPOSITORY%\my_packages
37set ANT_SRC=%MY_PACKAGE%\ant\%ANT_FILE%
38set ANT_DES=%CYGWIN_ROOT%\usr\src
39set JDK_SRC=%MY_PACKAGE%\jdk\%JDK_FILE%
40set JDK_DES=%CYGWIN_ROOT%\usr\src
41set HBASE_SRC=%MY_PACKAGE%\hbase\%HBASE_FILE%
42set HBASE_DES=%CYGWIN_ROOT%\usr\src
43set HADOOP_SRC=%MY_PACKAGE%\hadoop\%HADOOP_FILE%
44set HADOOP_DES=%CYGWIN_ROOT%\usr\src
45
46REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47REM Assert that there exists a valid %LOCAL_REPOSITORY% directory.
48REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49
50IF NOT EXIST "%LOCAL_REPOSITORY%" (
51  echo "ERROR: %LOCAL_REPOSITORY% DON'T EXIST"
52  exit /B 1
53)
54
55IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror" (
56  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror DON'T EXIST"
57  exit /B 1
58)
59
60IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\release" (
61  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\release DON'T EXIST"
62  exit /B 1
63)
64
65IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\setup.ini" (
66  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\setup.ini DON'T EXIST"
67  exit /B 1
68)
69
70IF NOT EXIST "%CYGWIN_SETUP%" (
71  echo "ERROR: %CYGWIN_SETUP% DON'T EXIST"
72  exit /B 1
73)
74
75REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
76REM Create a fake installation skeleton for Cygwin setup
77REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78IF NOT EXIST "%CYGWIN_ROOT%" (
79  mkdir "%CYGWIN_ROOT%"
80)
81
82IF NOT EXIST "%CYGWIN_ROOT%\etc\setup" (
83  mkdir "%CYGWIN_ROOT%\etc\setup"
84) ELSE (
85  del /Q "%CYGWIN_ROOT%\etc\setup\last-*"
86)
87
88REM -- Note that last-* must *not* containing whitespace, e.g. " " etc.
89REM -- This is why there below is no space in front of ">".
90
91echo Install > "%CYGWIN_ROOT%\etc\setup\last-action"
92echo %LOCAL_REPOSITORY% > "%CYGWIN_ROOT%\etc\setup\last-cache"
93echo cygwin_mirror > "%CYGWIN_ROOT%\etc\setup\last-mirror"
94echo "" > "%CYGWIN_ROOT%\etc\setup\setup.rc"
95echo "" > "%CYGWIN_ROOT%\etc\setup\net-method"
96echo "" > "%CYGWIN_ROOT%\etc\setup\net-proxy-host"
97echo "" > "%CYGWIN_ROOT%\etc\setup\net-proxy-port"
98echo "" > "%CYGWIN_ROOT%\etc\setup\extrakeys"
99echo "" > "%CYGWIN_ROOT%\etc\setup\chooser_window_settings"
100echo "" > "%CYGWIN_ROOT%\etc\setup\installed.db"
101echo "" > "%CYGWIN_ROOT%\etc\setup\timestamp"
102
103REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
104REM Finally, run Cygwin setup quietly
105REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
106
107echo To run  %CYGWIN_SETUP% -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%"
108
109REM real do cygwin installation
110
111"%CYGWIN_SETUP%" -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%"
112REM "%CYGWIN_SETUP%" -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%" -P cygrunsrv,file,openssh,perl,procps,ncurses,rsync,sharutils,shutdown,subversion,tcp_wrappers,termcap,unzip,wget,zip,zlib
113
114REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115REM Installation of Hadoop and JDK
116REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117
118IF NOT EXIST "%JDK_SRC%" (
119  wget "%JDK_MIRROR%/%JDK_FILE%" -O "%MY_PACKAGE%\jdk\%JDK_FILE%"
120)
121
122IF NOT EXIST "%ANT_SRC%" (
123  wget "%ANT_MIRROR%/%ANT_FILE%" -O "%MY_PACKAGE%\ant\%ANT_FILE%"
124)
125
126IF NOT EXIST "%HBASE_SRC%" (
127  wget "%HBASE_MIRROR%/%HBASE_FILE%" -O "%MY_PACKAGE%\hbase\%HBASE_FILE%"
128)
129
130IF NOT EXIST "%HADOOP_SRC%" (
131  wget "%HADOOP_MIRROR%/%HADOOP_FILE%" -O "%MY_PACKAGE%\hadoop\%HADOOP_FILE%"
132)
133
134IF NOT EXIST "%JDK_DES%" (
135  mkdir "%JDK_DES%"
136)
137
138IF NOT EXIST "%ANT_DES%" (
139  mkdir "%ANT_DES%"
140)
141
142IF NOT EXIST "%HBASE_DES%" (
143  mkdir "%HBASE_DES%"
144)
145
146IF NOT EXIST "%HADOOP_DES%" (
147  mkdir "%HADOOP_DES%"
148)
149
150IF NOT EXIST "%CYGWIN_ROOT%\lib\jvm" (
151  copy "%JDK_SRC%" "%JDK_DES%"
152)
153
154IF NOT EXIST "%CYGWIN_ROOT%\opt\ant" (
155  copy "%ANT_SRC%" "%ANT_DES%"
156)
157
158IF NOT EXIST "%CYGWIN_ROOT%\opt\hbase" (
159  copy "%HBASE_SRC%" "%HBASE_DES%"
160)
161
162IF NOT EXIST "%CYGWIN_ROOT%\opt\hadoop" (
163  copy "%HADOOP_SRC%" "%HADOOP_DES%"
164)
165
166copy /Y "%MY_PACKAGE%\ant\bin\*" "%CYGWIN_ROOT%\bin"
167copy /Y "%MY_PACKAGE%\hbase\bin\*" "%CYGWIN_ROOT%\bin"
168copy /Y "%MY_PACKAGE%\hadoop\bin\*" "%CYGWIN_ROOT%\bin"
169
170cls
171echo "====================================================="
172echo " run `hadoop4win-init' to extract Hadoop and JDK to "
173echo " proper PATH. It will format HDFS Namenode, too."
174echo "=====================================================" 
175%CYGWIN_ROOT%\bin\bash --login -c "/bin/hadoop4win-init"
176%CYGWIN_ROOT%\bin\bash --login -c "/bin/ant-init"
177%CYGWIN_ROOT%\bin\bash --login -c "/bin/hbase-init"
178cls
179set PATH=%OLDPATH%
180CALL "%CYGWIN_ROOT%\Cygwin.bat"
Note: See TracBrowser for help on using the repository browser.