Skip to content
Snippets Groups Projects
install.sh 1.32 KiB
Newer Older
  • Learn to ignore specific revisions
  • schmittu's avatar
    schmittu committed
    #!/bin/bash
    
    #
    # run_install.sh
    # Copyright (C) 2019 Uwe Schitt <uwe.schmitt@id.ethz.ch>
    #
    # Distributed under terms of the MIT license.
    #
    
    # from https://unix.stackexchange.com/questions/39623/
    err() {
        echo "Error occurred:"
        awk 'NR>L-4 && NR<L+4 { printf "%-5d%3s%s\n",NR,(NR==L?">>>":""),$0 }' L=$1 $0
        exit 1
    }
    trap 'err $LINENO' ERR
    
    
    WORKSHOP_TMP=${HOME}/ml_workshop_notebooks
    
    schmittu's avatar
    schmittu committed
    BASE_URL="https://sis.id.ethz.ch/mlw"
    
    schmittu's avatar
    schmittu committed
    rm -rf ${WORKSHOP_TMP}/*
    
    
    curl -# $BASE_URL/mlw_packages.yml > /tmp/mlw_packages.yml
    curl -# $BASE_URL/setup_anaconda.sh | bash
    
    
    mkdir -p ${WORKSHOP_TMP}
    
    
    curl -# $BASE_URL/notebooks.tar.bz2 | tar -C ${WORKSHOP_TMP} -xjf -
    
    cat >start_mlw.sh <<END
    cd ${WORKSHOP_TMP}
    
    /tmp/conda_envs/mlw/bin/jupyter nbextension enable toc2/main
    
    schmittu's avatar
    schmittu committed
    /tmp/conda_envs/mlw/bin/jupyter notebook
    
    schmittu's avatar
    schmittu committed
    cat >update_notebooks.sh <<END
    rm -rf ${WORKSHOP_TMP}
    mkdir -p ${WORKSHOP_TMP}
    curl -# $BASE_URL/notebooks.tar.bz2 | tar -C ${WORKSHOP_TMP} -xjf -
    END
    
    chmod +x ./update_notebooks.sh
    
    
    echo
    echo
    echo
    echo
    echo
    echo
    echo
    echo
    echo
    echo
    echo WILL START THE NOTEBOOK NOW.
    echo
    echo IN CASE YOU CLOSED THE BROWSER RUN
    echo
    echo             ./start_mlw.sh
    echo
    echo IN THE TERMINAL TO OPEN THE NOTEBOOKS AGAIN.
    echo
    echo PLEASE WRITE DOWN HOW THIS COMMAND, THEN PRESS ENTER TO CONTINUE
    echo
    
    schmittu's avatar
    schmittu committed
    read -p "PRESS ENTER"
    
    schmittu's avatar
    schmittu committed
    ./start_mlw.sh