@@ -15,12 +15,18 @@ execdocker () {
15
15
$RUNTIME rm -f $CNAME 2> /dev/null
16
16
fi
17
17
18
+ case $RUNTIME in
19
+ * podman* ) USERNS=keep-id;;
20
+ * ) USERNS=host;;
21
+ esac
22
+
18
23
$RUNTIME run \
19
24
-it \
20
25
--name=$CNAME \
21
26
--rm \
22
27
-p 9090:9090 \
23
28
--user $( id -u) \
29
+ --userns=$USERNS \
24
30
-v " $DIR :/training:z" \
25
31
-e " LANG=$CLANG " \
26
32
-e " LANGUAGE=$CLANG " \
@@ -36,7 +42,7 @@ printhandouts () {
36
42
# Removes showoff's Section markers for PDF output
37
43
sed -i ' s/~~~.*~~~ //g' static/index.html
38
44
echo -e " \n--- RUN WKHTMLTOPDF FOR HANDOUTS ---"
39
- execdocker " wkhtmltopdf --enable-local-file-access --load-error-handling ignore -s A5 --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING} _${1} -handouts.pdf"
45
+ execdocker " wkhtmltopdf --enable-local-file-access --load-error-handling ignore -s ${FORMAT} --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING} _${1} _ ${FORMAT } -handouts.pdf"
40
46
}
41
47
42
48
# Generate exercises as showoff HTML and convert HTML to PDF
@@ -46,7 +52,7 @@ printexercises () {
46
52
# Removes showoff's Section markers for PDF output
47
53
sed -i ' s/~~~.*~~~ //g' static/index.html
48
54
echo -e " \n--- RUN WKHTMLTOPDF FOR EXERCISES ---"
49
- execdocker " wkhtmltopdf --enable-local-file-access --load-error-handling ignore -s A5 --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING} _${1} -exercises.pdf"
55
+ execdocker " wkhtmltopdf --enable-local-file-access --load-error-handling ignore -s ${FORMAT} --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING} _${1} _ ${FORMAT } -exercises.pdf"
50
56
}
51
57
52
58
# Generate solutions as showoff HTML and convert HTML to PDF
@@ -56,7 +62,7 @@ printsolutions () {
56
62
# Removes showoff's Section markers for PDF output
57
63
sed -i ' s/~~~.*~~~ //g' static/index.html
58
64
echo -e " \n--- RUN WKHTMLTOPDF FOR SOLUTIONS ---"
59
- execdocker " wkhtmltopdf --enable-local-file-access --load-error-handling ignore -s A5 --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING} _${1} -solutions.pdf"
65
+ execdocker " wkhtmltopdf --enable-local-file-access --load-error-handling ignore -s ${FORMAT} --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING} _${1} _ ${FORMAT } -solutions.pdf"
60
66
}
61
67
62
68
setlayout () {
@@ -116,6 +122,27 @@ esac
116
122
117
123
setlayout $LAYOUT
118
124
125
+ echo -e " \n### FORMAT ###"
126
+
127
+ echo -e "
128
+ [1] A5
129
+ [2] A4\n"
130
+
131
+ FORMAT_DEFAULT=1
132
+ read -p " Which format? [1-2] (Default: " $FORMAT_DEFAULT " ): " FORMAT
133
+ FORMAT=" ${FORMAT:- $FORMAT_DEFAULT } "
134
+
135
+ while [[ $FORMAT != [1-2] ]]; do
136
+ echo " Invalid option, try again..."
137
+ read -p " Which format? [1-2] (Default: " $FORMAT_DEFAULT " ): " FORMAT
138
+ FORMAT=" ${FORMAT:- $FORMAT_DEFAULT } "
139
+ done
140
+
141
+ case " $FORMAT " in
142
+ 1) FORMAT=A5;;
143
+ 2) FORMAT=A4;;
144
+ esac
145
+
119
146
echo -e " \n### MODE ###"
120
147
121
148
echo -e "
0 commit comments