#! /bin/sh

# Write by Tsai Dung-Bang, Department of Physics, NCKU
#
# Welcome to report any error to  dbtsai at phys.ncku.edu.tw


mkdir firefly_dbtsai_temp
cd firefly_dbtsai_temp

####################This session will download needed file###############################

echo ''
echo 'Downloading Firefly Sung Font'
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/fireflysung.ttf

echo ''
echo 'Downloading Firefly patch Fontconfig'
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/fontconfig-2.2.92-0.5.firefly.i386.rpm
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/fontconfig-devel-2.2.92-0.5.firefly.i386.rpm

echo ''
echo 'Downloading Firefly patch libXft'
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/libXft-2.1.2-2.firefly.i386.rpm

echo ''
echo 'Downloading Firefly xttmgr'
wget  http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/xttmgr-0.9.6-1.firefly.i386.rpm

echo ''
echo 'Downloading Firefly pango'
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/pango-1.6.0-1.firefly.i386.rpm
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/pango-devel-1.6.0-1.firefly.i386.rpm

echo ''
echo 'Downloading Firefly freetype'
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/freetype-2.1.7-4.firefly.i386.rpm
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/freetype-demos-2.1.7-4.firefly.i386.rpm
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/freetype-devel-2.1.7-4.firefly.i386.rpm
wget http://www.phys.ncku.edu.tw/~dbtsai/fedora/3/i386/freetype-utils-2.1.7-4.firefly.i386.rpm


##################This session will start to install needed package######################

echo ''
echo 'Linking /etc/X11/xorg.conf to /etc/X11/XF86Config-4'
echo 'to let xttmgr read the correct configure file. '
ln -s /etc/X11/xorg.conf /etc/X11/XF86Config-4

echo ''
echo 'Start to install Firefly fontconfig'
rpm -Uvh --force fontconfig-*

echo ''
echo 'Start to install Firefly freetype'
rpm -Uvh --force freetype-*

echo ''
echo 'Start to install Firefly pango'
rpm -Uvh --force pango-*

echo ''
echo 'Start to install Firefly libXft'
rpm -ivh libXft-*.rpm
echo /usr/lib >> temp.conf
cat /etc/ld.so.conf >> temp.conf
mv -f temp.conf /etc/ld.so.conf
rm temp.conf
/sbin/ldconfig

echo ''
echo 'Start to install Firefly xttmgr'
rpm -ivh  xttmgr-*.rpm


echo ''
echo 'Start to install Firefly Sung font'
/usr/sbin/xttmgr --add fireflysung.ttf

echo ''
echo 'Start to rebuild all the fonts database'
echo y >> y_ok
/usr/sbin/xttmgr --rebuild  < y_ok
/usr/sbin/xttmgr --auto < y_ok
rm y_ok

cd ..
rm -rf firefly_dbtsai_temp

echo ''
echo ''
echo 'Sussess! Restart your X-Window and chang font'
echo 'Enjoy your Fedora Core 3, GNU/Linux !!'
echo ''
echo 'Any error report to dbtsai@phys.ncku.edu.tw'
echo 'by Dung-Bang Tsai, Department of Physics, NCKU'



