#!/bin/bash

mkdir -p /opt/labmanager/bin

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

chmod +x *

# servizi systemd
cd /etc/systemd/system
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-apply-config.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-apply-config.timer
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-firefox-home.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-get-config.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-iptables-rules.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-kdm-autologin.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-kioskmode.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-mk-homedir.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-nfs.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame.target
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-usb.service
wget https://gitlab.di.unipmn.it/ulisse/labmanager-systemd/raw/master/systemd/esame-virtualbox.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
#scp -r master2.edu-al.unipmn.it:/home/labsync/opt/backgrounds /opt/

echo "Done!"
