source: hadoop4win-setup/hadoop4win-setup.bat @ 133

Last change on this file since 133 was 133, checked in by jazz, 14 years ago

Cygwin setup.exe -q 只會安裝 Base 的套件,因此要透過 -P 指定要額外安裝的套件

  • Property svn:executable set to *
File size: 4.5 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 HADOOP_FILE=hadoop-0.20.1.tar.gz
22set HADOOP_MIRROR=http://ftp.twaren.net/Unix/Web/apache/hadoop/core/hadoop-0.20.1/
23set JDK_FILE=jdk1.6.0_18.zip
24set JDK_MIRROR=http://tsmc.classcloud.org/
25set CYGWIN_ROOT=C:\hadoop4win
26set LOCAL_REPOSITORY=%cd%
27set CYGWIN_SETUP=%LOCAL_REPOSITORY%\cygwin_mirror\cyg-setup.exe
28set PATH=%PATH%;%cd%\bin
29
30set MY_PACKAGE=%LOCAL_REPOSITORY%\my_packages
31set HADOOP_SRC=%MY_PACKAGE%\hadoop\hadoop-*.gz
32set HADOOP_DES=%CYGWIN_ROOT%\usr\src
33set JDK_SRC=%MY_PACKAGE%\jdk\jdk*.zip
34set JDK_DES=%CYGWIN_ROOT%\usr\src
35
36REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37REM Assert that there exists a valid %LOCAL_REPOSITORY% directory.
38REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39
40IF NOT EXIST "%LOCAL_REPOSITORY%" (
41  echo "ERROR: %LOCAL_REPOSITORY% DON'T EXIST"
42  exit /B 1
43)
44
45IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror" (
46  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror DON'T EXIST"
47  exit /B 1
48)
49
50IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\release" (
51  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\release DON'T EXIST"
52  exit /B 1
53)
54
55IF NOT EXIST "%LOCAL_REPOSITORY%\cygwin_mirror\setup.ini" (
56  echo "ERROR: %LOCAL_REPOSITORY%\cygwin_mirror\setup.ini DON'T EXIST"
57  exit /B 1
58)
59
60IF NOT EXIST "%CYGWIN_SETUP%" (
61  echo "ERROR: %CYGWIN_SETUP% DON'T EXIST"
62  exit /B 1
63)
64
65REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66REM Create a fake installation skeleton for Cygwin setup
67REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
68IF NOT EXIST "%CYGWIN_ROOT%" (
69  mkdir "%CYGWIN_ROOT%"
70)
71
72IF NOT EXIST "%CYGWIN_ROOT%\etc\setup" (
73  mkdir "%CYGWIN_ROOT%\etc\setup"
74) ELSE (
75  del /Q "%CYGWIN_ROOT%\etc\setup\last-*"
76)
77
78REM -- Note that last-* must *not* containing whitespace, e.g. " " etc.
79REM -- This is why there below is no space in front of ">".
80
81echo Install > "%CYGWIN_ROOT%\etc\setup\last-action"
82echo %LOCAL_REPOSITORY% > "%CYGWIN_ROOT%\etc\setup\last-cache"
83echo cygwin_mirror > "%CYGWIN_ROOT%\etc\setup\last-mirror"
84
85REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86REM Finally, run Cygwin setup quietly
87REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88
89echo To run  %CYGWIN_SETUP% -q -d -L -l "%LOCAL_REPOSITORY%\cygwin_mirror" -R "%CYGWIN_ROOT%"
90
91REM real do cygwin installation
92
93"%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
94
95REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
96REM Installation of Hadoop and JDK
97REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
98
99IF NOT EXIST "%HADOOP_SRC%" (
100  wget "%HADOOP_MIRROR%/%HADOOP_FILE%" -O "%MY_PACKAGE%\hadoop\%HADOOP_FILE%"
101)
102
103IF NOT EXIST "%JDK_SRC%" (
104  wget "%JDK_MIRROR%/%JDK_FILE%" -O "%MY_PACKAGE%\jdk\%JDK_FILE%"
105)
106
107IF NOT EXIST "%JDK_DES%" (
108  mkdir "%JDK_DES%"
109)
110
111IF NOT EXIST "%CYGWIN_ROOT%\opt\hadoop" (
112  copy "%HADOOP_SRC%" "%HADOOP_DES%"
113)
114
115IF NOT EXIST "%CYGWIN_ROOT%\lib\jvm" (
116  copy "%JDK_SRC%" "%JDK_DES%"
117)
118
119copy /Y "%MY_PACKAGE%\hadoop\bin\*" "%CYGWIN_ROOT%\bin"
120xcopy /Y /E /I "%MY_PACKAGE%\hadoop\conf-examples" "%HADOOP_DES%\conf-examples"
121
122cls
123echo "====================================================="
124echo " Please run `hadoop4win-init' to extract Hadoop and"
125echo " JDK to proper PATH. It will format HDFS Namenode, too."
126echo " ."
127echo " Use `start-hadoop' and `stop-hadoop' to run single"
128echo " machine hadoop configuration."
129echo " ."
130echo " Use `jps' to check java process for troubleshooting."
131echo "====================================================="
132 
133CALL "%CYGWIN_ROOT%\Cygwin.bat"
Note: See TracBrowser for help on using the repository browser.