summaryrefslogtreecommitdiff
path: root/russian/X.language/pkg-install
blob: 79d14937346bc792e5d0e8ea4b8c5af09e7dbaa8 (plain) (blame)
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
#!/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