#! /bin/sh
#
# create_printout.sh
# Copyright (C) 2019-2021 Uwe Schitt <uwe.schmitt@id.ethz.ch>
#
# Distributed under terms of the MIT license.
#

function create_md {
    cat credentials.txt | while read -r USER PASSWORD
    do
        echo "### Preparation"
        echo "1. Start Computers, choose *Boot Fedora* in the boot menu shown."
        echo
        echo "2. To login use:"
        echo
        echo "     - user     : <code>$USER</code>"
        echo
        echo "     - password : <code>$PASSWORD</code>"
        echo
        echo "3. Open a terminal: Click on **Activities** (top left corner), then search for **Terminal**"
        echo
        echo "4. To download startup script enter"
        echo
        echo '   ```'
        echo "   wget https://sis.id.ethz.ch/installer_mlw.zip"
        echo '```'

        echo "    and press RETURN."
        echo
        echo "5. To extract the downloaded archive enter"
        echo
        echo '   ```'
        echo "   unzip installer_wlw.zip"
        echo '```'

        echo "    and press RETURN."
        echo
        echo "### During the course"
        echo
        echo "To startup jupyter notebook on Euler enter"
        echo
        echo '```'
        echo "bash start_jupyter_nb.sh"
        echo '```'
        echo "   and press RETURN."
        echo
        echo "### After the course"
        echo
        echo "To upload notebooks to your polybox:"
        echo
        echo '```'
        echo "bash upload_to_polybox.sh"
        echo '```'
        echo "and press RETURN. The script will ask you for your NETHZ name"
        echo "and password."
        echo '<p style="page-break-after: always;" />'
    done
}


OUT=printout.pdf

create_md | pandoc -f markdown -t html5 -c pandoc.css -o $OUT -
echo
ls -l $OUT