blob: cdbdf7597daf9a23211d8564c5468b65a1f26a3e (
plain)
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
|
#!/bin/sh
# $FreeBSD$
SED=${SED:-/usr/bin/sed}
MKTEMP=${MKTEMP:-/usr/bin/mktemp}
AWK=${AWK:-/usr/bin/awk}
BASENAME=${BASENAME:-/usr/bin/basename}
CAT=${CAT:-/bin/cat}
WC=${WC:-/usr/bin/wc}
MKDIR=${MKDIR:-/bin/mkdir -p}
dialog_main() {
tmpfile=`${MKTEMP} -t menulistM`
choosedone=0;
while [ $choosedone != 1 ]; do
/usr/bin/dialog --title "SWORD Modules" --clear \
--menu "\n\
Please select desired modules in each section:" -1 -1 6 \
Bibles "Select biblical texts" \
Lexicons "Select lexicons / dictionaries" \
Comments "Select commentaries" \
Devotionals "Select daily devotionals" \
Cults "Select cults / unorthodox / questionnable modules" \
Done "Done" \
2> $tmpfile
retval=${?}
case $retval in
0)
chosen=`${CAT} $tmpfile`
case $chosen in
"Bibles")
dialog_select ${SCRIPTDIR}/bibles.list selbibles "$selbibles"
;;
"Lexicons")
dialog_select ${SCRIPTDIR}/lexicons.list sellexicons "$sellexicons"
;;
"Comments")
dialog_select ${SCRIPTDIR}/comments.list selcomments "$selcomments"
;;
"Devotionals")
dialog_select ${SCRIPTDIR}/devotionals.list seldevotionals "$seldevotionals"
;;
"Cults")
dialog_select ${SCRIPTDIR}/cults.list selcults "$selcults"
;;
"Done")
choosedone=1
;;
*)
echo "Unknown option: $chosen"
rm -f $tmpfile
exit 1
;;
esac
;;
1) echo "Cancelled"
rm -f $tmpfile
exit 1
;;
*)
rm -f $tmpfile
exit 1
;;
esac
done
rm -f $tmpfile
}
dialog_select() {
modtype=`${BASENAME} $1|${SED} s/\.list.*$//`
tmpf=`${MKTEMP} -t dlgscript`
selectlist=`${MKTEMP} -t selectlist`
prem=`${WC} -l $1 | ${AWK} '{print $1;}`
m=${prem:-16}
if [ $m -gt 16 ]; then m=16; fi
echo -n "/usr/bin/dialog --title \"SWORD modules: ${modtype}\" --clear \
--checklist \"\n Please select desired ${modtype} modules:\" -1 -1 $m " >$tmpf
echo -n `${CAT} $1|${AWK} --assign selmods="$3" '
BEGIN {
FS="\t";
split(selmods,smatmp," ");
for (i in smatmp) {
selmodarray[smatmp[i]]=1;
}
}
{
if ($1 in selmodarray) ison="ON"; else ison="OFF"
printf("%s %s %s ",$1,$2,ison);
}'` >>$tmpf
echo ' 2> ${selectlist} ' >>$tmpf
. $tmpf
retval=${?}
if [ x$retval = x0 ]; then
setvar $2 "`${CAT} ${selectlist} | ${SED} s/\\\"//g`"
fi
rm -f $tmpf
rm -f $selectlist
}
if [ -f ${WRKDIR}/selected.conf ]; then
. ${WRKDIR}/selected.conf
else
selbibles="ASV KJV WEB"
sellexicons="StrongsGreek StrongsHebrew"
selcomments="Personal TSK"
seldevotionals=""
selcults=""
fi
if [ ! "${BATCH}" ]; then
dialog_main
fi
if [ ! -d ${SETDIR} ]; then
${MKDIR} ${SETDIR}
fi
echo "# Automatically generated file - manual changes may be lost" >${MODFILE}
for module in $selbibles $sellexicons $selcomments $selcults $seldevotionals; do
echo "MODULE_FILES += ${module}.zip " >>${MODFILE}
done
|