-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·225 lines (183 loc) · 5.19 KB
/
Copy pathconfigure
File metadata and controls
executable file
·225 lines (183 loc) · 5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#!/bin/sh
# tiny configure script for jkSMS
# Copyright (c) Jeremy Kister 2016
# http://github.com/jkister/jkSMS/
# http://jeremy.kister.net/
VERSION=20160315.01
echo " "
while test $# -gt 0 ; do
case $1 in
--*=*) arg=`echo $1 | sed 's/.*=//'` ;;
*) arg= ;;
esac
case $1 in
--help)
cat <<EOM
the following syntax to ./configure is supported:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--piddir=DIR jkSMS daemon PID file [/var/run]
--scriptdir=DIR jkSMS script [PREFIX/script]
--agidir=DIR jkSMS AGI program [/var/lib/asterisk/agi-bin]
--perl=PERL full path to perl [/usr/bin/perl]
--help show help message
EOM
exit;
;;
--perl*)
if [ "$arg" ]; then
if [ -x "$arg" ] ; then
PERL=$arg
else
echo "*** PERL: $arg is not executable"
exit 1
fi
fi
;;
--piddir*)
if [ "$arg" ]; then
if [ -x "$arg" ] ; then
PIDDIR=$arg
else
echo "*** PIDDIR: $arg is not executable"
exit 1
fi
fi
;;
--prefix*)
if [ "$arg" ]; then
if [ -d "$arg" ] ; then
PREFIX=$arg
else
echo "*** PREFIX: $arg is not a directory"
exit 1
fi
fi
;;
--scriptdir*)
if [ "$arg" ]; then
if [ -d "$arg" ] ; then
SCRIPTDIR=$arg
else
echo "*** SCRIPTDIR: $arg is not a directory"
exit 1
fi
fi
;;
--agidir*)
if [ "$arg" ]; then
if [ -d "$arg" ] ; then
AGIDIR=$arg
else
echo "*** AGIDIR: $arg is not a directory"
exit 1
fi
fi
;;
*)
echo "unknown argument: $1"
exit 1
;;
esac
shift
done
if [ ! -x "$PERL" ] ; then
for dir in /usr/bin /usr/local/bin /bin ; do
if test -f $dir/perl ; then
PERL=$dir/perl
break
fi
done
if [ ! -x "$PERL" ] ; then
echo "could not find perl: specify --perl="
exit 1
fi
fi
if [ ! "$PREFIX" ] ; then
PREFIX="/usr/local"
fi
if [ ! "$PIDDIR" ] ; then
PIDDIR="/var/run"
fi
if [ ! "$SCRIPTDIR" ] ; then
SCRIPTDIR="$PREFIX/script"
fi
if [ ! "$AGIDIR" ] ; then
AGIDIR="/var/lib/asterisk/agi-bin"
fi
echo "found perl: $PERL"
for mod in DBI Asterisk::AGI Asterisk::AMI Net::CIDR::Lite Sys::SigAction ; do
$PERL -e "use $mod";
if [ "$?" != 0 ] ; then
echo "cannot find perl module $module"
echo ""
echo 'Install perl prerequisites via CPAN, apt, yum, or ... - then try ./configure again.'
exit 1
fi
done
cat <<EOM
jksmsd will be installed in: $SCRIPTDIR
jksmsd PID file will be in: $PIDDIR
jksms-in.pl will be installed in: $SCRIPTDIR
jksms.agi will be installed in: $AGIDIR
if any of these values need changing, try ./configure --help
Making sure this package is intact..
EOM
for file in src/*.pl ; do
$PERL -wTc $file
if [ $? != 0 ] ; then
echo "problem with package - check Perl modules or re-download from http://jeremy.kister.net./code/asterisk/jkSMS/"
exit 1
fi
done
echo "...done."
echo "Writing Makefile..."
cat <<__EOM__ > Makefile
VERSION=$VERSION
PERL=$PERL
PIDDIR=$PIDDIR
SCRIPTDIR=$SCRIPTDIR
AGIDIR=$AGIDIR
SEDARG=s~__PIDDIR__~\$(PIDDIR)~g; s~__SCRIPTDIR__~\$(SCRIPTDIR)~g; \
s~__VERSION__~\$(VERSION)~g; s~__PERL__~\$(PERL)~g;
BUILD = built/jksmsd built/jksms.agi built/jksms-in.pl built/rc.jksmsd
CLEAN = \$(BUILD) Makefile
PRE = Makefile built
all: \$(BUILD) text
built:
-mkdir built
text:
@echo
@echo build complete.
@echo now run \'make install\'
built/rc.jksmsd: \$(PRE) src/rc.jksmsd
@sed "\$(SEDARG)" src/rc.jksmsd > built/rc.jksmsd
@chmod a+x built/rc.jksmsd
built/jksmsd: \$(PRE) src/jksmsd.pl
@sed "\$(SEDARG)" src/jksmsd.pl > built/jksmsd
@chmod a+x built/jksmsd
built/jksms.agi: \$(PRE) src/jksms.agi.pl
@sed "\$(SEDARG)" src/jksms.agi.pl > built/jksms.agi
@chmod a+x built/jksms.agi
built/jksms-in.pl: \$(PRE) src/jksms-in.pl
@sed "\$(SEDARG)" src/jksms-in.pl > built/jksms-in.pl
@chmod a+x built/jksms-in.pl
install: \$(BUILD)
-mkdir -p \$(SCRIPTDIR)
-mkdir -p \$(AGIDIR)
cp built/jksmsd \$(SCRIPTDIR)/
cp built/jksms-in.pl \$(SCRIPTDIR)/
cp built/jksms.agi \$(AGIDIR)/
cp built/rc.jksmsd /etc/init.d/jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc2.d/S94jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc3.d/S94jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc4.d/S94jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc5.d/S94jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc0.d/K28jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc5.d/K28jksmsd
ln -f -s /etc/init.d/jksmsd /etc/rc6.d/K28jksmsd
clean:
-rm \$(CLEAN)
__EOM__
echo " "
echo "now type 'make' and then 'make install'"