-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
62 lines (43 loc) · 730 Bytes
/
build.sh
File metadata and controls
62 lines (43 loc) · 730 Bytes
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
#!/bin/bash
if [ -z "$1" ]; then
echo usage: $0 outdir
exit 2
fi
if ! [ -d "$1" ]; then
mkdir -p "$1" || exit 4
fi
pushd "$1" > /dev/null
dst=`pwd`
popd > /dev/null
dstd=$dst/tasks
mkdir -p $dstd
rm -f $dst/*
for i in [0-9]*_*; do
echo "Processing $i..."
if ! [ -x "$i/build.sh" ]; then
echo Skipping $i, no build.sh found
continue
fi
(
cd "$i"
mkdir -p $dstd/$i
./build.sh $dstd/$i
cp task $dstd/$i/README.md
cat >> $dst/full.md <<EOF
\newpage
## $i
### Task
`cat task`
### Solution
`cat solution`
### Rationale
`cat rationale`
EOF
)
echo "Finished $i..."
done
pandoc -f markdown -t latex -V geometry:margin=1in $dst/full.md --toc -o $dst/full.pdf
(
cd $dst
tar cfj taskfile tasks
)