123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #!/bin/sh
- echo "Post install script for TARGETLANG language pack"
- LANG="`grep '^LANG=' /etc/profile | cut -f 2 -d '=' | cut -f 1 -d ' '`"
- export LANG
- LANG1="`cat pet.specs | cut -d'-' -f1 | cut -d'_' -f2-`"
- if [ -d usr/share/applications.in ];then
- for ADESKTOPFILE in `find usr/share/applications.in -mindepth 1 -maxdepth 1 -type f -name '*.desktop' | tr '\n' ' '`
- do
- ABASEDESKTOP="`basename $ADESKTOPFILE`"
- ADIRDESKTOP=''
- [ -f usr/share/applications/${ABASEDESKTOP} ] && ADIRDESKTOP='usr/share/applications'
- [ ! "$ADIRDESKTOP" ] && [ -f usr/local/share/applications/${ABASEDESKTOP} ] && ADIRDESKTOP='usr/local/share/applications'
- if [ "$ADIRDESKTOP" ];then
- if [ "`grep '^Name\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP}`" != "" ];then
- if [ "`grep '^Name\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP}`" != "" ];then
-
- grep -v '^Name\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP} > /tmp/momanager-pinstall-sh-desktop
- mv -f /tmp/momanager-pinstall-sh-desktop ${ADIRDESKTOP}/${ABASEDESKTOP}
- fi
-
- INSERTALINE="`grep '^Name\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
- sed -i -e "s%^Name=%${INSERTALINE}\\nName=%" ${ADIRDESKTOP}/${ABASEDESKTOP}
- fi
-
- if [ "`grep '^Comment\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP}`" != "" ];then
- if [ "`grep '^Comment\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP}`" != "" ];then
-
- grep -v '^Comment\[TARGETLANG\]' ${ADIRDESKTOP}/${ABASEDESKTOP} > /tmp/momanager-pinstall-sh-desktop
- mv -f /tmp/momanager-pinstall-sh-desktop ${ADIRDESKTOP}/${ABASEDESKTOP}
- fi
-
- INSERTALINE="`grep '^Comment\[TARGETLANG\]' usr/share/applications.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
- sed -i -e "s%^Comment=%${INSERTALINE}\\nComment=%" ${ADIRDESKTOP}/${ABASEDESKTOP}
- fi
- fi
- done
- fi
- if [ -d usr/share/desktop-directories.in ];then
- for ADESKTOPFILE in `find usr/share/desktop-directories.in -mindepth 1 -maxdepth 1 -type f -name '*.directory' | tr '\n' ' '`
- do
- ABASEDESKTOP="`basename $ADESKTOPFILE`"
- if [ -f usr/share/desktop-directories/${ABASEDESKTOP} ];then
- if [ "`grep '^Name\[TARGETLANG\]' usr/share/desktop-directories/${ABASEDESKTOP}`" = "" ];then
- if [ "`grep '^Name\[TARGETLANG\]' usr/share/desktop-directories.in/${ABASEDESKTOP}`" != "" ];then
-
- INSERTALINE="`grep '^Name\[TARGETLANG\]' usr/share/desktop-directories.in/${ABASEDESKTOP} | sed -e 's%\[%\\\\[%' -e 's%\]%\\\\]%'`"
- sed -i -e "s%^Name=%${INSERTALINE}\\nName=%" usr/share/desktop-directories/${ABASEDESKTOP}
- fi
- fi
- fi
- done
- rm -r -f usr/share/desktop-directories.in
- fi
- for AFILE in `ls -1 usr/local/apps/*/AppInfo.xml.in | tr '\n' ' '`
- do
- XMLFILE="`echo $AFILE|rev|cut -d'.' -f2- | rev`"
- SUMMARY="`grep \<Summary\> $AFILE`"
- oldSUMMARY=`grep "\<Summary\ xml\:lang\=\"$LANG1" $XMLFILE`
- mySUMMARY=`grep "\<Summary\ xml\:lang\=\"${LANG1}" $AFILE`
- [ "$mySUMMARY" ] || continue
- sed -ie "/Summary\ xml\:lang\=\"${LANG1}/d" $XMLFILE
- sed -ie "s#${SUMMARY}#${SUMMARY}\n${mySUMMARY}#" $XMLFILE
-
- sed -ie "/Label\ xml\:lang\=\"${LANG1}/d" $XMLFILE
-
- grep '<Label>' $AFILE > /tmp/appinfoLABLE
- grep '<Label xml:lang=\"'${LANG1} $AFILE > /tmp/appinfoXMLLABLE
- N=0;
- while read LINE
- do
- N=$(($N + 1));echo $N
- LABEL="`head -n $N /tmp/appinfoLABLE | tail -n 1`"
- sed -ie "s#${LABEL}#${LABEL}\n${LINE}#" $XMLFILE
- done < /tmp/appinfoXMLLABLE
- done
- rm /tmp/appinfoLABLE /tmp/appinfoXMLLABLE
- echo "...merge AppInfo.xml.in with AppInfo.xml finished"
- if [ -d ./usr/share/hunspell ];then
- for ONEHUN in `find ./usr/share/hunspell -mindepth 1 -maxdepth 1 -type f -name '*.dic' -o -name '*.aff' | tr '\n' ' '`
- do
- HUNBASE="`basename $ONEHUN`"
- DICTDIRS="`find ./usr/lib -mindepth 2 -maxdepth 2 -type d -name dictionaries | tr '\n' ' '`"
- for ONEDICTDIR in $DICTDIRS
- do
- [ ! -e ${ONEDICTDIR}/${HUNBASE} ] && ln -s ../../../share/hunspell/${HUNBASE} ${ONEDICTDIR}/${HUNBASE}
- done
- done
- fi
- LANGPACKLANG=TARGETLANG
- case $LANGPACKLANG in
- zh*|ja*|ko*)
- sed -i -e 's%DejaVu Sans%Sans%' ./etc/xdg/templates/_root_*
- if [ -d ./root/.jwm ];then
- sed -i -e 's%DejaVu Sans%Sans%' ./root/.jwm/themes/*-jwmrc
- sed -i -e 's%DejaVu Sans%Sans%' ./root/.jwm/jwmrc-theme
- fi
- [ -d ./etc/xdg/openbox ] && sed -i -e 's%DejaVu Sans%Sans%' ./etc/xdg/openbox/*.xml
- [ -d ./root/.config/openbox ] && sed -i -e 's%DejaVu Sans%Sans%' ./root/.config/openbox/*.xml
- GTKRCFILE="$(find ./usr/share/themes -type f -name gtkrc | tr '\n' ' ')"
- for ONEGTKRC in $GTKRCFILE
- do
- sed -i -e 's%DejaVu Sans%Sans%' $ONEGTKRC
- done
- if [ -d ./root/.mozilla ];then
- MOZFILE="$(find ./root/.mozilla -type f -name prefs.js -o -name '*.css' | tr '\n' ' ')"
- for ONEMOZ in $MOZFILE
- do
- sed -i -e 's%DejaVu Sans%Sans%' $ONEMOZ
- done
- fi
- ;;
- esac
- if [ "`pwd`" = "/" ];then
- if [ "$LANG1" != "en" ];then
-
- fixscripts
- fixdesk
- fixmenus
- [ -r /pinstall_hacks.sh ] && . /pinstall_hacks.sh
- pupdialog --background green --backtitle "Language Pack" --msgbox "POSTINSTALLMSG" 0 0 &
- fi
- fi
|