ubuntu install sogo cloud

paul@paul-laptop:~/scripts$ cat ins-ibus-sogoupycc.sh
#!/bin/sh
set -e

PACKAGE_DIR=$HOME/packages
SOGOUPYCC=ibus-sogoupycc-0.2.5
SOGOUPYCC_DB=/usr/share/ibus-sogoupycc/
OPEN_PHRASE_FILENAME=open-phrase-201003.tar.gz
OPEN_PHRASE_URL=http://ibus-sogoupycc.googlecode.com/files/$OPEN_PHRASE_FILENAME
## Prepare the build environment
PACKAGE_IME="liblua5.1-0-dev liblua5.1-socket2 libsqlite3-dev libgtk2.0-dev libibus-dev libnotify-dev lua5.1 cmake"

PACKAGE=$PACKAGE_IME
function install_package {

echo "\$@: $@"
  for pack in $@
  do
    echo "Installing ${pack}..."
    sudo apt-get -y --force-yes install ${pack} || (echo "Error in installing ${pack}"; exit 1 )
    echo
  done
}


## Change working directory
function cd_sogoupycc {
  if ! [ -d $PACKAGE_DIR ] ; then
    mkdir -p $PACKAGE_DIR
  fi
  cd $PACKAGE_DIR
}

## Download and build sogou clound input method
function download_sogoupycc {
  if ! [ -f $SOGOUPYCC.tar.gz ] ; then
    wget http://ibus-sogoupycc.googlecode.com/files/$SOGOUPYCC.tar.gz
  fi
  if ! [ -f $OPEN_PHRASE_FILENAME ] ; then
    wget $OPEN_PHRASE_URL
  fi
}

function build_sogoupycc {
  ## Build sogou coloud input method
  tar xzfv $SOGOUPYCC.tar.gz
  cd  $SOGOUPYCC
  ./build.sh
  cd build
  sudo make install
}

function extract_db {
  if ! [ -d $SOGOUPYCC_DB ] ; then
    sudo mkdir -p $SOGOUPYCC_DB
  fi
  sudo tar xzfv $OPEN_PHRASE_FILENAME -C $SOGOUPYCC_DB
}

cd_sogoupycc
install_package $PACKAGE
download_sogoupycc
build_sogoupycc
extract_db
## restart ibus daemon and add sogou coloud input method to ibus
ibus-daemon -rxd

你可能感兴趣的:(C++,c,F#,ubuntu,C#)