annotate etc/check_cygwin_setup.sh @ 436:080151679be2 r21-2-26

Import from CVS: tag r21-2-26
author cvs
date Mon, 13 Aug 2007 11:31:24 +0200
parents 3ecd8885ac67
children 98fb34b6fbe9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 #! bash
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 yorn()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 echo -n " [y/n] "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 read YN junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 if [ "$YN" = "n" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 return -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 echo -n "checking for cygwin..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 if ! uname -v
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 echo "couldn't find uname please add cygwin to your path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 exit -1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 OSversion="`uname -v | sed 's/^\(.\).*$/\1/'`"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 shell=`type sh | sed 's/sh is //'`
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 distdir=`dirname $shell | sed 's!^//\(.\)/\(.*\)!\1:/\2!'`
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 echo "cygwin installed in $distdir"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 echo "checking paths ..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 if [ ! -d "/bin" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 echo "You don't have a /bin directory. Would you like to mount cygwin as /bin ?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 mkdir /bin
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 mount -b $distdir /bin
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 elif [ "$distdir" != "/bin" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 echo "Warning: you have /bin but it's not the cygwin installation."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 if [ ! -d "/tmp" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 echo -n "You don't have /tmp - create it?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 mkdir /tmp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 echo "you have /tmp"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 if [ ! -d "/etc" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 echo -n "You don't have /etc - create it?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 mkdir /etc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 echo "you have /etc"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 if [ -d "/etc" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 if [ ! -f "/etc/termcap" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 echo -n "You don't have /etc/termcap - create it?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 if [ ! -f "$distdir/../etc/termcap" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 distdir=`mount | grep "$distdir" | sed -e "s/ .*$//"`
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 echo "Retrieving termcap from $distdir/../etc"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 if [ -f "$distdir/../etc/termcap" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 cp "$distdir/../etc/termcap" /etc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 echo "Error: can't find termcap file"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 echo "you have /etc/termcap"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 if [ ! -f "/etc/passwd" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 echo -n "You don't have /etc/passwd - create it?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 if [ "$OS" = "Windows_NT" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 echo -n "Running on NT, create domain or local password file [d/l] "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 read DL junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 if [ "$DL" = "d" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 mkpasswd -d > /etc/passwd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 mkpasswd -l > /etc/passwd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 echo "Please enter your userid e.g. andyp"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 read userid junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 echo "Please enter your user name e.g. Andy Piper"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 read username junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 echo "Administrator::500:513:::/bin/sh" > /etc/passwd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 echo "$userid::1000:513:$username::/bin/sh" >> /etc/passwd
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 echo "you have /etc/passwd"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 userid=`id | sed -e "s/[^(]*(\([^)]*\)).*/\1/"`
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 echo "userid is $userid"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 if [ ! -f "/etc/group" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 echo -n "You don't have /etc/group - create it?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 if [ "$OS" = "Windows_NT" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 echo -n "Running on NT, create domain or local group file [d/l] "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 read DL junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 if [ "$DL" = "d" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 mkgroup -d > /etc/group
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 mkgroup -l > /etc/group
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 echo "None::513:" > /etc/group
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 echo "Everyone::0:" >> /etc/group
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 echo "you have /etc/group"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 if [ ! -f "/etc/hosts" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 echo -n "You don't have /etc/hosts - create it?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 mname=`uname -n`
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 echo "Machine name is $mname"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 echo -n "Please enter your ip address "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 read mipaddr junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 echo "$mname $mipaddr" > /etc/hosts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 echo "localhost 127.0.0.1" >> /etc/hosts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 echo "you have /etc/hosts"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 echo "Can't create /etc files because /etc does not exist"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 echo "checking environment ..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 if [ "$HOME" = "" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 echo -n "HOME is not set, rectify?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 if [ "$OS" = "Windows_NT" ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 echo "please enter your home path [/winnt/profiles/$userid]"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 read HOME junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 if [ "$HOME" = "" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 HOME="/winnt/profiles/$userid"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 echo "please enter your home path [/]"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 read HOME junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 if [ "$HOME" = "" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 HOME="/"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 echo "HOME=$HOME; export HOME" >> $HOME/.bashrc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 echo "HOME is $HOME"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 if [ "$TERM" != "ansi" -a "$TERM" != "linux" ]; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 echo -n "TERM is not set to linux or ansi, rectify?"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 if yorn; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 echo "TERM=linux; export TERM" >> $HOME/.bashrc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 echo "TERM is $TERM"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 fi
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 if echo $CYGWIN32 | grep -w tty; then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 echo "CYGWIN32 is $CYGWIN32"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 echo "CYGWIN32 does not contain \"tty\" terminal may be deficient"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 fi