This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
narou
executable file
·63 lines (58 loc) · 1.38 KB
/
narou
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#
# Usage:
# narou <narou-command>
#
# Example:
# narou -h to see on-line help
# narou ls to see the list of contents
# narou download n4830bu to download n4830bu narou-shousetsu
# narou web to start web UI
#
# Notice:
# "narou web" ignore all options and starts web UI at localip:8000
envs="http_proxy https_proxy ftp_proxy no_proxy"
data=$HOME/.narou
# check environment variables of particular names in $envs and pass them to container
for i in $envs; do
v=`eval echo $"$i"`
case x$v in
x) ;; # nothing to do
*) opt="-e $i=$v $opt"
esac
done
# initialize narou configuration directory
if [ ! -d $data ]; then
mkdir $data
fi
case x$1 in
xw|xweb)
# retrieve external IP address of local machine to allow access from other machiens
IP=`ip route get 1 | awk '{print $NF;exit}'`
echo "connect $IP:8000 from web browser"
opt="-p $IP:8000-8001:8000-8001 $opt"
set -- narou web -p 8000 -n
narou s server-ws-add-accepted-domains=$IP
;;
xsh)
set -- sh
;;
xbash)
set -- sh
;;
xinit)
case x$# in
x1)
set -- narou init -p /opt/narou/AozoraEpub3 --line-height 1.6
;;
*)
set -- narou "$@"
;;
esac
;;
*)
set -- narou "$@"
;;
esac
# echo docker run -it --rm $opt -v $data:/opt/narou jam7/narou-alpine "$@"
docker run -it --rm $opt -v $data:/opt/narou jam7/narou-alpine "$@"