mirror of https://gitlab.com/hp3icc/fdmr.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
4.0 KiB
95 lines
4.0 KiB
#!/bin/bash
|
|
|
|
# Verificar si el usuario tiene permisos de root
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "Este script debe ejecutarse como usuario ROOT"
|
|
exit 1
|
|
fi
|
|
|
|
# Actualizar la lista de paquetes una vez al principio
|
|
sudo apt-get update
|
|
|
|
# Función para verificar e instalar una aplicación
|
|
check_and_install() {
|
|
app=$1
|
|
if ! dpkg -s $app >/dev/null 2>&1; then
|
|
echo "$app no está instalado. Instalando..."
|
|
sudo apt-get install $app -y
|
|
echo "$app instalado correctamente."
|
|
else
|
|
echo "Verificando si hay actualizaciones para $app..."
|
|
available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}')
|
|
current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}')
|
|
|
|
if [ "$available_version" != "$current_version" ]; then
|
|
echo "Hay una versión actualizada de $app disponible. Actualizando..."
|
|
sudo apt-get install --only-upgrade $app -y
|
|
echo "$app actualizado correctamente."
|
|
else
|
|
echo "$app ya está instalado y actualizado."
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Lista de aplicaciones para verificar e instalar
|
|
apps=("git" "make" "build-essential" "libusb-1.0-0-dev" "python" "python3" "python3-pip" "chkconfig" "git-core" "libi2c-dev" "i2c-tools" "lm-sensors" "python3-websockets" "python3-gpiozero" "python3-psutil" "python3-serial" "wget" "sudo" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl" "wavemon" "gcc" "g++" "cmake" "libasound2-dev" "libudev-dev" "gpsd" "libgps-dev" "gpsd-clients" "gpsd-tools" "chrony")
|
|
|
|
# Verificar e instalar cada aplicación
|
|
for app in "${apps[@]}"; do
|
|
check_and_install $app
|
|
done
|
|
|
|
# Verificar y actualizar python3-venv si no está instalado
|
|
if ! dpkg -s python3-venv >/dev/null 2>&1; then
|
|
echo "python3-venv no está instalado. Instalando..."
|
|
sudo apt-get install python3-venv -y
|
|
echo "python3-venv instalado correctamente."
|
|
fi
|
|
|
|
# Crear y activar un entorno virtual
|
|
cd /opt/
|
|
python3 -m venv myenv
|
|
source myenv/bin/activate
|
|
|
|
# Instalar pip en el entorno virtual
|
|
wget https://bootstrap.pypa.io/pip/get-pip.py
|
|
python3 get-pip.py
|
|
rm get-pip.py
|
|
|
|
# Instalar paquetes en el entorno virtual
|
|
sudo apt install -y libssl-dev
|
|
python3 -m pip install --no-cache-dir --upgrade pip setuptools
|
|
python3 -m pip install --no-cache-dir --upgrade cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 MarkupSafe bitarray configparser aprslib attrs wheel service_identity pyOpenSSL mysqlclient tinydb ansi2html mysql-connector-python pandas xlsxwriter cursor pynmea2 maidenhead flask folium mysql-connector resettabletimer setproctitle requests libscrc Pyro5
|
|
|
|
# Instalar Rust y configurar versión
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source $HOME/.cargo/env
|
|
|
|
rustup install 1.72.0
|
|
rustup default 1.72.0
|
|
|
|
# Crear archivo requirements.txt y instalar paquetes
|
|
#cat <<EOF | sudo tee /opt/requirements.txt
|
|
|
|
##############
|
|
#sudo pip install --no-cache-dir --upgrade -r /opt/requirements.txt
|
|
|
|
# Desactivar el entorno virtual
|
|
deactivate
|
|
|
|
pip install --no-cache-dir --upgrade cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 MarkupSafe bitarray configparser aprslib attrs wheel service_identity pyOpenSSL mysqlclient tinydb ansi2html mysql-connector-python pandas xlsxwriter cursor pynmea2 maidenhead flask folium mysql-connector resettabletimer setproctitle requests libscrc Pyro5
|
|
|
|
echo "Instalación completa."
|
|
#######
|
|
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/fdmr/-/raw/main/install.sh)"
|
|
sudo systemctl start freedmr.service
|
|
sudo systemctl enable freedmr.service
|
|
sudo systemctl start proxy.service
|
|
sudo systemctl enable proxy.service
|
|
sudo systemctl start fdmr_mon.service
|
|
sudo systemctl enable fdmr_mon.service
|
|
sudo systemctl start fdmrparrot.service
|
|
sudo systemctl enable fdmrparrot.service
|
|
sudo systemctl start http.server-fdmr.service
|
|
sudo systemctl enable http.server-fdmr.service
|
|
menu-fdmr |