#!/bin/sh
#perl -pi -e 's|.*RgbPath.*\n||;s|/usr/X11R6/lib/modules|/usr/lib/xorg/modules|;s|/usr/X11R6/lib/X11/fonts/|/usr/lib/X11/fonts/|' /etc/X11/xorg.conf
#[ -f /etc/X11/xorg.conf.1st ] && perl -pi -e 's|.*RgbPath.*\n||;s|/usr/X11R6/lib/modules|/usr/lib/xorg/modules|;s|/usr/X11R6/lib/X11/fonts/|/usr/lib/X11/fonts/|' /etc/X11/xorg.conf.1st
perl -ni -e 'BEGIN { $f++ } if (/^Section "Files"/) { $f--; print; print <<_EOF_
\tFontPath\t"/usr/share/fonts/X11/misc"
\tFontPath\t"/usr/share/fonts/X11/cyrillic"
\tFontPath\t"/usr/share/fonts/X11/100dpi/:unscaled"
\tFontPath\t"/usr/share/fonts/X11/75dpi/:unscaled"
\tFontPath\t"/usr/share/fonts/X11/Type1"
\tFontPath\t"/usr/share/fonts/X11/100dpi"
\tFontPath\t"/usr/share/fonts/X11/75dpi"
\t# path to defoma fonts
\tFontPath\t"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
_EOF_
} if (! $f && /^EndSection/) { $f++ }; print if ($f)' /etc/X11/xorg.conf
[ -f /etc/X11/xorg.conf.1st ] && perl -ni -e 'BEGIN { $f++ } if (/^Section "Files"/) { $f--; print; print <<_EOF_
\tFontPath\t"/usr/share/fonts/X11/misc"
\tFontPath\t"/usr/share/fonts/X11/cyrillic"
\tFontPath\t"/usr/share/fonts/X11/100dpi/:unscaled"
\tFontPath\t"/usr/share/fonts/X11/75dpi/:unscaled"
\tFontPath\t"/usr/share/fonts/X11/Type1"
\tFontPath\t"/usr/share/fonts/X11/100dpi"
\tFontPath\t"/usr/share/fonts/X11/75dpi"
\t# path to defoma fonts
\tFontPath\t"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
_EOF_
} if (! $f && /^EndSection/) { $f++ }; print if ($f)' /etc/X11/xorg.conf.1st
apt-get install xserver-xorg mesa-utils xkb-data fix-fonts
[ -x /usr/X11R6/bin/X ] || perl -pi -e 's|^(ServerCmd)=.*|\1=/usr/bin/Xorg -br|' /etc/kde3/kdm/kdmrc
if [ ! -f /etc/X11/fonts/X11R7/misc/xfonts-base.alias ]; then
 dpkg --force-all --purge xfonts-base
 apt-get install xfonts-base
fi
fix-fonts -e
[ -x /usr/local/bin/update-scripts-kanotix.sh ] && update-scripts-kanotix.sh
