do_postinstall.sh 2.2 KB
Newer Older
1 2
#!/bin/bash

3 4 5 6 7

logfile="/var/log/`basename $0`_`date +%Y%m%d-%H%M`"
exec &> >(tee -a "$logfile")


8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# 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`

31 32 33 34 35
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
36
$DIR/create_cifs_mounts.sh
37 38 39
$DIR/set_mime_apps.sh
$DIR/set_screens.sh
$DIR/install_print_drivers.sh
David Beniamine's avatar
David Beniamine committed
40
$DIR/install_vnc.sh
41 42
$DIR/install_conky.sh
$DIR/upgrade_repository.sh
David Beniamine's avatar
David Beniamine committed
43
$DIR/fix_xscreensaver.sh
44
$DIR/fix_pcmanfm.sh
45

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

48 49 50
echo "Récupération de la clef ssh du serveur"
tftp ecole-dc <<'EOF'
get id_rsa.pub
51
get secret.tgz
52 53 54 55 56 57 58
quit
EOF
sshdir="/root/.ssh/"
mkdir -p $sshdir
mv id_rsa.pub $sshdir/authorized_keys
chown -R root:root $sshdir

59
mkdir -p /etc/cifs/secrets
David Beniamine's avatar
David Beniamine committed
60
mv secret.tgz /etc/cifs/secrets/
61 62 63 64
cd /etc/cifs/secrets
tar xvzf secret.tgz
rm secret.tgz
chown -R root:root /etc/cifs
David Beniamine's avatar
David Beniamine committed
65
cd -
66

67
hostn=`hostname`
David Beniamine's avatar
David Beniamine committed
68 69
echo "Veuillez entrer le numéro de poste"
read numero
70 71 72
newhost="u$numero"
sudo sed -i "s/$hostn/$newhost/g" /etc/hosts
sudo sed -i "s/$hostn/$newhost/g" /etc/hostname
73
cp "$DIR/fond admin.png" /home/administrateur/Documents/
74 75
cp $DIR/session.sh /usr/local/bin/
$DIR/add_session_script.sh
76 77 78 79 80 81 82

$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