-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-smartdre
executable file
·216 lines (196 loc) · 6.51 KB
/
install-smartdre
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#! /bin/bash
clear
# Variables
#
ROJO="\033[1;31m"
NORMAL="\033[0m"
AZUL="\033[1;34m"
DISTRO=$(lsb_release -cs)
DESKTOP=$XDG_CURRENT_DESKTOP
# Copia el script en el sistema que comprueba que existe la extensión gnome appindicator
# En caso contrario la descarga y la instala en el usuario local
if [[ $DESKTOP = ubuntu:GNOME || $DESKTOP = ubuntu || $DESKTOP = GNOME || $DESKTOP = UBUNTU || $DESKTOP = gnome ]]
then
echo ""
echo -e "${ROJO}Escritorio basado en GNOME${NORMAL}"
echo ""
echo -e "${ROJO}Desktop based on GNOME${NORMAL}"
echo ""
echo -e "${ROJO}Instalando extensión de GNOME appindicatorsupportrgcjonas${NORMAL}"
echo ""
echo -e "${ROJO}Installing appindicatorsupportrgcjonas GNOME EXTENSION${NORMAL}"
echo ""
sleep 3
sudo cp check-appindicator-gnome-extension /usr/bin
sudo chmod +x /usr/bin/check-appindicator-gnome-extension
sudo cp check-appindicator-gnome-extension.desktop /etc/xdg/autostart/
else
echo ""
echo -e "${ROJO}Escritorio no basado en GNOME${NORMAL}"
echo ""
echo -e "${ROJO}Desktop not-based on GNOME${NORMAL}"
echo ""
echo ""
echo -e "${AZUL}Desktop environment $XDG_CURRENT_DESKTOP${NORMAL}"
sleep 4
fi
# Establecer la distribución en la que se basa el sistema host.
#
if [[ $DISTRO = focal || $DISTRO = ulyana || $DISTRO = ulyssa || $DISTRO = uma || $DISTRO = una ]]
then
BASED=focal
elif
[[ $DISTRO = bionic || $DISTRO = tricia || $DISTRO = tina || $DISTRO = tessa || $DISTRO = tara ]]
then
BASED=bionic
else
echo ""
echo -e "${ROJO}Esta instalación no es compatible con tu sistema${NORMAL}"
echo ""
echo -e "${ROJO}This install process is not compatible with your system${NORMAL}"
echo ""
sleep 4
exit
fi
echo ""
echo System codename $DISTRO
echo ""
echo System based on Ubuntu $BASED
echo ""
sleep 2
# Este script funciona en Ubuntu 18.04, bionic y Ubuntu 20.04, así como las derivadas en linux Mint.
#
echo ""
echo -e "${ROJO}Solicitando contraseña del usuario con derechos de administrador${NORMAL}"
echo ""
echo -e "${ROJO}Asking password of the user with administrations rights${NORMAL}"
echo ""
sudo echo ""
# Borrando antiguos archivos de smartdre o lliurex-smart
#
echo ""
echo -e "${ROJO}Borrando si existen archivos de anteriores instalaciones${NORMAL}"
echo ""
echo -e "${ROJO} Deleting if there are files from previous installations${NORMAL}"
echo ""
sudo chmod +x uninstall-smartdre
sudo ./uninstall-smartdre
#Instalación paquetes/drivers nwfermi en el sistema host
#
if [[ $BASED = focal ]]
then
echo ""
echo -e "${AZUL}Tu sistema Linux está basado en Ubuntu focal, instalando drivers...${NORMAL}"
echo ""
echo -e "${AZUL}Your system is based on Ubuntu Focal, installing drivers...${NORMAL}"
echo ""
sleep 4
sudo apt-get install git -y
sudo apt-get install dkms -y
git clone https://github.com/aosucas499/nwfermi
cd nwfermi
chmod +x nwfermi-focal.sh
sudo ./nwfermi-focal.sh
cd ..
sudo rm -r nwfermi
elif [[ $BASED = bionic ]]
then
echo ""
echo -e "${AZUL}Tu sistema Linux está basado en Ubuntu bionic, instalando drivers...${NORMAL}"
echo ""
echo -e "${AZUL}Your system is based on Ubuntu Bionic, installing drivers...${NORMAL}"
echo ""
sleep 4
sudo apt-get install git -y
sudo apt-get install dkms -y
git clone https://github.com/aosucas499/nwfermi
cd nwfermi
chmod +x nwfermi-host-bionic.sh
sudo ./nwfermi-host-bionic.sh
cd ..
sudo rm -r nwfermi
else
echo ""
echo -e "${ROJO}Esta instalación no es compatible con tu sistema${NORMAL}"
echo ""
echo -e "${ROJO}This install process is not compatible with your system${NORMAL}"
echo ""
sleep 4
exit
fi
echo ""
echo -e "${AZUL}continúa el script...${NORMAL}"
echo ""
echo -e "${AZUL}the script continues...${NORMAL}"
echo ""
# Instalar docker
#
echo ""
echo -e "${AZUL}Instalando Docker...${NORMAL}"
echo ""
echo -e "${AZUL}Instaling Docker...${NORMAL}"
echo ""
sudo apt update
sudo apt install -f
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
sudo apt install -f
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
#sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $DISTRO stable"
touch docker.list
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $BASED stable" > docker.list
sudo mv docker.list /etc/apt/sources.list.d/docker.list
sudo apt-key fingerprint 0EBFCD88
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y
#sudo usermod -aG docker $USER
sudo rm /etc/apt/sources.list.d/docker.list
# Descarga la imagen docker
#
echo ""
echo -e "${AZUL}Descargando la imagen docker que contiene los drivers de la pizarra...${NORMAL}"
echo ""
echo -e "${AZUL}Downloading the docker image with the board drivers...${NORMAL}"
echo ""
sudo docker pull aosucas499/smartdre
# Hacer la aplicación iniciable en cada reinicio y usable para cualquier usuario sin "sudo"
#
echo ""
echo -e "${AZUL}Configurando la app para que arranque en cada inicio de sesión...${NORMAL}"
echo ""
echo -e "${AZUL}Settings up the app to boot at init...${NORMAL}"
echo ""
sudo cp smartdre /usr/bin
sudo chmod +x /usr/bin/smartdre
sudo chown root:root zz-smartdre
sudo chmod 0440 zz-smartdre
sudo cp zz-smartdre /etc/sudoers.d/
sudo cp smartdre.desktop /etc/xdg/autostart/
sudo cp smartdre.desktop /usr/share/applications/
# Crear apps y links para orientar y el panel de control de la pizarra en sistemas sin el icono en la barra de tareas
# Por ejemplo Ubuntu Focal y EducaAndOS
#
sudo cp orient /usr/bin
sudo chmod +x /usr/bin/orient
sudo chown root:root zz-orient
sudo chmod 0440 zz-orient
sudo cp zz-orient /etc/sudoers.d/
sudo cp smartdre-orient.desktop /usr/share/applications/
sudo cp controlpanel /usr/bin
sudo chmod +x /usr/bin/controlpanel
sudo chown root:root zz-controlpanel
sudo chmod 0440 zz-controlpanel
sudo cp zz-controlpanel /etc/sudoers.d/
sudo cp smartdre-controlpanel.desktop /usr/share/applications/
# Añadir iconos originales al sistema
#
sudo cp icons/* /usr/share/icons
# Notificaciones al terminar
#
echo ""
echo -e "${ROJO}Reinicie el equipo para que se ejecute la aplicación${NORMAL}"
echo ""
sudo notify-send "Reinicie el equipo para que se ejecute la aplicación"
# Borrar los repositorios de git y archivos de instalación
#
cd ..
sudo rm -r smartdre