-
Notifications
You must be signed in to change notification settings - Fork 0
/
epub
executable file
·209 lines (189 loc) · 4.42 KB
/
epub
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
#export DSSSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/epub/docbook.xsl
export DSSSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/epub3/chunk.xsl
#export DSSSL=../docbook-xsl/epub3.xsl
export XSLTPROC="xsltproc --stringparam toc.section.depth 3 --stringparam section.autolabel 1 --stringparam use.id.as.filename 1 ${DSSSL}"
export PUBLIC_HTML="/home/neo/workspace/netkiller.github.io"
WORKSPACE=/home/neo/workspace
EPUB=$PUBLIC_HTML/download/$(date '+%Y')/epub/
generator(){
#echo $@
PROJECT="Netkiller-"$(echo $1|sed "s/\//-/")
DOCBOOK=$WORKSPACE/$1
mkdir -p ${EPUB}
TMPDIR=$(mktemp -d --suffix=.epub -p /tmp $2.XXXXXX)
cd $TMPDIR
${XSLTPROC} $DOCBOOK/book.xml
# sed "s/{latest}/`date -u`/g" index.epub >index.epub.sed; mv index.epub.sed index.epub
test -f OEBPS/donations.xhtml && sed -i "s/\/images/images/g" OEBPS/donations.xhtml
# if [ ! -d ${PUBLIC_HTML}/${epub} ]; then
# mkdir ${PUBLIC_HTML}/${epub}
# fi
if [ -d $DOCBOOK/images ]; then
#cp -r $DOCBOOK/${xml}/images OEBPS
rsync -a --exclude=.svn $DOCBOOK/images OEBPS/
rsync -a --exclude=.svn $WORKSPACE/Website/images/book/* OEBPS/images/
fi
# find OEBPS -type d -iname ".svn" -exec rm -rf {} \;
echo "application/epub+zip" > mimetype
zip -0Xq ${PROJECT}.epub mimetype
zip -Xr9D ${PROJECT}.epub *
cp *.epub ${EPUB}
cd -
echo $TMPDIR
echo $PROJECT
echo $EPUB
}
english(){
xml=English
html=english/notes
generator
}
website(){
#HTDOCS=$PUBLIC_HTML
#WEBSITE=/usr/share/xml/docbook/stylesheet/nwalsh/website
#XML_CATALOG_FILES=/usr/share/xml/docbook/stylesheet/nwalsh/catalog.xml \
#xsltproc --output Docbook/Website/autolayout.xml ${WEBSITE}/autolayout.xsl Docbook/Website/layout.xml
##xsltproc --stringparam output-root $HTDOCS $WEBSITE/chunk-tabular.xsl autolayout.xml
#xsltproc --stringparam output-root $HTDOCS Docbook/Website/template.xsl Docbook/Website/autolayout.xml
## --stringparam collect.xref.targets yes
#cp -r Docbook/Website/graphics $HTDOCS
#rm -rf $HTDOCS/graphics/.svn
#cp Docbook/Website/stylesheet.css $HTDOCS
exit
}
case "$1" in
architect)
generator Architect architect
;;
freebsd)
generator FreeBSD freebsd
;;
linux)
generator Linux linux
;;
monitoring)
generator Linux/Monitoring monitoring
;;
www)
generator Linux/Web www
;;
project)
generator Linux/Project project
;;
storage)
generator Linux/Storage storage
;;
shell)
generator Linux/Shell shell
;;
security)
generator Linux/Security security
;;
developer)
generator Developer developer
;;
testing)
generator Developer/Testing testing
;;
cryptography)
generator Linux/Cryptography cryptography
;;
database)
generator Database database
;;
mysql)
generator Database/MySQL mysql
;;
nosql)
generator Database/NoSQL nosql
;;
postgresql)
generator Database/PostgreSQL postgresql
;;
management)
generator Management management
;;
openldap)
generator Linux/OpenLDAP openldap
;;
cisco)
generator Network/Cisco cisco
;;
h3c)
generator Network/H3C h3c
;;
docbook)
generator Docbook docbook
;;
version)
generator Linux/Project version
;;
mail)
generator Linux/Mail mail
;;
network)
generator Network network
;;
multimedia)
generator Linux/Multimedia multimedia
;;
english)
english
;;
website)
website
;;
sport)
sport
;;
java)
java
generator Java java
;;
spring)
generator Java/Spring spring
;;
blockchain)
generator Blockchain blockchain
;;
radio)
generator Radio radio
;;
android)
generator Java/Android android
;;
all)
$0 freebsd &
$0 linux &
$0 www &
$0 monitoring &
$0 storage &
$0 centos &
$0 debian &
$0 shell &
$0 architect &
$0 developer &
$0 security &
$0 cryptography &
$0 database &
$0 mysql &
$0 docbook &
$0 openldap &
$0 cisco &
$0 version &
$0 network &
$0 multimedia &
$0 mail &
$0 solaris &
$0 testing &
$0 nosql &
$0 postgresql &
;;
*)
echo $"Usage: $0 {freebsd | linux | monitoring | www | centos | debian | storage | developer | website | security | docbook | architect | cisco | version | mail | intranet | multimedia | solaris | testing | all}"
echo $" $0 {database | mysql | nosql}"
echo $" $0 {cryptography}"
RETVAL=1
esac
exit $RETVAL