-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrestore_ethernet
More file actions
90 lines (60 loc) · 1.77 KB
/
restore_ethernet
File metadata and controls
90 lines (60 loc) · 1.77 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
#First create
#zenity --error --text='Something very bad has happened!'
CURRENTUSER=`echo $USER`
zenity --info --text="Bienvenue `echo $CURRENTUSER` je suis le Logiciel NetRestore Ekimia 1.0 , appuyez sur OK puis entrez votre mot de passe"
PASSWORD=`zenity --password`
#echo $PASSWORD
echo $PASSWORD |sudo -S bash
(echo "10" ; sleep 0
echo "# 1-Sauvegarde des fichiers de configuration" ; sleep 1
sudo cp /etc/network/interfaces /etc/network/interfaces.backup
sudo rm /etc/network/interfaces
sudo cp /etc/resolv.conf /etc/resolv.conf.backup
sudo rm /etc/resolv.conf
echo "20" ; sleep 1
echo "# 2-ecriture du nouveau fichier resolv" ;
sudo bash -c 'cat > /etc/resolv.conf' << EOF
nameserver 8.8.4.4
EOF
echo "30" ; sleep 1
echo "# 3-ecriture du nouveau fichier interfaces" ;
sudo bash -c 'cat > /etc/network/interfaces' << EOF
#generated by restoretheenet
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet dhcp
auto eth0
iface eth0 inet dhcp
EOF
echo "40" ; sleep 1
echo "4-demande d'adresse IP a la box" ; sleep 1
sudo ifconfig eth0 down
sudo ifconfig eth0 up
sudo dhclient -r eth0
sudo dhclient eth0
echo "50" ; sleep 1
echo "# 5-Test connection internet " ; sleep 0
ping -c2 -i1 free.fr
#if [ $? -eq 0 ]
#then echo "# Test connection internet OK "
#else then echo "# Test connection internet echoué "
#fi
echo "60" ; sleep 1
echo "# 6-installation gitso " ; sleep 0
sudo apt-get install gdebi-core
wget -O gitsotrusty.deb bit.ly/gitsodeb
sudo gdebi -n gitsotrusty.deb
sudo bash -c 'cat > /etc/gitso-hosts' << EOF
bureau1.ekimia.fr
EOF
echo "100" ; sleep 0
) |zenity --progress \
--title="Restore Ethernet" \
--text="Restore Ethernet" \
--percentage=0 \
--auto-close
zenity --info --text="Programme terminé"
xdg-open http://ekimia.fr &
exit 0