LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1050|回复: 1

刚才写了fcitx rpm内部的执行脚本。请大家测试一下

[复制链接]
发表于 2004-5-19 02:38:49 | 显示全部楼层 |阅读模式

  1. %{_bindir}/gtk-query-immodules-2.0 > %{_sysconfdir}/gtk-2.0/gtk.immodules
  2. if [ -f %{_sysconfdir}/redhat-release ] && ! [ -f %{_sysconfdir}/mandrake-release ] ; then
  3.         rm -f %{_sysconfdir}/profile.d/input.sh
  4.         if service IIim status > /dev/null 2>&1 ; then
  5.                 /sbin/service IIim stop >/dev/null 2>&1
  6.                 /sbin/chkconfig --del IIim
  7.                 /usr/sbin/userdel htt 2>/dev/null 2>&1
  8.         fi
  9.         if [ -f %{_sysconfdir}/X11/xinit/xinitrc.d/xinput ] ; then
  10.                 if ! grep -i "fcitx" %{_sysconfdir}/X11/xinit/xinitrc.d/xinput >/dev/null 2>&1 ; then
  11.                         echo "/etc/X11/xinit/xinitrc.d/xinput be saved /etc/X11/xinit/xinitrc.d/xinput.rpmsave"
  12.                         cp -f %{_sysconfdir}/X11/xinit/xinitrc.d/xinput %{_sysconfdir}/X11/xinit/xinitrc.d/xinput.rpmsave
  13.                         sed -e 's/Chinput/fcitx/' \
  14.                             -e 's/chinput/fcitx/' \
  15.                         %{_sysconfdir}/X11/xinit/xinitrc.d/xinput > %{_sysconfdir}/X11/xinit/xinitrc.d/xinput.tmp
  16.                         mv -f %{_sysconfdir}/X11/xinit/xinitrc.d/xinput.tmp %{_sysconfdir}/X11/xinit/xinitrc.d/xinput
  17.                         chmod 755 %{_sysconfdir}/X11/xinit/xinitrc.d/xinput
  18.                        
  19.                 fi
  20.         fi
  21. elif [ -f %{_sysconfdir}/mandrake-release ] ; then
  22.         rm -f %{_sysconfdir}/profile.d/input.sh
  23.         if [ -f %{_sysconfdir}/X11/xinit/XIM ] ; then
  24.                 if ! grep -i "fcitx" %{_sysconfdir}/X11/xinit/XIM >/dev/null 2>&1 ; then
  25.                         echo '/etc/X11/xinit/XIM be saved /etc/X11/xinit/XIM.rpmsave'
  26.                         cp -f %{_sysconfdir}/X11/xinit/XIM %{_sysconfdir}/X11/xinit/XIM.rpmsave
  27.                         sed -e 's/Chinput/fcitx/' \
  28.                             -e 's/chinput/fcitx/' \
  29.                         %{_sysconfdir}/X11/xinit/XIM > %{_sysconfdir}/X11/xinit/XIM.tmp
  30.                         mv -f %{_sysconfdir}/X11/xinit/XIM.tmp %{_sysconfdir}/X11/xinit/XIM
  31.                         chmod 755 %{_sysconfdir}/X11/xinit/XIM
  32.                 fi
  33.         fi
  34. fi
复制代码
 楼主| 发表于 2004-5-19 02:49:25 | 显示全部楼层
改了一下,可以直接执行的脚本:

  1. #!/bin/bash
  2. /usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
  3. if [ -f /etc/redhat-release ] && ! [ -f /etc/mandrake-release ] ; then
  4.         rm -f /etc/profile.d/input.sh
  5.         if service IIim status > /dev/null 2>&1 ; then
  6.                 /sbin/service IIim stop >/dev/null 2>&1
  7.                 /sbin/chkconfig --del IIim
  8.                 /usr/sbin/userdel htt 2>/dev/null 2>&1
  9.         fi
  10.         if [ -f /etc/X11/xinit/xinitrc.d/xinput ] ; then
  11.                 if ! grep -i "fcitx" /etc/X11/xinit/xinitrc.d/xinput >/dev/null 2>&1 ; then
  12.                         echo "/etc/X11/xinit/xinitrc.d/xinput be saved /etc/X11/xinit/xinitrc.d/xinput.rpmsave"
  13.                         cp -f /etc/X11/xinit/xinitrc.d/xinput /etc/X11/xinit/xinitrc.d/xinput.rpmsave
  14.                         sed -e 's/Chinput/fcitx/' \
  15.                             -e 's/chinput/fcitx/' \
  16.                         /etc/X11/xinit/xinitrc.d/xinput > /etc/X11/xinit/xinitrc.d/xinput.tmp
  17.                         mv -f /etc/X11/xinit/xinitrc.d/xinput.tmp /etc/X11/xinit/xinitrc.d/xinput
  18.                         chmod 755 /etc/X11/xinit/xinitrc.d/xinput
  19.                        
  20.                 fi
  21.         fi
  22. elif [ -f /etc/mandrake-release ] ; then
  23.         rm -f /etc/profile.d/input.sh
  24.         if [ -f /etc/X11/xinit/XIM ] ; then
  25.                 if ! grep -i "fcitx" /etc/X11/xinit/XIM >/dev/null 2>&1 ; then
  26.                         echo '/etc/X11/xinit/XIM be saved /etc/X11/xinit/XIM.rpmsave'
  27.                         cp -f /etc/X11/xinit/XIM /etc/X11/xinit/XIM.rpmsave
  28.                         sed -e 's/Chinput/fcitx/' \
  29.                             -e 's/chinput/fcitx/' \
  30.                         /etc/X11/xinit/XIM > /etc/X11/xinit/XIM.tmp
  31.                         mv -f /etc/X11/xinit/XIM.tmp /etc/X11/xinit/XIM
  32.                         chmod 755 /etc/X11/xinit/XIM
  33.                 fi
  34.         fi
  35. fi
复制代码


附:/etc/profile.d/input.sh (当你的linux系统不是mandrake或redhat时会执行,mandrake与redhat系统则会被删除)

  1. INPUT=fcitx
  2. export XMODIFIERS=@im=$INPUT
  3. export XIM=$INPUT
  4. export XIM_PROGRAM=$INPUT
  5. if [ -f $HOME/.kde ] ; then
  6.         if ! [ -f $HOME/.kde/Autostart/$INPUT ] ; then
  7.                 ln -sf /usr/bin/$INPUT $HOME/.kde/Autostart/
  8.         fi
  9. fi
  10. if [ -f $HOME/.gnome2 ] ; then
  11.         if [ -f $HOME/.gnome2/session-manual ] && grep -i "RestartCommand=$INPUT" $HOME/.gnome2/session-manual > /dev/null 2>&1  ; then
  12.                 exit 1
  13.         else
  14.         if [ -f $HOME/.gnome2/session-manual ] && ! grep -i "RestartCommand=$INPUT" $HOME/.gnome2/session-manual > /dev/null 2>&1 ; then
  15.                 mv -f $HOME/.gnome2/session-manual $HOME/.gnome2/session-manual.old
  16.         fi
  17.                 cat > $HOME/.gnome2/session-manual << EOF
  18. [Default]
  19. num_clients=1
  20. 0,RestartStyleHint=3
  21. 0,Priority=50
  22. 0,RestartCommand=$INPUT
  23. EOF
  24. fi
  25. fi
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表