"Fossies" - the Fresh Open Source Software Archive 
Member "dirvish-1.2.1/install.sh" (19 Feb 2005, 3894 Bytes) of package /linux/privat/old/dirvish-1.2.1.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/sh
2
3 #KHL 2005-02-18 space removed from above #!/bin/sh
4
5 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
6 *c*,-n*) ECHO_N= ECHO_C='
7 ' ECHO_T=' ' ;;
8 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
9 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
10 esac
11
12 EXECUTABLES="dirvish dirvish-runall dirvish-expire dirvish-locate"
13 MANPAGES="dirvish.8 dirvish-runall.8 dirvish-expire.8 dirvish-locate.8"
14 MANPAGES="$MANPAGES dirvish.conf.5"
15
16 while :
17 do
18 PERL=`which perl`
19 if [ -z "$PERL" ]
20 then
21 PERL=/usr/bin/perl
22 fi
23 echo $ECHO_N "perl to use ($PERL) $ECHO_C"
24 read ans
25 if [ -n "$ans" ]
26 then
27 PERL="$ans"
28 fi
29
30 until [ -n "$PREFIX_OK" ]
31 do
32 EXECDIR="/usr/sbin"
33 CONFDIR="/etc/dirvish"
34 MANDIR="/usr/share/man"
35
36 echo $ECHO_N "What installation prefix should be used? ($PREFIX) $ECHO_C"
37 read ans
38 if [ -n "$ans" ]
39 then
40 PREFIX="$ans"
41 # KHL 2005-02-18 == changed to = in "if" below
42 if [ "$PREFIX" = "/" ]
43 then
44 PREFIX=""
45 fi
46 fi
47 if [ -n "$PREFIX" -a ! -d "$PREFIX" ]
48 then
49 echo $ECHO_N "$PREFIX doesn't exist, create it? (n) $ECHO_C"
50 read ans
51 if [ `expr "$ans" : '[yY]'` -ne 0 ]
52 then
53 CREATE_PREFIX="$PREFIX directory will be created"
54 PREFIX_OK="yes"
55 else
56 continue
57 fi
58 else
59 PREFIX_OK="yes"
60 fi
61
62 if [ -d "$PREFIX/sbin" ]
63 then
64 BINDIR=$PREFIX/sbin
65 else
66 BINDIR=$PREFIX/bin
67 fi
68
69 if [ -d "$PREFIX/share/man" ]
70 then
71 MANDIR=$PREFIX/share/man
72 elif [ -d "$PREFIX/usr/share/man" ]
73 then
74 MANDIR=$PREFIX/usr/share/man
75 elif [ -d "$PREFIX/usr/man" ]
76 then
77 MANDIR="$PREFIX/usr/man" ]
78 else
79 MANDIR=$PREFIX/man
80 fi
81 if [ `expr "$PREFIX" : '.*dirvish.*'` -gt 0 ]
82 then
83 CONFDIR="$PREFIX/etc"
84 else
85 CONFDIR="/etc/dirvish"
86 fi
87 done
88
89
90 echo $ECHO_N "Directory to install executables? ($BINDIR) $ECHO_C"
91 read ans
92 if [ -n "$ans" ]
93 then
94 BINDIR="$ans"
95 fi
96
97 echo $ECHO_N "Directory to install MANPAGES? ($MANDIR) $ECHO_C"
98 read ans
99 if [ -n "$ans" ]
100 then
101 MANDIR="$ans"
102 fi
103
104 echo $ECHO_N "Configuration directory ($CONFDIR) $ECHO_C"
105 read ans
106 if [ -n "$ans" ]
107 then
108 CONFDIR="$ans"
109 fi
110
111 cat <<EOSTAT
112
113 Perl executable to use is $PERL
114 Dirvish executables to be installed in $BINDIR
115 Dirvish manpages to be installed in $MANDIR
116 Dirvish will expect its configuration files in $CONFDIR
117
118 $CREATE_PREFIX
119
120 EOSTAT
121
122 echo $ECHO_N "Is this correct? (no/yes/quit) $ECHO_C"
123 read ans
124 if [ `expr "$ans" : '[qQ]'` -ne 0 ]
125 then
126 exit
127 elif [ `expr "$ans" : '[yY]'` -ne 0 ]
128 then
129 break
130 fi
131 done
132
133 HEADER="#!$PERL
134
135 \$CONFDIR = \"$CONFDIR\";
136
137 "
138
139 for f in $EXECUTABLES
140 do
141 echo "$HEADER" >$f
142 cat $f.pl >>$f
143 cat loadconfig.pl >>$f
144 chmod 755 $f
145 done
146
147 echo
148 echo "Executables created."
149 echo
150
151 echo $ECHO_N "Install executables and manpages? (no/yes) $ECHO_C"
152 read ans
153 if [ `expr "$ans" : '[yY]'` -ne 0 ]
154 then
155 echo
156 if [ -n "$CREATE_PREFIX" ]
157 then
158 mkdir -p "$PREFIX"
159 fi
160 if [ ! -d $BINDIR ]
161 then
162 if [ -z "$CREATE_PREFIX" -o `expr "$BINDIR" : "$PREFIX"` -ne `expr "$PREFIX" : '.*'` ]
163 then
164 echo "$BINDIR doesn't exist, creating"
165 fi
166 mkdir -p "$BINDIR"
167 fi
168 if [ ! -d $MANDIR ]
169 then
170 if [ -z "$CREATE_PREFIX" -o `expr "$MANDIR" : "$PREFIX"` -ne `expr "$PREFIX" : '.*'` ]
171 then
172 echo "$MANDIR doesn't exist, creating"
173 fi
174 mkdir -p "$MANDIR"
175 fi
176
177 if [ ! -d "$CONFDIR" ]
178 then
179 mkdir -p "$CONFDIR"
180 fi
181
182 for f in $EXECUTABLES
183 do
184 echo "installing $BINDIR/$f"
185 cp $f $BINDIR/$f
186 chmod 755 $BINDIR/$f
187 done
188 for f in $MANPAGES
189 do
190 s=`expr "$f" : '.*\(.\)$'`
191 if [ ! -d "$MANDIR/man$s" ]
192 then
193 mkdir -p "$MANDIR/man$s"
194 fi
195 echo "installing $MANDIR/man$s/$f"
196 cp $f $MANDIR/man$s/$f
197 chmod 644 $MANDIR/man$s/$f
198 done
199 echo
200 echo "Installation complete"
201 fi
202
203 echo $ECHO_N "Clean installation directory? (no/yes) $ECHO_C"
204 read ans
205 if [ `expr "$ans" : '[yY]'` -ne 0 ]
206 then
207 for f in $EXECUTABLES
208 do
209 rm $f
210 done
211 echo "Install directory cleaned."
212 fi