Last active
July 6, 2016 03:15
-
-
Save Gabrielgtx/3010e9bb9f4e7431076d79f266166b7d to your computer and use it in GitHub Desktop.
WPS Office is an office productivity suite / http://wps-community.org/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkgname=wps-office | |
| pkgver=10.1.0.5672_a21 | |
| pkgrel=1 | |
| pkgdesc="WPS Office is an office productivity suite" | |
| arch=('i686' 'x86_64') | |
| license=("custom") | |
| url="http://wps-community.org/" | |
| depends=('fontconfig' 'libpng12' 'glib2' 'libsm' 'libxext' 'libxrender' 'libxml2' 'desktop-file-utils' 'shared-mime-info' 'xdg-utils' 'glu') | |
| optdepends=('cups: for printing support' | |
| 'pango: for complex (right-to-left) text support') | |
| options=('!emptydirs') | |
| install=${pkgname}.install | |
| [[ "$CARCH" = "i686" ]] && archext=x86 || archext=x86_64 | |
| source=("http://kdl.cc.ksosoft.com/wps-community/download/a20/${pkgname}_${pkgver/_/"~"}_${archext}.tar.xz" | |
| "git+https://github.com/wayne-hartmann/ttf-wps-fonts.git" | |
| "http://kdl.cc.ksosoft.com/wps-community/download/mui/${pkgver%_*}/mui_es_es.7z" | |
| "http://kdl.cc.ksosoft.com/wps-community/download/mui/${pkgver%_*}/mui_es_mx.7z" | |
| "http://wps-community.org/download/dicts/es_ES.zip") | |
| sha512sums=('SKIP' | |
| 'SKIP' | |
| '18b623ac38d83afe5c721a8d7a3013ff5876e552a3692a14af14545d61be56764e6b665d51fd4865b64f84e7d45167c289759f3a95cf60b4b00af9c7d22cd735' | |
| '1537250a2829f6bb129b1c1ff83773d543b8e2a3158cced1e9a7590b2eb8801a37f2d8e5c089fabfdd485bb8f0afd04cd1fd74074475f16049ba3a6c8f5d70f7' | |
| '0c9cae3f4bae8c61eb6c6c060f12271d20f383b453387c1e3c829bb79fd309b83ac3d655a10ad57f88d8637f18903361bdb4b04660a563ee84b56b6f4f1cef01') | |
| # PKGEXT=".pkg.tar" | |
| prepare() { | |
| cd wps-office_${pkgver/_/"~"}_$archext | |
| sed -i 's|/opt/kingsoft/wps-office|/usr/lib|' wps wpp et | |
| } | |
| package() { | |
| install -d "$pkgdir"/usr/{lib,bin,share/fonts/{wps-office,wps-fonts}} | |
| cp -r office6 "$pkgdir/usr/lib" | |
| cp -r es_ES "$pkgdir/usr/lib/office6/dicts" | |
| install -m644 "ttf-wps-fonts/"*.{ttf,TTF} "$pkgdir/usr/share/fonts/wps-fonts/" | |
| cd wps-office_${pkgver/_/"~"}_$archext | |
| cp -r office6 "$pkgdir/usr/lib" | |
| cp -r resource/* "$pkgdir/usr/share" | |
| cp -r fonts/* "$pkgdir/usr/share/fonts/wps-office" | |
| install -m755 wps wpp et "$pkgdir/usr/bin" | |
| install -Dm644 office6/mui/default/EULA.txt "$pkgdir/usr/share/licenses/$pkgname/EULA.txt" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkgname=wps-office | |
| pkgver=10.1.0.5672_a21 | |
| pkgrel=1 | |
| pkgdesc="WPS Office is an office productivity suite" | |
| arch=('x86_64') | |
| license=("custom") | |
| url="http://www.wps.cn/product/" | |
| depends=('fontconfig' 'libpng12' 'glib2' 'libsm' 'libxext' 'libxrender' 'libxml2' 'desktop-file-utils' 'shared-mime-info' 'xdg-utils' 'glu') | |
| optdepends=('cups: for printing support' | |
| 'pango: for complex (right-to-left) text support') | |
| options=('!emptydirs') | |
| install=${pkgname}.install | |
| source=("http://kdl.cc.ksosoft.com/wps-community/download/a21/${pkgname}_${pkgver/_/"~"}_${arch}.tar.xz" | |
| "git+https://github.com/wayne-hartmann/ttf-wps-fonts.git" | |
| "http://kdl.cc.ksosoft.com/wps-community/download/mui/${pkgver%_*}/mui_es_es.7z" | |
| "http://kdl.cc.ksosoft.com/wps-community/download/mui/${pkgver%_*}/mui_es_mx.7z" | |
| "http://wps-community.org/download/dicts/es_ES.zip") | |
| sha512sums=('SKIP' | |
| 'SKIP' | |
| '18b623ac38d83afe5c721a8d7a3013ff5876e552a3692a14af14545d61be56764e6b665d51fd4865b64f84e7d45167c289759f3a95cf60b4b00af9c7d22cd735' | |
| '1537250a2829f6bb129b1c1ff83773d543b8e2a3158cced1e9a7590b2eb8801a37f2d8e5c089fabfdd485bb8f0afd04cd1fd74074475f16049ba3a6c8f5d70f7' | |
| '0c9cae3f4bae8c61eb6c6c060f12271d20f383b453387c1e3c829bb79fd309b83ac3d655a10ad57f88d8637f18903361bdb4b04660a563ee84b56b6f4f1cef01') | |
| PKGEXT=".pkg.tar" | |
| prepare() { | |
| cd wps-office_${pkgver/_/"~"}_${arch} | |
| sed -i 's|/opt/kingsoft/wps-office|/usr/lib|' wps wpp et | |
| } | |
| package() { | |
| install -d "$pkgdir"/usr/{lib,bin,share/fonts/{wps-office,wps-fonts}} | |
| cp -r office6 "$pkgdir/usr/lib" | |
| cp -r es_ES "$pkgdir/usr/lib/office6/dicts" | |
| install -m644 "ttf-wps-fonts/"*.{ttf,TTF} "$pkgdir/usr/share/fonts/wps-fonts/" | |
| cd wps-office_${pkgver/_/"~"}_${arch} | |
| cp -r office6 "$pkgdir/usr/lib" | |
| cp -r resource/* "$pkgdir/usr/share" | |
| cp -r fonts/* "$pkgdir/usr/share/fonts/wps-office" | |
| install -m755 wps wpp et "$pkgdir/usr/bin" | |
| install -Dm644 office6/mui/default/EULA.txt "$pkgdir/usr/share/licenses/$pkgname/EULA.txt" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export XDG_DATA_HOME=${XDG_DATA_HOME:-/usr/share/} | |
| ksv_xdg_dirs="/usr/share/:$XDG_DATA_DIRS" | |
| ksv_xdg_dir= | |
| ksv_def_icon_theme=icons/hicolor | |
| ksv_wps_mimes=('application-wps-office.wps' 'wps-office-wps.png' 'application-wps-office.wpt' 'wps-office-wpt.png') | |
| ksv_word_mimes=('application-wps-office.doc' 'wps-office-doc.png' 'application-wps-office.dot' 'wps-office-dot.png' 'application-vnd.ms-word' 'wps-office-doc.png' 'application-msword' 'wps-office-doc.png' 'application-msword-template' 'wps-office-dot.png' 'application-wps-office.docx' 'wps-office-doc.png' 'application-wps-office.dotx' 'wps-office-dot.png' ) | |
| ksv_et_mimes=('application-wps-office.et' 'wps-office-et.png' 'application-wps-office.ett' 'wps-office-ett.png') | |
| ksv_excel_mimes=('application-wps-office.xls' 'wps-office-xls.png' 'application-wps-office.xlt' 'wps-office-xlt.png' 'application-vnd.ms-excel' 'wps-office-xls.png' 'application-msexcel' 'wps-office-xls.png' 'application-wps-office.xlsx' 'wps-office-xls.png' 'application-wps-office.xltx' 'wps-office-xlt.png' ) | |
| ksv_wpp_mimes=('application-wps-office.dps' 'wps-office-dps.png' 'application-wps-office.dpt' 'wps-office-dpt.png') | |
| ksv_ppt_mimes=('application-wps-office.ppt' 'wps-office-ppt.png' 'application-wps-office.pot' 'wps-office-pot.png' 'application-vnd.ms-powerpoint' 'wps-office-ppt.png' 'application-vnd.mspowerpoint' 'wps-office-ppt.png' 'application-powerpoint' 'wps-office-ppt.png' 'application-wps-office.pptx' 'wps-office-ppt.png' 'application-wps-office.potx' 'wps-office-pot.png' ) | |
| function whisperer(){ | |
| echo "-----------------------------------------------------------------------" | |
| echo "For more info and more troubleshooting visit:" | |
| echo "Chinese: http://linux.wps.cn/" | |
| echo "English: http://wps-community.org/" | |
| echo "-----------------------------------------------------------------------" | |
| echo "" | |
| echo "-----------------------------------------------------------------------" | |
| echo "Kingsoft Office (WPS Office), is an office productivity suite." | |
| echo "" | |
| echo "Kingsoft Office (also named WPS Office) including Writer, Presentation" | |
| echo "and Spreadsheets, is a powerful office suite, which is able to process" | |
| echo "word file, produce wonderful slides, and analyze data as well. It is" | |
| echo "deeply compatible with all of the latest Microsoft Office file formats. " | |
| echo "It can easily open and read the documents created with Microsoft Office." | |
| echo "" | |
| echo "This is the Linux version, and it's now an ALPHA package." | |
| echo "-----------------------------------------------------------------------" | |
| } | |
| function ks_install_icon() | |
| { | |
| local context=$1 | |
| shift | |
| local mode=$1 | |
| shift | |
| local png= | |
| local mime= | |
| local nextIsPng=0 | |
| for item in $@ | |
| do | |
| if [ "" = "${item}" ] ; then | |
| continue | |
| fi | |
| if [ ${nextIsPng} -eq 1 ] ; then | |
| png=${item} | |
| for i in 16 22 32 48 64 128 256; do | |
| if [ -e "${ksv_xdg_dir}/${ksv_def_icon_theme}/${i}x${i}/${context}/${png}" ] ; then | |
| xdg-icon-resource install --noupdate --mode ${mode} --context ${context} --size ${i} "${ksv_xdg_dir}/${ksv_def_icon_theme}/${i}x${i}/${context}/${png}" ${mime} | |
| fi | |
| done | |
| nextIsPng=0 | |
| else | |
| mime=${item} | |
| nextIsPng=1 | |
| fi | |
| done | |
| } | |
| function ks_config_default_mime_open() | |
| { | |
| local desktop=$1 | |
| shift | |
| local png= | |
| local mime= | |
| local nextIsPng=0 | |
| for item in $@ | |
| do | |
| if [ "" = "${item}" ] ; then | |
| continue | |
| fi | |
| if [ ${nextIsPng} -eq 1 ] ; then | |
| png=${item} | |
| nextIsPng=0 | |
| else | |
| mime=${item/application-/application/} | |
| xdg-mime default ${desktop} ${mime} | |
| nextIsPng=1 | |
| fi | |
| done | |
| } | |
| function ks_init() | |
| { | |
| set -e | |
| for i in `echo "${ksv_xdg_dirs}" | sed 's/:/ /g'` | |
| do | |
| if [ -w ${i}/${ksv_def_icon_theme} ] ; then | |
| ksv_xdg_dir="${i}" | |
| fi | |
| done | |
| } | |
| function ks_config_menu() | |
| { | |
| if [ -f "${ksv_xdg_dir}/applications/wps-office-et.desktop" ] ; then | |
| xdg-mime install --novendor --mode system "${ksv_xdg_dir}/mime/packages/wps-office-et.xml" | |
| xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/applications/wps-office-et.desktop" | |
| #xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-et.desktop" | |
| xdg-desktop-menu forceupdate --mode system | |
| ks_install_icon "mimetypes" "system" "${ksv_et_mimes[*]}" "${ksv_excel_mimes[*]}" | |
| xdg-icon-resource forceupdate --mode system | |
| ks_config_default_mime_open "${ksv_xdg_dir}/applications/wps-office-et.desktop" "${ksv_et_mimes[*]}" "${ksv_excel_mimes[*]}" | |
| fi | |
| if [ -f "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" ] ; then | |
| xdg-mime install --novendor --mode system "${ksv_xdg_dir}/mime/packages/wps-office-wpp.xml" | |
| xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" | |
| #xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" | |
| xdg-desktop-menu forceupdate --mode system | |
| ks_install_icon "mimetypes" "system" "${ksv_wpp_mimes[*]}" "${ksv_ppt_mimes[*]}" | |
| xdg-icon-resource forceupdate --mode system | |
| ks_config_default_mime_open "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" "${ksv_wpp_mimes[*]}" "${ksv_ppt_mimes[*]}" | |
| fi | |
| if [ -f "${ksv_xdg_dir}/applications/wps-office-wps.desktop" ] ; then | |
| xdg-mime install --novendor --mode system "${ksv_xdg_dir}/mime/packages/wps-office-wps.xml" | |
| xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/applications/wps-office-wps.desktop" | |
| #xdg-desktop-menu install --noupdate --novendor --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-wps.desktop" | |
| xdg-desktop-menu forceupdate --mode system | |
| ks_install_icon "mimetypes" "system" "${ksv_wps_mimes[*]}" "${ksv_word_mimes[*]}" | |
| xdg-icon-resource forceupdate --mode system | |
| ks_config_default_mime_open "${ksv_xdg_dir}/applications/wps-office-wps.desktop" "${ksv_wps_mimes[*]}" "${ksv_word_mimes[*]}" | |
| fi | |
| } | |
| function ks_config_fonts() | |
| { | |
| if [ -d /usr/share/fonts/wps-office ] ; then | |
| cd /usr/share/fonts/wps-office | |
| mkfontscale | |
| mkfontdir | |
| fc-cache -f | |
| fi | |
| } | |
| function ks_config() | |
| { | |
| ks_config_menu | |
| ks_config_fonts | |
| } | |
| function ks_remove() | |
| { | |
| if [ -e /etc/xdg/menus/applications-merged/wps-office.menu ] ; then | |
| rm -rf /etc/xdg/menus/applications-merged/wps-office.menu | |
| fi | |
| if [ -x /usr/bin/update-mime-database ] ; then | |
| update-mime-database "${ksv_xdg_dir}/mime" | |
| fi | |
| if [ -x /usr/bin/update-desktop-database ] ; then | |
| update-desktop-database -q "${ksv_xdg_dir}/applications" | |
| fi | |
| if [ -d /usr/share/fonts/wps-office ] ; then | |
| cd /usr/share/fonts | |
| fc-cache -f | |
| fi | |
| } | |
| function ks_purge() | |
| { | |
| if [ -d /usr/share/fonts/wps-office ] ; then | |
| rm -rf /usr/share/fonts/wps-office | |
| fi | |
| } | |
| function ks_uninstall_icon() | |
| { | |
| local context=$1 | |
| shift | |
| local mode=$1 | |
| shift | |
| local png= | |
| local mime= | |
| local nextIsPng=0 | |
| for item in $@ | |
| do | |
| if [ "" = "${item}" ] ; then | |
| continue | |
| fi | |
| if [ ${nextIsPng} -eq 1 ] ; then | |
| png=${item} | |
| nextIsPng=0 | |
| else | |
| mime=${item} | |
| for i in 48 32 22 16; do | |
| if [ -e "${ksv_xdg_dir}/${ksv_def_icon_theme}/${i}x${i}/${context}/${png}" ] ; then | |
| xdg-icon-resource uninstall --noupdate --mode ${mode} --context ${context} --size ${i} ${mime} | |
| fi | |
| done | |
| nextIsPng=1 | |
| fi | |
| done | |
| } | |
| function ks_prerm_uninstall_menu() | |
| { | |
| if [ -f "${ksv_xdg_dir}/applications/wps-office-et.desktop" ] ; then | |
| xdg-mime uninstall --mode system "${ksv_xdg_dir}/mime/packages/wps-office-et.xml" | |
| #xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-et.desktop" | |
| xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/applications/wps-office-et.desktop" | |
| xdg-desktop-menu forceupdate --mode system | |
| ks_uninstall_icon "mimetypes" "system" "${ksv_et_mimes[*]}" "${ksv_excel_mimes[*]}" | |
| xdg-icon-resource forceupdate --mode system | |
| fi | |
| if [ -f "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" ] ; then | |
| xdg-mime uninstall --mode system "${ksv_xdg_dir}/mime/packages/wps-office-wpp.xml" | |
| #xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" | |
| xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/applications/wps-office-wpp.desktop" | |
| xdg-desktop-menu forceupdate --mode system | |
| ks_uninstall_icon "mimetypes" "system" "${ksv_wpp_mimes[*]}" "${ksv_ppt_mimes[*]}" | |
| xdg-icon-resource forceupdate --mode system | |
| fi | |
| if [ -f "${ksv_xdg_dir}/applications/wps-office-wps.desktop" ] ; then | |
| xdg-mime uninstall --mode system "${ksv_xdg_dir}/mime/packages/wps-office-wps.xml" | |
| #xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/desktop-directories/wps-office.directory" "${ksv_xdg_dir}/applications/wps-office-wps.desktop" | |
| xdg-desktop-menu uninstall --noupdate --mode system "${ksv_xdg_dir}/applications/wps-office-wps.desktop" | |
| xdg-desktop-menu forceupdate --mode system | |
| ks_uninstall_icon "mimetypes" "system" "${ksv_wps_mimes[*]}" "${ksv_word_mimes[*]}" | |
| xdg-icon-resource forceupdate --mode system | |
| fi | |
| } | |
| function ks_prerm_upgrade() | |
| { | |
| ks_prerm_uninstall_menu | |
| } | |
| function ks_prerm_remove() | |
| { | |
| ks_prerm_uninstall_menu | |
| } | |
| function ks_main() | |
| { | |
| if [ $# -eq 0 ] ; then | |
| return; | |
| fi | |
| ks_init | |
| case $1 in | |
| configure ) | |
| shift | |
| ks_config $@ | |
| ;; | |
| prerm ) | |
| shift | |
| ks_prerm_remove $@ | |
| ;; | |
| remove ) | |
| shift | |
| ks_remove $@ | |
| ks_purge $@ | |
| ;; | |
| preupgrade ) | |
| shift | |
| ks_prerm_upgrade $@ | |
| ;; | |
| esac | |
| } | |
| post_install() | |
| { | |
| ks_main configure | |
| whisperer | |
| } | |
| pre_upgrade() | |
| { | |
| ks_main preupgrade | |
| } | |
| post_upgrade() | |
| { | |
| ks_main configure | |
| whisperer | |
| } | |
| pre_remove() | |
| { | |
| ks_main prerm | |
| } | |
| post_remove() | |
| { | |
| ks_main remove | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment