mirror of
https://git.freebsd.org/ports.git
synced 2025-06-15 09:40:35 -04:00
142 lines
2.8 KiB
Bash
142 lines
2.8 KiB
Bash
#!/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
|
|
|