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