2021-01-01 19:35:55 +01:00
#!/bin/bash
[ " $HOSTNAME " != lime2 ] || exit 1
2021-01-01 19:22:33 +01:00
2021-01-05 09:45:29 +01:00
echo "Pulling procedures-tssr..."
2021-01-04 14:19:41 +01:00
awk -v header = " $( <./header.html) " '{sub(/===HEADER===/,header)} 1' ./procedures-tssr/index.template.html |
awk -v footer = " $( <./footer.html) " '{sub(/===FOOTER===/,footer)} 1' > ./procedures-tssr/index.tmp.html
2021-01-03 21:43:15 +01:00
2021-01-01 19:22:33 +01:00
for folder in ~/tssr/procedures/*; do
if [ -d " $folder " ] ; then
2021-01-01 19:56:20 +01:00
name = $( basename " $folder " )
2021-01-03 21:43:15 +01:00
if [ [ " $name " = *chose* ] ] ; then # ignore procedure_chose
2021-01-01 21:05:23 +01:00
echo ignoring " $name "
else
echo found " $name "
cp " $folder " /procedure*.pdf ./procedures-tssr/procedure_" $name " .pdf
2021-01-05 11:11:51 +01:00
git add ./procedures-tssr/procedure_" $name " .pdf
2021-01-03 23:30:22 +01:00
sed -i " s@===PROCEDURE===@<li><p><a href='./procedure_ ${ name } .pdf'>procedure_ ${ name } .pdf</a></p></li>\n===PROCEDURE===@g " ./procedures-tssr/index.tmp.html
2021-01-01 21:05:23 +01:00
fi
2021-01-01 19:22:33 +01:00
fi
done
2021-01-03 21:43:15 +01:00
2021-01-05 09:45:29 +01:00
sed 's/===PROCEDURE===//g' ./procedures-tssr/index.tmp.html > ./procedures-tssr/index.html && rm ./procedures-tssr/index.tmp.html && echo "Done"
2021-01-03 21:43:15 +01:00
2021-01-05 11:11:51 +01:00
git add ./procedures-tssr/index.html
2021-01-03 21:43:15 +01:00
exit 0