#!/bin/bash

mkdir -p /opt/labmanager/bin

# script per i servizi systemd
cd /opt/labmanager/bin
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/bta-no-usbpen
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/get-config
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/kdm-autologin
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/mk-homedir
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/firefox-home
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/iptables-rules
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/kioskmode
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/nfs
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/usb
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/bin/virtualbox

chmod +x *

# servizi systemd
cd /etc/systemd/system
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-apply-config.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-apply-config.timer
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-firefox-home.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-get-config.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-iptables-rules.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-kdm-autologin.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-kioskmode.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-mk-homedir.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-nfs.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame.target
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-usb.service
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-virtualbox.service


# uncomment next line to disable previous exam system service
#systemctl disable esame.service

systemctl enable esame-*.service
systemctl enable esame-apply-config.timer

# aree degli utenti esame
#scp -r master2.edu-al.unipmn.it:/home/labsync/opt/esame/home /opt/esame

# sfondi
mkdir -p /opt/backgrounds/lab-linux/2017
cd /opt/backgrounds/lab-linux/2017
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-extras/raw/master/backgrounds/lab-linux/2017/KEEPCALM-esame.png
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-extras/raw/master/backgrounds/lab-linux/2017/KEEPCALM-moodle.png
curl -O https://gitlab.di.unipmn.it/ulisse/labmanager-extras/raw/master/backgrounds/lab-linux/2017/KEEPCALM-show.png

echo "Done!"
