以下內容轉自:https://ywnz.com/linuxjc/1476.html
問題
起初,是一次升級系統之后選詞框丟失。根據以往經驗,刪除配置文件。然而無效。於是卸載之后下載最新安裝包嘗試重新安裝。問題出現了,一個依賴問題無法解決:搜狗拼音依賴的fcitx-libs-qt這個包在ubuntu18.04的源里面是不存在的。
替代品似乎是libfcitx-qt0,我嘗試修改deb中的控制文件,將fcitx-libs-qt替代換為libfcitx-qt0,並重新打包。這樣可以安裝,然而並無卵用。去ubuntu17.10的源下載fcitx-libs-qt,會有沖突,不能與libfcitx-qt0共存。
解決問題
經過各種折騰,最終解決了問題,記錄如下。
下載舊版
首先搜狗官方的最新版(sogoupinyin_2.2.0.0102_amd64.deb)是不能用的,至於為什么不能用,未作深究。需要下載一個舊版本(sogoupinyin_2.1.0.0086_amd64.deb)。
將該deb包放置於一個空目錄。
創建軟件包目錄
mkdir -p extract/DEBIAN
解包
dpkg-deb -x sogoupinyin_2.1.0.0086_amd64.deb extract/
dpkg-deb -e sogoupinyin_2.1.0.0086_amd64.deb extract/DEBIAN
修改control文件
用任意文本編輯器打開extract/DEBIAN/control 找到Depends行,刪除fcitx-libs和fcitx-libs-qt,保存退出。
Package: sogoupinyin Version: 2.1.0.0086 Architecture: amd64 Maintainer: Ubuntu Kylin Team <ubuntukylin-members@lists.launchpad.net> Installed-Size: 53018 Depends: fcitx (>= 1:4.2.8.3-3~), fcitx-frontend-gtk2, fcitx-frontend-gtk3, fcitx-frontend-qt4, fcitx-module-kimpanel, im-config, libopencc2 | libopencc1, lsb-release, unzip, x11-utils, libc6 (>= 2.8), libgcc1 (>= 1:4.1.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.16.0), libidn11 (>= 1.13), libnotify4 (>= 0.7.0), libqt4-dbus (>= 4:4.8.0), libqt4-declarative (>= 4:4.8.0), libqt4-network (>= 4:4.8.0), libqtcore4 (>= 4:4.8.0), libqtgui4 (>= 4:4.8.0), libstdc++6 (>= 4.6), libx11-6, zlib1g (>= 1:1.2.0) Recommends: fcitx-frontend-qt5, fonts-droid-fallback | fonts-droid, dconf-gsettings-backend | gsettings-backend Section: non-free/utils Priority: optional Homepage: http://pinyin.sogou.com/linux Description: Sogou Pinyin Input Method Based on web search engine technology, Sogou Pinyin input method is the next-generation input method designed for Internet users. As it is backed with search engine technology, user input method can be extremely fast, and it is much more advanced than other input method engines in terms of the volume of the vocabulary database and its accuracy. Sogou input method is the most popular input methods in China, and Sogou promises it will always be free of charge.
打包
mkdir build dpkg-deb -b extract/ build/
執行完畢build目錄下會生成一個新的deb包。
安裝
先徹底卸載掉搜狗輸入法,並刪除以下配置文件:
.sogouinput .config/fcitx .config/sogou-qimpanel .config/SogouPY .config/SogouPY.users .config/fcitx-qimpanel
然后安裝我們重新打包的輸入法即可。重啟之后,搜狗輸入法恢復正常。