#!/bin/bash # Copyright (C) 2018 Tetras Libre # Author: Beniamine, David # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . if [ `whoami` != "root" ] then echo "Ce script devrait être exécuté en sudo" exit 1 fi DIR=`dirname $0` cp "$DIR/fond admin.png" /home/administrateur/Documents/ cp $DIR/conky.conf /etc/conky/ cp $DIR/session.sh /usr/local/bin/ $DIR/add_session_script.sh $DIR/create_cifs_mounts.sh $DIR/set_mime_apps.sh $DIR/set_screens.sh $DIR/install_print_drivers.sh sed -i -e 's/lametro.fr/perdu.com/' /etc/conky/conky.conf echo "Récupération de la clef ssh du serveur" tftp ecole-dc <<'EOF' get id_rsa.pub get secret.tgz quit EOF sshdir="/root/.ssh/" mkdir -p $sshdir mv id_rsa.pub $sshdir/authorized_keys chown -R root:root $sshdir mkdir -p /etc/cifs/secrets mv secret.tgz cd /etc/cifs/secrets tar xvzf secret.tgz rm secret.tgz chown -R root:root /etc/cifs cd - hostn=`hostname` echo "Veuillez entrer le numéro de poste" read numero newhost="u$numero" sudo sed -i "s/$hostn/$newhost/g" /etc/hosts sudo sed -i "s/$hostn/$newhost/g" /etc/hostname cp "$DIR/fond admin.png" /home/administrateur/Documents/ cp $DIR/session.sh /usr/local/bin/ $DIR/add_session_script.sh $DIR/register.sh $newhost cp $DIR/register.sh /etc/cron.weekly/ chmod +x /etc/cron.weekly/register.sh read -p "L'ordinateur va redémarrer, appuyez sur n'importe quelle touche" reboot