Skip to content

Commit

Permalink
Update narou script
Browse files Browse the repository at this point in the history
Specify "documents" sub-directory to docker like "-v
/mnt/Kindle/documents:/mnt/Kindle/documents" to avoid docker under WSL2
problem.  Also update README and version.
  • Loading branch information
jam7 committed Sep 26, 2021
1 parent bab6fbc commit 44ee119
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

RELEASE_VERSION = v1.15
RELEASE_VERSION = v1.16
VERSION = latest

OPTIONS = \
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ $ docker run --rm jam7/narou > narou
$ chmod a+x narou
```

Don't add `-ti` to `docker run`. Otherwise, you may create a narou
script with crlf.
Don't add `-ti` to `docker run`. Otherwise, your narou script may contains
crlf.

Run a generated script to download AozoraEpub3 to `$HOME/.narou/AozoraEpub3*`
and initialize environment for narou.rb.
Expand Down Expand Up @@ -66,7 +66,7 @@ From WSL2, perform mount first.

```
$ sudo mkdir -p /mnt/Kindle
$ sudo mount -t drvfs D: /mnt/Kindle
$ sudo mount -t drvfs d:/ /mnt/Kindle
```

Then, use `narou send`.
Expand All @@ -75,10 +75,15 @@ Then, use `narou send`.
$ narou send
```

Unmount them. This may takes for a while.
Unmount them. It is required to run umount three times on Ubuntu-20.04 with
WSL2.

```
$ sudo umount /mnt/Kindle
$ sudo umount d:/
$ sudo umount d:/
$ sudo umount d:/
$ sudo umount d:/
umount: d:/: no mount point specified.
```

### Run as web service (not tested recently)
Expand Down
14 changes: 13 additions & 1 deletion narou.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,23 @@ xinit)
;;
esac

if [ -d /mnt/Kindle/documents ]; then
MNT_KINDLE_OPT="-v"
MNT_KINDLE="/mnt/Kindle/documents:/mnt/Kindle/documents"
else
MNT_KINDLE_OPT=""
MNT_KINDLE=""
fi

# Need to mount docker.sock in order to use jam7/kindlegen docker image.
# Need to mount kindle device also.
# '-v /mnt/Kindle:/mnt/Kindle' rarely works.
# '-v /mnt/Kindle/documents:/mnt/Kindle/documents' works.
# Related issue: https://github.com/docker/for-win/issues/2151
docker run $TTY --rm $opt \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $data:/opt/narou \
-v /mnt/Kindle/:/mnt/Kindle \
$MNT_KINDLE_OPT $MNT_KINDLE \
-e NAROU_UID="$( id -u )" \
-e NAROU_GID="$( id -g )" \
-e NAROU_USER="$( id -un )" \
Expand Down

0 comments on commit 44ee119

Please sign in to comment.