annotate etc/check_cygwin_setup.sh @ 290:c9fe270a4101 r21-0b43

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