do_postinstall.sh 1.98 KB
Newer Older
David Beniamine's avatar
David Beniamine committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/bin/bash

# Copyright (C) 2018  Tetras Libre <Contact@Tetras-Libre.fr>
# Author: Beniamine, David <David.Beniamine@Tetras-Libre.fr>
#
# 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 <http://www.gnu.org/licenses/>.

if [ `whoami` != "root" ]
then
    echo "Ce script devrait être exécuté en sudo"
    exit 1
fi
DIR=`dirname $0`

26 27 28 29 30
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
31
$DIR/create_cifs_mounts.sh
32 33 34
$DIR/set_mime_apps.sh
$DIR/set_screens.sh
$DIR/install_print_drivers.sh
David Beniamine's avatar
David Beniamine committed
35

David Beniamine's avatar
David Beniamine committed
36 37
sed -i -e 's/lametro.fr/perdu.com/' /etc/conky/conky.conf

David Beniamine's avatar
David Beniamine committed
38 39 40
echo "Récupération de la clef ssh du serveur"
tftp ecole-dc <<'EOF'
get id_rsa.pub
41
get secret.tgz
David Beniamine's avatar
David Beniamine committed
42 43 44 45 46 47 48
quit
EOF
sshdir="/root/.ssh/"
mkdir -p $sshdir
mv id_rsa.pub $sshdir/authorized_keys
chown -R root:root $sshdir

49 50 51 52 53 54
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
David Beniamine's avatar
David Beniamine committed
55
cd -
56 57


David Beniamine's avatar
David Beniamine committed
58
hostn=`hostname`
David Beniamine's avatar
David Beniamine committed
59 60
echo "Veuillez entrer le numéro de poste"
read numero
David Beniamine's avatar
David Beniamine committed
61 62 63
newhost="u$numero"
sudo sed -i "s/$hostn/$newhost/g" /etc/hosts
sudo sed -i "s/$hostn/$newhost/g" /etc/hostname
David Beniamine's avatar
David Beniamine committed
64
cp "$DIR/fond admin.png" /home/administrateur/Documents/
65 66
cp $DIR/session.sh /usr/local/bin/
$DIR/add_session_script.sh
David Beniamine's avatar
David Beniamine committed
67 68 69 70 71 72 73

$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