freebsd-ports/russian/X.language/pkg-install
2002-05-03 06:37:21 +00:00

72 lines
2.3 KiB
Bash

#!/bin/sh
if [ "$2" != POST-INSTALL ] ; then
exit 0
fi
X11BASE=/usr/X11R6
FILESDIR=${X11BASE}/.Xinstmp
XLIB=${X11BASE}/lib/X11
CYRF=${XLIB}/fonts/cyrillic
T1DIR=${XLIB}/fonts/Type1/fonts.dir
T1SCALE=${XLIB}/fonts/Type1/fonts.scale
for i in ${T1DIR} ${T1SCALE}; do
grep -q cokoi8n $i || {
cp $i $i.bak;
d_cnt=`grep '^[1-9][0-9]*$' $i.bak`;
d_add=`wc -l < ${FILESDIR}/fonts.dir-scale.add`;
d_new=`expr $d_cnt + $d_add`;
sed 's/^[1-9][0-9]*$/'$d_new/ < $i.bak > $i;
cat ${FILESDIR}/fonts.dir-scale.add >> $i;
};
done
if [ -f /etc/XF86Config ]; then
grep -q ${CYRF}/misc /etc/XF86Config || {
cp /etc/XF86Config /etc/XF86Config.old;
(echo "/^[ ]*FontPath/i"; \
echo " FontPath \"${CYRF}/75dpi\"";
echo " FontPath \"${CYRF}/100dpi\"";
echo " FontPath \"${CYRF}/misc\"";
echo "."; echo "w"; echo "q"; ) > /tmp/ed.$$;
ed - /etc/XF86Config < /tmp/ed.$$;
rm -f /tmp/ed.$$;
};
fi
if [ ! -f ${XLIB}/nls/nls.dir ] ; then
dl=`wc -l < ${FILESDIR}/nls_dir_list`;
echo $dl > ${XLIB}/nls/nls.dir;
cat ${FILESDIR}/nls_dir_list >> ${XLIB}/nls/nls.dir;
chown ${BINOWN}:${BINGRP} ${XLIB}/nls/nls.dir;
chmod 644 ${XLIB}/nls/nls.dir;
else
grep -q KOI8-R ${XLIB}/nls/nls.dir || {
cp ${XLIB}/nls/nls.dir ${XLIB}/nls/nls.dir.bak;
d_sub=`grep -f ${FILESDIR}/replace_nls_list < ${XLIB}/nls/nls.dir.bak | wc -l`;
d_cnt=`grep '^[1-9][0-9]*$' ${XLIB}/nls/nls.dir.bak`;
d_add=`wc -l < ${FILESDIR}/nls_dir_list`;
d_new=`expr $d_cnt + $d_add - $d_sub`;
grep -v -f ${FILESDIR}/replace_nls_list < ${XLIB}/nls/nls.dir.bak | \
sed 's/^[1-9][0-9]*$/'$d_new/ > ${XLIB}/nls/nls.dir;
cat ${FILESDIR}/nls_dir_list >> ${XLIB}/nls/nls.dir;
};
fi
if [ ! -f ${XLIB}/nls/nls.alias ] ; then
al=`wc -l < ${FILESDIR}/nls_alias_list`;
echo $al > ${XLIB}/nls/nls.alias;
cat ${FILESDIR}/nls_alias_list >> ${XLIB}/nls/nls.alias;
chown ${BINOWN}:${BINGRP} ${XLIB}/nls/nls.alias;
chmod 644 ${XLIB}/nls/nls.alias;
else
grep -q KOI8-R ${XLIB}/nls/nls.alias || {
a_cnt=`grep '^[1-9][0-9]*$' ${XLIB}/nls/nls.alias`;
a_add=`wc -l < ${FILESDIR}/nls_alias_list`;
a_new=`expr $a_cnt + $a_add`;
cp ${XLIB}/nls/nls.alias ${XLIB}/nls/nls.alias.bak;
sed "s/^[1-9][0-9]*$/$a_new/;q" < ${XLIB}/nls/nls.alias.bak > ${XLIB}/nls/nls.alias;
cat ${FILESDIR}/nls_alias_list >> ${XLIB}/nls/nls.alias;
};
fi
rm -rf ${FILESDIR}
exit 0