Mercurial > hg > Members > atton > seminar_slides
annotate build.sh @ 4:ab0287707334
Support exec build scirpt in any working directory
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 30 Jan 2014 21:38:26 +0900 |
parents | 635d8af3f795 |
children | f6d65d2a806f |
rev | line source |
---|---|
1 | 1 #/bin/sh |
2 | |
2
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
3 # definition |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
4 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
5 command="slideshow" |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
6 template_option="-t s6syntax" |
1 | 7 target_filename="*.md" |
8 | |
2
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
9 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
10 # functions |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
11 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
12 command_check() { |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
13 if !(which ${command} >& /dev/null;) then |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
14 echo ${command} not found |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
15 exit |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
16 fi |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
17 } |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
18 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
19 build() { |
4
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
20 ${command} build $1 -o `dirname $1` ${template_option} |
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
21 } |
2
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
22 |
4
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
23 build_slides() { |
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
24 target_list=`find $(dirname $0) -name "${target_filename}"` |
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
25 for target in ${target_list}; do |
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
26 build $target |
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
27 done |
2
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
28 } |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
29 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
30 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
31 # main |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
32 |
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
33 command_check |
4
ab0287707334
Support exec build scirpt in any working directory
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
34 build_slides |
2
635d8af3f795
Fix build script, check command
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
35 |