mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-06 22:51:41 +00:00
94a9e83966
* create a empty file site-start.el in / * do not modify site-start.el The next PR is about the later problem. But the patch cannot fix it. PR: 10294 Submitted by: hokada@isl.melco.co.jp
68 lines
2.3 KiB
Bash
68 lines
2.3 KiB
Bash
#!/bin/sh
|
|
|
|
pkgname=$1
|
|
|
|
BASENAME=${BASENAME:-%BASENAME%}
|
|
CP=${CP:-%CP%}
|
|
ECHO=${ECHO:-%ECHO%}
|
|
GREP=${GREP:-%GREP%}
|
|
SED=${SED:-%SED%}
|
|
TOUCH=${TOUCH:-%TOUCH%}
|
|
DO_NADA=${DO_NADA:-%DO_NADA%}
|
|
|
|
infodir=${INFODIR:-%INFODIR%}
|
|
infofiles=${INFOFILES:-%INFOFILES%}
|
|
infonodes=${INFONODES:-%INFONODES%}
|
|
infonodeexps=${INFONODEEXPS:-%INFONODEEXPS%}
|
|
elispdir=${ELISPDIR:-%ELISPDIR%}
|
|
sitestartdir=${SITESTARTDIR:-%SITESTARTDIR%}
|
|
dirsection=${DIRSECTION:-%DIRSECTION%}
|
|
|
|
OptionStart=";;; configuration options for ${pkgname}"
|
|
OptionEnd=";;; End of configuration options for ${pkgname}"
|
|
|
|
if [ "X$2" = X"POST-INSTALL" ]; then
|
|
if [ X"${sitestartdir}" != X ] && \
|
|
[ ! -f ${sitestartdir}/site-start.el ]; then
|
|
${TOUCH} ${sitestartdir}/site-start.el
|
|
fi
|
|
count=1
|
|
# For example, the result of `cut ttt -d : -f 2` is ttt. Why?
|
|
infofiles=${infofiles}:
|
|
while ${DO_NADA}; do
|
|
if [ X`${ECHO} ${infofiles} | cut -d : -f $count` = X ]; then
|
|
break
|
|
fi
|
|
file=`${ECHO} ${infofiles} | cut -d : -f $count`
|
|
nodename=`${ECHO} ${infonodes} | cut -d : -f $count`
|
|
nodeexp=`${ECHO} ${infonodeexps} | cut -d : -f $count`
|
|
if [ ! "`${GREP} \"START-INFO-DIR-ENTRY\" ${infodir}/${file}`" ]; then
|
|
${ECHO} "INFO-DIR-SECTION ${dirsection}" \
|
|
>> ${infodir}/${file}
|
|
${ECHO} "START-INFO-DIR-ENTRY" >> ${infodir}/${file}
|
|
${ECHO} "* ${nodename}: (`${BASENAME} ${file}`). ${nodeexp}" \
|
|
>> ${infodir}/${file}
|
|
${ECHO} "END-INFO-DIR-ENTRY" >> ${infodir}/${file}
|
|
fi
|
|
count=`expr $count + 1`
|
|
done
|
|
${ECHO} "Adding entry for \"${pkgname}\" to ${infodir}/dir"
|
|
for file in `${ECHO} ${infofiles} | ${SED} "s,:, ,g"`; do
|
|
install-info ${infodir}/${file} ${infodir}/dir
|
|
done
|
|
if [ X"${sitestartdir}" != X ] && \
|
|
[ X"`${GREP} \"^${OptionStart}\" ${sitestartdir}/site-start.el`" = X ]; then
|
|
${SED} -e "/^${OptionStart}/,/^${OptionEnd}/d" \
|
|
${sitestartdir}/site-start.el > ${sitestartdir}/site-start.el.bak
|
|
${CP} ${sitestartdir}/site-start.el.bak ${sitestartdir}/site-start.el
|
|
${ECHO} "Adding entry for \"${pkgname}\" to ${sitestartdir}/site-start.el"
|
|
${ECHO} "${OptionStart}" >> ${sitestartdir}/site-start.el
|
|
/usr/bin/printf "%ADDSITESTART%" | \
|
|
${SED} "s/^ //" >> ${sitestartdir}/site-start.el
|
|
${ECHO} "${OptionEnd}" >> ${sitestartdir}/site-start.el
|
|
fi
|
|
exit 0
|
|
else
|
|
exit 0
|
|
fi
|