jail(iocage)で、なろう>mobiその2

その1に続けて、もろもろインストール。
どうも、iocage pkgコマンドは、pkgコマンドのキー入力待ちでプロンプト表示せずに停止しちゃうっぽい。-yオプション付きで自動インストールさせればOK。

iocage

外と通信できるよう、ipaddrを割り当てして、起動。

# iocage set ip4_addr="em0|192.168.0.11/24" narou
# iocage start narou
openjdk8
# iocage pkg narou install -y openjdk8-jre
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 29 package(s) will be affected (of 0 checked):
・・・省略・・・
Message from openjdk8-jre-8.252.09.1:

--
This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and
procfs(5) mounted on /proc.

If you have not done it yet, please do the following:

        mount -t fdescfs fdesc /dev/fd
        mount -t procfs proc /proc

To make it permanent, you need the following lines in /etc/fstab:

        fdesc   /dev/fd         fdescfs         rw      0       0
        proc    /proc           procfs          rw      0       0

#

openjdkが、fdescfsとprocfsを要求してるので、こう。devfsも

# iocage set mount_fdescfs=1 narou
# iocage set mount_procfs=1 narou
# iocage set mount_devfs=1 narou
# iocage restart narou
ruby
# iocage pkg narou install -y ruby
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 5 package(s) will be affected (of 0 checked):
・・・省略・・・
Message from ruby-2.6.6,1:

--
Some of the standard commands are provided as separate ports for ease
of upgrading:

        devel/ruby-gems:        gem - RubyGems package manager
        devel/rubygem-irb:      irb - Interactive Ruby
        devel/rubygem-rake:     rake - Ruby Make
        devel/rubygem-rdoc:     rdoc - Ruby Documentation System

And some of the standard libraries are provided as separate ports
since they require extra dependencies:

        databases/rubygem-dbm:  DBM module
        databases/rubygem-gdbm: GDBM module

Install them as occasion demands.

#  iocage pkg narou install -y devel/ruby-gems
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):
・・・省略・・・
narou

これはjailの中で実行。

# iocage console narou
root@narou:~ # gem install narou
・・・省略。結構時間かかった。・・・
Parsing documentation for narou-3.5.1
Installing ri documentation for narou-3.5.1
Done installing documentation for termcolorlight, rubyzip, mime-types-data, mime-types, mail, pony, diff-lcs, rack, rack-protection, tilt, sinatra, multi_json, rack-test, backports, sinatra-contrib, ffi, rb-inotify, rb-fsevent, sass-listen, sass, temple, haml, memoist, systemu, erubis, open_uri_redirections, concurrent-ruby, i18n, thread_safe, tzinfo, minitest, activesupport, unicode-display_width, narou after 251 seconds
34 gems installed
root@narou:~ #
AozoraEpub3

openjdk8で、com.sun.image.codecが外れたせい?で、java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.ImageFormatException なことになってしまうので、githubから持ってきたソースを編集して、AozoraEpub3.jarを生成。変更点はこちら。
Change to support OpenJDK by jam7 · Pull Request #12 · hmdev/AozoraEpub3 · GitHub

jail内の、/root/AozoraEpub3に展開。面倒なのでホスト側からコピー。

# mkdir /iocage/jails/narou/root/root/AozoraEpub3
# cp -r AozoraEpub3 /iocage/jails/narou/root/root/AozoraEpub3
kindlegen

なんと、以前公開されてたLinux版バイナリがなくなってる。。手元にあったのを再利用。
今後はWindows版をwineで使うしかない?
static linkされてるので、portslinux-baseは不要。

# kldload linux
# echo 'linux_load="YES"' >> /boot/loader.conf
# cp kindlegen  /iocage/jails/narou/root/root/AozoraEpub3
narouの設定

ワークディレクトリ/novelを作成、
mobi出力先として、ホストの/share/mobiを、jailの/mediaにnullfsマウント。

# mkdir /iocage/jails/narou/root/novel
# iocage fstab -l narou
+-------+-------------+
| INDEX | FSTAB ENTRY |
+=======+=============+
+-------+-------------+
# iocage fstab narou -a '/share/mobi /media nullfs rw 0 0'
Successfully added mount to narou's fstab
# iocage fstab -l narou
+-------+---------------------------------------------------------------------------+
| INDEX |                                FSTAB ENTRY                                |
+=======+===========================================================================+
| 0     | /share/mobi     /iocage/jails/narou/root/media  nullfs  rw      0       0 |
+-------+---------------------------------------------------------------------------+
#

これで最後。後は購読対象を良しなに登録。

# iocage console narou
root@narou:~ # cd /novel
root@narou:/novel # setenv LANG ja_JP.UTF-8
root@narou:/novel # narou init
AozoraEpub3の設定を行います
                            !!!WARNING!!!
AozoraEpub3の構成ファイルを書き換えます。narouコマンド用に別途新規インストールしておくことをオススメします

AozoraEpub3のあるフォルダを入力して下さい:
(未入力でスキップ)
>/root/AozoraEpub3

行間の調整を行います。小説の行の高さを設定して下さい(単位 em):
1em = 1文字分の高さ
行の高さ=1文字分の高さ+行間の高さ
オススメは 1.8
1.6 で若干行間狭め。1.8 だと一般的な小説程度。2.0 くらいにするとかなりスカスカ
(未入力で 1.8 を採用)
>

(次のファイルを書き換えました)
/root/AozoraEpub3/chuki_tag.txt

(次のファイルをコピーor上書きしました)
/root/AozoraEpub3/AozoraEpub3.ini
/root/AozoraEpub3/template/OPS/css_custom/vertical_font.css
AozoraEpub3の設定を終了しました
root@narou:/novel # narou setting convert.copy-to=/media
convert.copy-to を /media に設定しました
root@narou:/novel # narou setting device=kindle