-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathporteus-v5-configuration.sh
executable file
·140 lines (123 loc) · 4.42 KB
/
porteus-v5-configuration.sh
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
#!/bin/bash
# Help menu
help(){
echo "Configuración de Porteus v5.0 (OPENBOX) en los clientes ligeros"
echo ""
echo "Uso:"
echo " $(basename $0) [-l <ip-servidor>] [-w <ip-servidor>] [-m <ip-servidor>]"
echo " $(basename $0) -h"
echo " $(basename $0) -v"
echo ""
echo "Opciones:"
echo " -l <ip-servidor> Dirección IP del servidor Linux [Default: 0.0.0.0]"
echo " -w <ip-servidor> Dirección IP del servidor Windows [Default: 0.0.0.0]"
echo " -m <ip-servidor> Dirección IP del servidor Mac [Default: 0.0.0.0]"
echo " -h Muestra este menú"
echo " -v Muestra la versión"
echo ""
echo "Este script realiza las siguientes acciones:"
echo " 1) Establece la nueva contraseña de root"
echo " 2) Establece el servidor que se usará para las actualizaciones de Porteus"
echo " 3) Instala los fondos de pantalla"
echo " 4) Establece la distribución del teclado por defecto"
echo " 5) Instala y configura Remmina con sus respectivos perfiles de conexión"
echo " 6) Configura la barra de tareas"
echo " 7) Configura el firewall"
echo ""
echo "Notas:Es necesario seleccionar al menos una opción de servidor con su "
echo " respectiva dirección IP, de lo contrario se abortará la ejecución "
echo " del script."
echo " Este script debe de ser ejecutado con permisos de superusuario."
echo " Antes de ejecutar el script verifique que tiene una conexión a"
echo " internet."
echo ""
echo "Autor: William Alexander"
}
SERVER_LINUX="server=0.0.0.0"
PROFILE_LINUX="/home/guest/.local/share/remmina/servidor-linux.remmina"
SERVER_WINDOWS="server=0.0.0.0"
PROFILE_WINDOWS="/home/guest/.local/share/remmina/servidor-windows.remmina"
SERVER_MAC="server=0.0.0.0"
PROFILE_MAC="/home/guest/.local/share/remmina/servidor-mac.remmina"
SERVER_SELECTED=0
# Check the options
while getopts ":l:w:m:hv" OPTIONS; do
case "${OPTIONS}" in
l)
SERVER_LINUX="server="${OPTARG}
SERVER_SELECTED=1
;;
w)
SERVER_WINDOWS="server="${OPTARG}
SERVER_SELECTED=1
;;
m)
SERVER_MAC="server="${OPTARG}
SERVER_SELECTED=1
;;
h)
help
exit 0
;;
v)
echo -n "Versión: "
cat VERSION
exit 0
;;
:)
echo "ERROR: La opción '-${OPTARG}' requiere de una dirección IP"
help
exit 1
;;
*)
echo "ERROR: La opción '-${OPTARG}' es incorrecta"
help
exit 1
;;
esac
done
# Abort the execution if the user didn't enter a server option
if [ "$SERVER_SELECTED" == "0" ]; then
echo "ERROR: El usuario no ingresó ninguna opción de servidor"
help
exit 1
fi
# Abort the execution if the user didn't run the script with root privileges
if [ "$EUID" != "0" ]; then
echo "ERROR: El script debe de ser ejecutado con permisos de superusuario"
help
exit 1
fi
# Configure the root password; abort if the passwords don't match
setxkbmap latam
passwd root || exit 1
# Configure the nearest Porteus server for updates
echo 'y' | fastest-mirror
# Install the wallpapers
install wallpapers/porteus_boot.png /mnt/sda1/boot/syslinux/porteus.png
install wallpapers/porteus_wallpaper.png /usr/share/wallpapers/porteus.jpg
# Configure the keyboard layout
install keyboard/gxkb.cfg /home/guest/.config/gxkb/gxkb.cfg
install keyboard/latam.png /usr/share/gxkb/flags/latam.png
# Install the server icons
install icons/*.png /usr/share/icons/Paper/24x24/places/
# Install and configure Remmina with the server connection profiles
install remmina/remmina*.xzm /mnt/sda1/porteus/modules/
activate /mnt/sda1/porteus/modules/remmina*.xzm && remmina &
sleep 5s
killall remmina
mkdir -p /home/guest/.local/share/remmina
install remmina/*.remmina /home/guest/.local/share/remmina/
echo $SERVER_LINUX >> $PROFILE_LINUX
echo $SERVER_WINDOWS >> $PROFILE_WINDOWS
echo $SERVER_MAC >> $PROFILE_MAC
# Configure the dock
install dock/tint2rc /home/guest/.config/tint2/tint2rc
install dock/*.desktop /usr/share/applications/
# Configure the firewall (iptables)
install firewall/rc.FireWall /etc/rc.d/rc.FireWall
chmod u+x /etc/rc.d/rc.FireWall
cd /etc/rc.d/
./rc.FireWall start
# Poweroff the system
poweroff