Skip to content

Instantly share code, notes, and snippets.

@tatsuya6502
Last active February 27, 2017 14:47
Show Gist options
  • Save tatsuya6502/0c5a15c6c2d1d5917fe0ba9d7e3e303c to your computer and use it in GitHub Desktop.
Save tatsuya6502/0c5a15c6c2d1d5917fe0ba9d7e3e303c to your computer and use it in GitHub Desktop.
trpl-ja scripts
#!/usr/bin/env bash
# For Ubuntu 14.04 Trusty (Ubuntu certified cloud image) on Joyent Cloud. (Image version: 14.04.5 20170222)
# https://docs.joyent.com/public-cloud/instances/virtual-machines/images/linux/ubuntu-certified#1404-20170222
set -uex -o pipefail
export LC_ALL=C
export TRAVIS_OS_NAME=ubuntu
echo 'apt ==================='
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get upgrade
INSTALL_OPTS='-yq --no-install-suggests --no-install-recommends --force-yes'
sudo apt-get install $INSTALL_OPTS pandoc
sudo apt-get install $INSTALL_OPTS curl fontconfig gcc git libc-dev unzip wget
echo 'git clone ============='
git clone --branch=master https://github.com/tatsuya6502/trpl-ja-pdf.git
cd trpl-ja-pdf
git submodule update --init --recursive
echo 'before_install ========'
wget https://raw.githubusercontent.com/y-yu/install-tex-travis/master/install-tex.sh
wget https://raw.githubusercontent.com/y-yu/install-tex-travis/master/tlmgr.sh
chmod +x install-tex.sh tlmgr.sh
curl -L -O http://downloads.sourceforge.net/project/dejavu/dejavu/2.35/dejavu-fonts-ttf-2.35.zip
unzip dejavu-fonts-ttf-2.35.zip
mkdir "$HOME/.fonts"
cp dejavu-fonts-ttf-2.35/ttf/*.ttf "$HOME/.fonts/"
fc-cache -f -v
echo 'install rust =========='
mkdir -p $HOME/rust-installer/
curl -sL https://static.rust-lang.org/rustup.sh -o $HOME/rust-installer/rustup.sh
sh $HOME/rust-installer/rustup.sh --prefix=~/rust --spec=stable -y --disable-sudo 2> /dev/null
export PATH=$PATH:$HOME/rust/bin
rustc --version
cargo --version
echo 'install ==============='
. ./install-tex.sh
./tlmgr.sh update --self --all || echo "ignore errors"
./tlmgr.sh install collection-luatex collection-langjapanese \
collection-fontsrecommended filehook type1cm mdframed \
needspace hyphenat quotchap framed
#!/usr/bin/env bash
set -uex -o pipefail
export LC_ALL=C
export PATH=$PATH:$HOME/rust/bin:$HOME/texlive/2016/bin/x86_64-linux
cd $HOME/trpl-ja-pdf
echo 'before_script ========='
cp trpl_meta.yml trpl-ebook/
echo "pub const RELEASE_DATE: &'static str = \"$(date +%F)\";" | cat - options.rs.template > options.rs
cp options.rs trpl-ebook/src/convert_book/
rm -rf trpl-ebook/trpl
cp -r the-rust-programming-language-ja/1.9/ja/book trpl-ebook/trpl
echo 'script ================'
cd trpl-ebook
cargo run --release
cp dist/*a4.pdf ../a4.pdf
cp dist/*letter.pdf ../letter.pdf
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment